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
01d0e1a50e45a574d9bfbe4a
train
class
class CompileTimeConstantExpressionBase(ExpressionNoSideEffectsMixin, ExpressionBase): # TODO: Do this for all computations, do this in the base class of all # nodes. __slots__ = ("computed_attribute",) def __init__(self, source_ref): ExpressionBase.__init__(self, source_ref=source_ref) ...
class CompileTimeConstantExpressionBase(ExpressionNoSideEffectsMixin, ExpressionBase): # TODO: Do this for all computations, do this in the base class of all # nodes.
__slots__ = ("computed_attribute",) def __init__(self, source_ref): ExpressionBase.__init__(self, source_ref=source_ref) self.computed_attribute = None @staticmethod def isCompileTimeConstant(): """Has a value that we can use at compile time. Yes or no. If it has such...
self.getTypeShape() in (tshape_str, tshape_unicode) else: def hasShapeStrOrUnicodeExact(self): return self.getTypeShape() is tshape_str class ExpressionNoSideEffectsMixin(object): __slots__ = () @staticmethod def mayHaveSideEffects(): # Virtual method overload r...
256
256
1,806
38
217
fleimgruber/Nuitka
nuitka/nodes/ExpressionBases.py
Python
CompileTimeConstantExpressionBase
CompileTimeConstantExpressionBase
881
1,148
881
883
30bf1881608e06bc9b917c48afe3c212ce6c63fe
bigcode/the-stack
train
aaedb8e85c55369c2aca25fa
train
class
class ExpressionNoSideEffectsMixin(object): __slots__ = () @staticmethod def mayHaveSideEffects(): # Virtual method overload return False @staticmethod def extractSideEffects(): # Virtual method overload, we said we have no effects. return () def computeExpress...
class ExpressionNoSideEffectsMixin(object):
__slots__ = () @staticmethod def mayHaveSideEffects(): # Virtual method overload return False @staticmethod def extractSideEffects(): # Virtual method overload, we said we have no effects. return () def computeExpressionDrop(self, statement, trace_collection): ...
str is bytes: def hasShapeStrOrUnicodeExact(self): return self.getTypeShape() in (tshape_str, tshape_unicode) else: def hasShapeStrOrUnicodeExact(self): return self.getTypeShape() is tshape_str class ExpressionNoSideEffectsMixin(object):
64
64
178
8
55
fleimgruber/Nuitka
nuitka/nodes/ExpressionBases.py
Python
ExpressionNoSideEffectsMixin
ExpressionNoSideEffectsMixin
850
878
850
850
52312228ba71a636550c449ad44ea909eca39a96
bigcode/the-stack
train
06705247cf48a2aae8e0cf6b
train
class
class ExpressionChildrenHavingBase(ChildrenHavingMixin, ExpressionBase): def __init__(self, values, source_ref): ExpressionBase.__init__(self, source_ref=source_ref) ChildrenHavingMixin.__init__(self, values=values) def computeExpressionRaw(self, trace_collection): """Compute an expres...
class ExpressionChildrenHavingBase(ChildrenHavingMixin, ExpressionBase):
def __init__(self, values, source_ref): ExpressionBase.__init__(self, source_ref=source_ref) ChildrenHavingMixin.__init__(self, values=values) def computeExpressionRaw(self, trace_collection): """Compute an expression. Default behavior is to just visit the child expressions fi...
Constant() assert type(constant) is not bool self.parent.replaceChild( self, makeConstantReplacementNode(bool(constant), self, user_provided=False) ) trace_collection.signalChange( tags="new_constant", source_ref=self.source_ref, message...
83
83
277
13
70
fleimgruber/Nuitka
nuitka/nodes/ExpressionBases.py
Python
ExpressionChildrenHavingBase
ExpressionChildrenHavingBase
1,151
1,186
1,151
1,151
efa30cdb79c2a7dfcaafa43dcbb20b98b9c4b0c4
bigcode/the-stack
train
65b8999d271250bb5dcad2ec
train
function
def umf(testdata, test, mpi, omp, suffix, testfig): """! Plot script for the "univariate moments fields" files produced by BUMP""" # Open file f = Dataset(testdata + "/" + test + "/test_" + mpi + "-" + omp + "_" + suffix + ".nc", "r", format="NETCDF4") # Get _FillValue _FillValue = f.__dict__["_FillVa...
def umf(testdata, test, mpi, omp, suffix, testfig):
"""! Plot script for the "univariate moments fields" files produced by BUMP""" # Open file f = Dataset(testdata + "/" + test + "/test_" + mpi + "-" + omp + "_" + suffix + ".nc", "r", format="NETCDF4") # Get _FillValue _FillValue = f.__dict__["_FillValue"] # Get lon/lat lon = f["lon"][:] lat ...
#!/usr/bin/env python3 import argparse from netCDF4 import Dataset import matplotlib import matplotlib.pyplot as plt import numpy as np import numpy.ma as ma import os def umf(testdata, test, mpi, omp, suffix, testfig):
56
132
441
16
39
NOAA-EMC/saber
tools/saber_plot/umf.py
Python
umf
umf
11
54
11
11
1a68fde0e12056bed59a60bf954a7f9b20813c0b
bigcode/the-stack
train
d2ce331bb312ed34bd07a657
train
class
class GatewayForm(AuthenticationForm): username = forms.EmailField(label=_("My email address is")) GUEST, NEW, EXISTING = 'anonymous', 'new', 'existing' CHOICES = ( (GUEST, _('I am a new customer and want to checkout as a guest')), (NEW, _('I am a new customer and want to create an account '...
class GatewayForm(AuthenticationForm):
username = forms.EmailField(label=_("My email address is")) GUEST, NEW, EXISTING = 'anonymous', 'new', 'existing' CHOICES = ( (GUEST, _('I am a new customer and want to checkout as a guest')), (NEW, _('I am a new customer and want to create an account ' 'before checking out')...
dropdown if there is only one option if len(countries) == 1: del self.fields['country'] self.instance.country = countries[0] else: self.fields['country'].queryset = countries self.fields['country'].empty_label = None class Meta: model = get_m...
91
91
304
6
85
Idematica/django-oscar
oscar/apps/checkout/forms.py
Python
GatewayForm
GatewayForm
39
69
39
39
1cd145bb81bb5be44648a80dacfebaaa6d93ae37
bigcode/the-stack
train
9bebbaaeb7cbec8ffc4a5032
train
class
class ShippingAddressForm(PhoneNumberMixin, AbstractAddressForm): def __init__(self, *args, **kwargs): super(ShippingAddressForm, self).__init__(*args, **kwargs) self.adjust_country_field() def adjust_country_field(self): countries = Country._default_manager.filter( is_ship...
class ShippingAddressForm(PhoneNumberMixin, AbstractAddressForm):
def __init__(self, *args, **kwargs): super(ShippingAddressForm, self).__init__(*args, **kwargs) self.adjust_country_field() def adjust_country_field(self): countries = Country._default_manager.filter( is_shipping_country=True) # No need to show country dropdown if t...
AbstractAddressForm from oscar.apps.customer.utils import normalise_email from oscar.core.compat import get_user_model from oscar.views.generic import PhoneNumberMixin User = get_user_model() Country = get_model('address', 'Country') class ShippingAddressForm(PhoneNumberMixin, AbstractAddressForm):
64
64
162
13
51
Idematica/django-oscar
oscar/apps/checkout/forms.py
Python
ShippingAddressForm
ShippingAddressForm
16
36
16
17
cdef9f775892bf0d286a33f210813dd0992f4d2e
bigcode/the-stack
train
8928801e45bdd5426c83a938
train
class
class Registry: """This is a registry class used to register classes and modules so that a universal object builder can be enabled. Args: name (str): The name of the registry . third_party_library (list, optional): List of third party libraries which are used in the initializat...
class Registry:
"""This is a registry class used to register classes and modules so that a universal object builder can be enabled. Args: name (str): The name of the registry . third_party_library (list, optional): List of third party libraries which are used in the initialization of the regis...
#!/usr/bin/env python # -*- encoding: utf-8 -*- from types import ModuleType from typing import List class Registry:
28
174
580
3
24
jiangz17THU/ColossalAI
colossalai/registry/registry.py
Python
Registry
Registry
8
82
8
8
9ad90feb6f90a9e8e4882d841debf20209507c1a
bigcode/the-stack
train
b0700c305d7baf0008ee4192
train
class
class FileToGoogleCloudStorageOperator(BaseOperator): """ Uploads a file to Google Cloud Storage. Optionally can compress the file for upload. :param src: Path to the local file. (templated) :type src: str :param dst: Destination path within the specified bucket. (templated) :type dst: str ...
class FileToGoogleCloudStorageOperator(BaseOperator):
""" Uploads a file to Google Cloud Storage. Optionally can compress the file for upload. :param src: Path to the local file. (templated) :type src: str :param dst: Destination path within the specified bucket. (templated) :type dst: str :param bucket: The bucket to upload to. (templated...
of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific...
126
126
421
10
115
FlyrInc/airflow-1
airflow/contrib/operators/file_to_gcs.py
Python
FileToGoogleCloudStorageOperator
FileToGoogleCloudStorageOperator
26
82
26
26
a579cea735a33a71d6e2c9f226c4914d680c7fa7
bigcode/the-stack
train
40db3f3874bf29bb47c3e6a5
train
class
class BatchDataset(Dataset): """A torch.Dataset class that can read data batch by batch.""" def __init__(self, csv_file_path, image_path, has_target=True): file_names, target = read_csv_file(csv_file_path) self.y_encoder = OneHotEncoder() self.y_encoder.fit(target) target = sel...
class BatchDataset(Dataset):
"""A torch.Dataset class that can read data batch by batch.""" def __init__(self, csv_file_path, image_path, has_target=True): file_names, target = read_csv_file(csv_file_path) self.y_encoder = OneHotEncoder() self.y_encoder.fit(target) target = self.y_encoder.transform(target)...
self.compose = compose def __getitem__(self, index): feature = self.dataset[index] if self.target is None: return self.compose(feature) return self.compose(feature), self.target[index] def __len__(self): return len(self.dataset) class BatchDataset(Dataset):
64
64
199
6
58
IncyLiu/autokeras
autokeras/preprocessor.py
Python
BatchDataset
BatchDataset
308
332
308
308
a8de4317ea5da92180b360907b1a96c0fddf5094
bigcode/the-stack
train
50411fc6a0c5c9cd789144df
train
class
class DataTransformer(ABC): """A superclass for all the DataTransformer.""" def __init__(self): pass @abstractmethod def transform_train(self, data, targets=None, batch_size=None): """ Transform the training data and get the DataLoader class. Args: data: x. ...
class DataTransformer(ABC):
"""A superclass for all the DataTransformer.""" def __init__(self): pass @abstractmethod def transform_train(self, data, targets=None, batch_size=None): """ Transform the training data and get the DataLoader class. Args: data: x. targets: y. ...
(x + self.length // 2, 0, w) mask[y1: y2, x1: x2] = 0. mask = torch.from_numpy(mask) mask = mask.expand_as(img) img = img * mask return img class DataTransformer(ABC):
64
64
188
6
57
IncyLiu/autokeras
autokeras/preprocessor.py
Python
DataTransformer
DataTransformer
101
133
101
101
df292001b2cd9f82052c729b0584bcbb4d163777
bigcode/the-stack
train
7f4df1204e6792ff80ee3aa2
train
class
class MultiTransformDataset(Dataset): """A class incorporate all transform method into a torch.Dataset class.""" def __init__(self, dataset, target, compose): self.dataset = dataset self.target = target self.compose = compose def __getitem__(self, index): feature = self.dat...
class MultiTransformDataset(Dataset):
"""A class incorporate all transform method into a torch.Dataset class.""" def __init__(self, dataset, target, compose): self.dataset = dataset self.target = target self.compose = compose def __getitem__(self, index): feature = self.dataset[index] if self.target is ...
0, len(data.shape) - 1] + list(range(1, len(data.shape) - 1)) data = torch.Tensor(data.transpose(*args)) data_transforms = Compose(compose_list) return MultiTransformDataset(data, targets, data_transforms) class MultiTransformDataset(Dataset):
64
64
104
7
57
IncyLiu/autokeras
autokeras/preprocessor.py
Python
MultiTransformDataset
MultiTransformDataset
290
305
290
290
607e4059d5871cfa28cb584ca26adade52820352
bigcode/the-stack
train
aa736b79dc1524167dfe0603
train
class
class DataTransformerMlp(DataTransformer): def __init__(self, data): super().__init__() self.mean = np.mean(data, axis=0) self.std = np.std(data, axis=0) def transform_train(self, data, targets=None, batch_size=None): data = (data - self.mean) / self.std data = np.nan_to...
class DataTransformerMlp(DataTransformer):
def __init__(self, data): super().__init__() self.mean = np.mean(data, axis=0) self.std = np.std(data, axis=0) def transform_train(self, data, targets=None, batch_size=None): data = (data - self.mean) / self.std data = np.nan_to_num(data) dataset = self._transfor...
.max_val args = [0, len(data.shape) - 1] + list(range(1, len(data.shape) - 1)) data = torch.Tensor(data.transpose(*args)) data_transforms = Compose(compose_list) return MultiTransformDataset(data, targets, data_transforms) class DataTransformerMlp(DataTransformer):
72
72
243
8
64
IncyLiu/autokeras
autokeras/preprocessor.py
Python
DataTransformerMlp
DataTransformerMlp
263
287
263
263
4ff83af505d4cefb9feeeeee0eb72c4fd8e327d2
bigcode/the-stack
train
909ac82f22efcfc867a3a6c8
train
class
class Cutout(object): """Randomly mask out one or more patches from an image. Args: n_holes (int): Number of patches to cut out of each image. length (int): The length (in pixels) of each square patch. """ def __init__(self, n_holes, length): self.n_holes = n_holes self...
class Cutout(object):
"""Randomly mask out one or more patches from an image. Args: n_holes (int): Number of patches to cut out of each image. length (int): The length (in pixels) of each square patch. """ def __init__(self, n_holes, length): self.n_holes = n_holes self.length = length ...
every element in the data array.""" data = np.array(data) if len(data.shape) > 1: data = data.flatten() return np.array(list(map(lambda x: self.label_to_vec[x], data))) def inverse_transform(self, data): """Get label for every element in data.""" return np.array...
95
96
321
5
90
IncyLiu/autokeras
autokeras/preprocessor.py
Python
Cutout
Cutout
57
98
57
57
72f71b8cd2901374af54f7e6738d8fae517d1636
bigcode/the-stack
train
2a6a523d12df3a225f2bbaa9
train
class
class OneHotEncoder: """A class that can format data. This class provides ways to transform data's classification label into vector. Attributes: data: The input data n_classes: The number of classes in the classification problem. labels: The number of labels. label_...
class OneHotEncoder:
"""A class that can format data. This class provides ways to transform data's classification label into vector. Attributes: data: The input data n_classes: The number of classes in the classification problem. labels: The number of labels. label_to_vec: Mapping from ...
import os from abc import ABC, abstractmethod import numpy as np import torch from torch.utils.data import Dataset, DataLoader from torchvision.transforms import ToPILImage, RandomCrop, RandomHorizontalFlip, ToTensor, Normalize, Compose from autokeras.constant import Constant from autokeras.utils import read_csv_file...
78
99
331
5
72
IncyLiu/autokeras
autokeras/preprocessor.py
Python
OneHotEncoder
OneHotEncoder
13
54
13
13
294fc6e90f07a63fc5fc887e08bdfacadb2132e6
bigcode/the-stack
train
401d0f10b45131c261c3a95d
train
class
class ImageDataTransformer(DataTransformer): """ Perform basic image transformation and augmentation. Attributes: max_val: the maximum value of all data. mean: the mean value. std: the standard deviation. augment: whether to perform augmentation on data. """ def __init_...
class ImageDataTransformer(DataTransformer):
""" Perform basic image transformation and augmentation. Attributes: max_val: the maximum value of all data. mean: the mean value. std: the standard deviation. augment: whether to perform augmentation on data. """ def __init__(self, data, augment=None): super()....
_transforms = Compose(compose_list) return MultiTransformDataset(data, targets, data_transforms) class TextDataTransformer(DataTransformer): """ A DataTransformer class for the text data.""" def __init__(self): super().__init__() def transform_train(self, data, targets=None, batch_size=None)...
216
216
720
7
209
IncyLiu/autokeras
autokeras/preprocessor.py
Python
ImageDataTransformer
ImageDataTransformer
167
260
167
167
030f48b7bc344d832781b026349ca0270e4422b8
bigcode/the-stack
train
5a06fad4ef42f2c97f2a3e08
train
function
def text_transform(compose_list, data, targets): data = torch.Tensor(data.transpose(0, 2, 1)) data_transforms = Compose(compose_list) return MultiTransformDataset(data, targets, data_transforms)
def text_transform(compose_list, data, targets):
data = torch.Tensor(data.transpose(0, 2, 1)) data_transforms = Compose(compose_list) return MultiTransformDataset(data, targets, data_transforms)
the DataLoader class. Args: data: x. targets: y. batch_size: the batch size. Returns: dataloader: A torch.DataLoader class to represent the transformed data. """ raise NotImplementedError def text_transform(compose_list, data, targets):
64
64
50
11
52
IncyLiu/autokeras
autokeras/preprocessor.py
Python
text_transform
text_transform
136
139
136
136
27c77acb77bcb3a7404af10a237c6af699cf1a2e
bigcode/the-stack
train
b5fa3cf1483a0f34be3be40b
train
class
class TextDataTransformer(DataTransformer): """ A DataTransformer class for the text data.""" def __init__(self): super().__init__() def transform_train(self, data, targets=None, batch_size=None): """Transform the training dataset.""" dataset = text_transform(compose_list=[], data=...
class TextDataTransformer(DataTransformer):
""" A DataTransformer class for the text data.""" def __init__(self): super().__init__() def transform_train(self, data, targets=None, batch_size=None): """Transform the training dataset.""" dataset = text_transform(compose_list=[], data=data, targets=targets) if batch_size...
""" raise NotImplementedError def text_transform(compose_list, data, targets): data = torch.Tensor(data.transpose(0, 2, 1)) data_transforms = Compose(compose_list) return MultiTransformDataset(data, targets, data_transforms) class TextDataTransformer(DataTransformer):
64
64
188
7
57
IncyLiu/autokeras
autokeras/preprocessor.py
Python
TextDataTransformer
TextDataTransformer
142
164
142
142
5fad57e7d247c1ae051402321a604b3b4074ba52
bigcode/the-stack
train
e44c0d2a278db98ae32e063c
train
function
def _parse_zkurl(zkurl): """ """ parsed = urllib.parse.urlparse(zkurl) # Load a handler for the scheme scheme_mod = zkclient.get_scheme_module(parsed.scheme) zkclient_cls = scheme_mod.ZkClient connargs = scheme_mod.url_connargs(parsed) return zkclient_cls, connargs
def _parse_zkurl(zkurl):
""" """ parsed = urllib.parse.urlparse(zkurl) # Load a handler for the scheme scheme_mod = zkclient.get_scheme_module(parsed.scheme) zkclient_cls = scheme_mod.ZkClient connargs = scheme_mod.url_connargs(parsed) return zkclient_cls, connargs
.security.make_acl( 'world', 'anyone', read='r' in perm, write='w' in perm, create='c' in perm, delete='d' in perm, admin='a' in perm ) def _parse_zkurl(zkurl):
64
64
77
10
54
lisajoseph/journal
lib/python/journal/zk/utils.py
Python
_parse_zkurl
_parse_zkurl
70
80
70
70
967d7854b883b0779a2ad16d95863b4c83f55ee5
bigcode/the-stack
train
20f2aeb6bb7c82a8ba09b265
train
function
def connect(zkurl, **connargs): """Establish connection with Zk and return an instance of a KazooClient. """ _LOG.debug('Connecting to %s', zkurl) # Use scheme to parse zkurl and extract chroot, hosts, etc. E.g.: # zookeeper+sasl://host:port,host:port,host:port/foo#mechanism=gssapi zkclient_cl...
def connect(zkurl, **connargs):
"""Establish connection with Zk and return an instance of a KazooClient. """ _LOG.debug('Connecting to %s', zkurl) # Use scheme to parse zkurl and extract chroot, hosts, etc. E.g.: # zookeeper+sasl://host:port,host:port,host:port/foo#mechanism=gssapi zkclient_cls, url_connargs = _parse_zkurl(z...
import urllib import kazoo import kazoo.client import kazoo.exceptions import kazoo.security from kazoo.client import ( NodeExistsError, NoNodeError, ConnectionClosedError, ) from . import client as zkclient _LOG = logging.getLogger(__name__) ###########################################################...
72
72
243
10
62
lisajoseph/journal
lib/python/journal/zk/utils.py
Python
connect
connect
24
52
24
24
0f2bde0c30d05b577d6c26256007ccbe365f05f1
bigcode/the-stack
train
cd68d3ed59ca2b6b428d8cda
train
function
def make_anonymous_acl(perm): """Constructs anonymous (anyone) acl.""" if not perm: perm = 'r' return kazoo.security.make_acl( 'world', 'anyone', read='r' in perm, write='w' in perm, create='c' in perm, delete='d' in perm, admin='a' in perm )
def make_anonymous_acl(perm):
"""Constructs anonymous (anyone) acl.""" if not perm: perm = 'r' return kazoo.security.make_acl( 'world', 'anyone', read='r' in perm, write='w' in perm, create='c' in perm, delete='d' in perm, admin='a' in perm )
_cls.__module__, zkclient_cls.__name__, client_connargs ) chroot = client_connargs.pop('chroot') zkc = zkclient_cls(**client_connargs) zkc.chroot = chroot return zkc def make_anonymous_acl(perm):
64
64
88
8
55
lisajoseph/journal
lib/python/journal/zk/utils.py
Python
make_anonymous_acl
make_anonymous_acl
55
67
55
55
b6feab2860eb01cc18b50b263a6d409ab10bf4e5
bigcode/the-stack
train
9c590a762f70c1768fcf11c4
train
function
@click.command() @click.option('-u', default ="", help="Use -u flag to create a new story from a url") @click.option('-s', default=False, help="Use -s flag for stream mode followed by the user name of the twitter user. Required twitter api access") @click.option('-c', default=False, help="Background color of the tweet,...
@click.command() @click.option('-u', default ="", help="Use -u flag to create a new story from a url") @click.option('-s', default=False, help="Use -s flag for stream mode followed by the user name of the twitter user. Required twitter api access") @click.option('-c', default=False, help="Background color of the tweet,...
"""Create beautiful stories from tweets""" if u!="": print("Fetching tweet..") tweet = twintScraper.getTweetFromUrl(u) print("Creating story..") drawStory(tweet, colors[c] if c in colors else colors["twitter"]) elif(s) : if os.environ.get("TWITTER_CUSTOMER_KEY") and o...
, 201, 225), "pink": (246, 169, 189) } @click.command() @click.option('-u', default ="", help="Use -u flag to create a new story from a url") @click.option('-s', default=False, help="Use -s flag for stream mode followed by the user name of the twitter user. Required twitter api access") @click.option('-c', default=...
119
119
399
98
21
dilpreetsio/tweet2story
tweet2story/__main__.py
Python
main
main
20
45
20
24
10beda1e1cbef32484b81eea577d2fb2f6ee0c62
bigcode/the-stack
train
da4572367d6b61de8aa61f50
train
function
@app.task(name='saveData') def save(data): d = json.loads(data) session = Session() # check if data is in the DB q = session.query(Weather) \ .filter(Weather.dt == d['dt']) \ .filter(Weather.city == d['city']) \ .count() print(q) # if data is not in db, save it if q <= 0: w = Weather(d['temp...
@app.task(name='saveData') def save(data):
d = json.loads(data) session = Session() # check if data is in the DB q = session.query(Weather) \ .filter(Weather.dt == d['dt']) \ .filter(Weather.city == d['city']) \ .count() print(q) # if data is not in db, save it if q <= 0: w = Weather(d['temp'], d['temp_min'], d['temp_max'], d['dt'], d[...
Weather from base import Session from pytz import timezone host = os.environ['REDIS_HOST'] port = os.environ['REDIS_PORT'] app = Celery('tasks', broker='redis://' + host + ':' + port + '/0') @app.task(name='saveData') def save(data):
64
64
147
11
53
heinrich10/weather-scraper
collector.py
Python
save
save
13
34
13
14
98e4b81f30bf07ade3814bfd897e0cd61329c436
bigcode/the-stack
train
1ce7fea94861ad52dd3e7777
train
function
def main(): parser = argparse.ArgumentParser(description="MSQL CMD") parser.add_argument('json_folder', help='json_folder') # THis is each row is a json for the spectra parser.add_argument('output_mzML_folder', help='Output mzML Folder') parser.add_argument('output_mgf_folder', help='Output mgf Folder')...
def main():
parser = argparse.ArgumentParser(description="MSQL CMD") parser.add_argument('json_folder', help='json_folder') # THis is each row is a json for the spectra parser.add_argument('output_mzML_folder', help='Output mzML Folder') parser.add_argument('output_mgf_folder', help='Output mgf Folder') parser....
import argparse import os import glob import json import uuid import pandas as pd from massql import msql_extract def _export_extraction(all_spectra, output_mzML_filename, output_mgf_filename, output_json_filename): # Returns two dataframes # Renumbering the scans when merging scan = 1 for spectrum ...
248
250
835
3
244
dvryaboy/MassQueryLanguage
workflow/bin/merged_extracted.py
Python
main
main
39
110
39
39
dfea8a1d5a22469bb3e8fc07ee516311ffac6d10
bigcode/the-stack
train
f73643335036ce9db5f31af7
train
function
def _export_extraction(all_spectra, output_mzML_filename, output_mgf_filename, output_json_filename): # Returns two dataframes # Renumbering the scans when merging scan = 1 for spectrum in all_spectra: spectrum["new_scan"] = scan scan += 1 msql_extract._export_mzML(all_spectra, out...
def _export_extraction(all_spectra, output_mzML_filename, output_mgf_filename, output_json_filename): # Returns two dataframes # Renumbering the scans when merging
scan = 1 for spectrum in all_spectra: spectrum["new_scan"] = scan scan += 1 msql_extract._export_mzML(all_spectra, output_mzML_filename) msql_extract._export_mgf(all_spectra, output_mgf_filename) # Writing out JSON open(output_json_filename, "w").write(json.dumps(all_spectra)) ...
import glob import json import uuid import pandas as pd from massql import msql_extract def _export_extraction(all_spectra, output_mzML_filename, output_mgf_filename, output_json_filename): # Returns two dataframes # Renumbering the scans when merging
65
65
217
42
22
dvryaboy/MassQueryLanguage
workflow/bin/merged_extracted.py
Python
_export_extraction
_export_extraction
11
37
11
14
82aa8fe4159f58b79a611d4c82371af5dd771c52
bigcode/the-stack
train
f99b0f797aef2b754a7ff99a
train
class
class YoutubeDL: """YoutubeDL class. YoutubeDL objects are the ones responsible of downloading the actual video file and writing it to disk if the user has requested it, among some other tasks. In most cases there should be one per program. As, given a video URL, the downloader doesn't know how to ...
class YoutubeDL:
"""YoutubeDL class. YoutubeDL objects are the ones responsible of downloading the actual video file and writing it to disk if the user has requested it, among some other tasks. In most cases there should be one per program. As, given a video URL, the downloader doesn't know how to extract all t...
determine_ext, determine_protocol, encode_compat_str, encodeFilename, error_to_compat_str, expand_path, filter_dict, float_or_none, format_bytes, format_decimal_suffix, format_field, formatSeconds, get_domain, int_or_none, iri_to_uri, join_nonempty, lo...
256
256
37,750
4
251
nxtreaming/yt-dlp
yt_dlp/YoutubeDL.py
Python
YoutubeDL
YoutubeDL
154
3,919
154
154
61bf30ee2811a03762acc1f0b856079c4a82033c
bigcode/the-stack
train
7b0f50e4456493915fca4475
train
class
class StorageStream(XPropertySet_bc180bfa, XEncryptionProtectedSource_8cdf11a3, XSeekable_79540954, XStream_678908a4, XComponent_98dc0ab5): """ Service Class This is a service that represents a stream that can be provided by XStorage.openStreamElement() call implemented by Storage service. In case...
class StorageStream(XPropertySet_bc180bfa, XEncryptionProtectedSource_8cdf11a3, XSeekable_79540954, XStream_678908a4, XComponent_98dc0ab5):
""" Service Class This is a service that represents a stream that can be provided by XStorage.openStreamElement() call implemented by Storage service. In case a stream is open with read-write access only one instance of the stream can exist. See Also: `API StorageStream <https://api.l...
# Service Class # this is a auto generated file generated by Cheetah # Libre Office Version: 7.3 # Namespace: com.sun.star.embed from abc import abstractproperty from ..beans.x_property_set import XPropertySet as XPropertySet_bc180bfa from .x_encryption_protected_source import XEncryptionProtectedSource as XEncryptionP...
186
186
623
47
138
Amourspirit/ooo_uno_tmpl
ooobuild/lo/embed/storage_stream.py
Python
StorageStream
StorageStream
28
83
28
28
ffba5fcb8a38b7f42822f812168e534eaf36b980
bigcode/the-stack
train
00b7f5f586ef68212145770d
train
function
def move_choose_destination(request, page_to_move_id, viewed_page_id=None): page_to_move = get_object_or_404(Page, id=page_to_move_id) page_perms = page_to_move.permissions_for_user(request.user) if not page_perms.can_move(): raise PermissionDenied if viewed_page_id: viewed_page = get_o...
def move_choose_destination(request, page_to_move_id, viewed_page_id=None):
page_to_move = get_object_or_404(Page, id=page_to_move_id) page_perms = page_to_move.permissions_for_user(request.user) if not page_perms.can_move(): raise PermissionDenied if viewed_page_id: viewed_page = get_object_or_404(Page, id=viewed_page_id) else: viewed_page = page_t...
.shortcuts import get_object_or_404, redirect from django.template.response import TemplateResponse from django.urls import reverse from django.utils.translation import gettext as _ from wagtail.admin import messages from wagtail.core import hooks from wagtail.core.actions.move_page import MovePageAction from wagtail....
83
83
277
16
66
Nawarrr/wagtail
wagtail/admin/views/pages/move.py
Python
move_choose_destination
move_choose_destination
14
51
14
14
798eaf6b9df219c3303eeae57aadb23cf3007f1d
bigcode/the-stack
train
653a48be8ec094feae8342a2
train
function
def move_confirm(request, page_to_move_id, destination_id): page_to_move = get_object_or_404(Page, id=page_to_move_id).specific # Needs .specific_deferred because the .get_admin_display_title method is called in template destination = get_object_or_404(Page, id=destination_id).specific_deferred if not ...
def move_confirm(request, page_to_move_id, destination_id):
page_to_move = get_object_or_404(Page, id=page_to_move_id).specific # Needs .specific_deferred because the .get_admin_display_title method is called in template destination = get_object_or_404(Page, id=destination_id).specific_deferred if not Page._slug_is_available(page_to_move.slug, destination, page...
not (target == page_to_move or target.is_child_of(page_to_move)) and target.get_children_count() ) child_pages.append(target) # Pagination paginator = Paginator(child_pages, per_page=50) child_pages = paginator.get_page(request.GET.get("p")) return TemplateResponse( ...
128
128
427
13
115
Nawarrr/wagtail
wagtail/admin/views/pages/move.py
Python
move_confirm
move_confirm
54
110
54
54
83653c2357f7450898c2e0d5b1ba4563a6c18f10
bigcode/the-stack
train
eb9761379f8a8161108e7924
train
class
class CustomUserAdmin(UserAdmin): def log_change(self, request, object, message): # LogEntry.user column doesn't get altered to expect a UUID, so set an # integer manually to avoid causing an error. original_pk = request.user.pk request.user.pk = 1 super(CustomUserAdmin, self...
class CustomUserAdmin(UserAdmin):
def log_change(self, request, object, message): # LogEntry.user column doesn't get altered to expect a UUID, so set an # integer manually to avoid causing an error. original_pk = request.user.pk request.user.pk = 1 super(CustomUserAdmin, self).log_change(request, object, mess...
from django.conf.urls import url from django.contrib import admin from django.contrib.auth import get_user_model from django.contrib.auth.admin import UserAdmin site = admin.AdminSite(name='custom_user_admin') class CustomUserAdmin(UserAdmin):
49
64
87
7
42
MikeAmy/django
tests/auth_tests/urls_custom_user_admin.py
Python
CustomUserAdmin
CustomUserAdmin
9
16
9
9
3a20ce130492d23f95aeeba08b0891a99a170cb4
bigcode/the-stack
train
52f680c951033f3b5ea385ed
train
function
def test_azure_data_lake_list(): list_task = AzureDataLakeList() files = list_task.run(path="raw/supermetrics") assert adls_path in files
def test_azure_data_lake_list():
list_task = AzureDataLakeList() files = list_task.run(path="raw/supermetrics") assert adls_path in files
def test_azure_data_lake_copy(): copy_task = AzureDataLakeCopy() copy_task.run(from_path=adls_path, to_path=adls_path_2) file = AzureDataLake(adls_path_2) assert file.exists() def test_azure_data_lake_list():
64
64
39
9
55
angelika233/viadot
tests/integration/tasks/test_azure_data_lake.py
Python
test_azure_data_lake_list
test_azure_data_lake_list
65
68
65
65
fa6c2f13c8327a6cf324a33b7a6f5d9bc2b43c8e
bigcode/the-stack
train
47f4ec84d502a65eed235700
train
function
def test_azure_data_lake_to_df(): task = AzureDataLakeToDF() df = task.run(path=adls_path, sep="\t") assert not df.empty
def test_azure_data_lake_to_df():
task = AzureDataLakeToDF() df = task.run(path=adls_path, sep="\t") assert not df.empty
DataLake(adls_path) assert file.exists() def test_azure_data_lake_download(): download_task = AzureDataLakeDownload() download_task.run(from_path=adls_path) assert os.path.exists(file_name) os.remove(file_name) def test_azure_data_lake_to_df():
64
64
40
10
54
angelika233/viadot
tests/integration/tasks/test_azure_data_lake.py
Python
test_azure_data_lake_to_df
test_azure_data_lake_to_df
43
46
43
43
085d1cde07bf861c8fa2c67823cec75aa25f8a1c
bigcode/the-stack
train
1fdf0127e3bc509c37514e95
train
function
def test_azure_data_lake_upload(TEST_CSV_FILE_PATH): upload_task = AzureDataLakeUpload() upload_task.run(from_path=TEST_CSV_FILE_PATH, to_path=adls_path) file = AzureDataLake(adls_path) assert file.exists()
def test_azure_data_lake_upload(TEST_CSV_FILE_PATH):
upload_task = AzureDataLakeUpload() upload_task.run(from_path=TEST_CSV_FILE_PATH, to_path=adls_path) file = AzureDataLake(adls_path) assert file.exists()
_file_{uuid_4}.parquet" adls_path_parquet = f"raw/supermetrics/{file_name_parquet}" # TODO: add pytest-depends as download tests depend on the upload # and can't be ran separately def test_azure_data_lake_upload(TEST_CSV_FILE_PATH):
64
64
58
14
49
angelika233/viadot
tests/integration/tasks/test_azure_data_lake.py
Python
test_azure_data_lake_upload
test_azure_data_lake_upload
29
33
29
29
696a7a49333fa25c172b72e8e2b592bc52bf0ba3
bigcode/the-stack
train
9424ed8723335a64bbdef75e
train
function
def test_azure_data_lake_download(): download_task = AzureDataLakeDownload() download_task.run(from_path=adls_path) assert os.path.exists(file_name) os.remove(file_name)
def test_azure_data_lake_download():
download_task = AzureDataLakeDownload() download_task.run(from_path=adls_path) assert os.path.exists(file_name) os.remove(file_name)
azure_data_lake_upload(TEST_CSV_FILE_PATH): upload_task = AzureDataLakeUpload() upload_task.run(from_path=TEST_CSV_FILE_PATH, to_path=adls_path) file = AzureDataLake(adls_path) assert file.exists() def test_azure_data_lake_download():
64
64
43
9
55
angelika233/viadot
tests/integration/tasks/test_azure_data_lake.py
Python
test_azure_data_lake_download
test_azure_data_lake_download
36
40
36
36
4c69b8294d599d0e81801dbbf5bd856e9ff3040f
bigcode/the-stack
train
3723b9f7aac5e11eca4b90e6
train
function
def test_azure_data_lake_to_df_parquet(TEST_PARQUET_FILE_PATH): upload_task = AzureDataLakeUpload() upload_task.run(from_path=TEST_PARQUET_FILE_PATH, to_path=adls_path_parquet) lake_to_df_task = AzureDataLakeToDF() df = lake_to_df_task.run(path=adls_path_parquet) assert not df.empty
def test_azure_data_lake_to_df_parquet(TEST_PARQUET_FILE_PATH):
upload_task = AzureDataLakeUpload() upload_task.run(from_path=TEST_PARQUET_FILE_PATH, to_path=adls_path_parquet) lake_to_df_task = AzureDataLakeToDF() df = lake_to_df_task.run(path=adls_path_parquet) assert not df.empty
os.remove(file_name) def test_azure_data_lake_to_df(): task = AzureDataLakeToDF() df = task.run(path=adls_path, sep="\t") assert not df.empty def test_azure_data_lake_to_df_parquet(TEST_PARQUET_FILE_PATH):
64
64
84
18
45
angelika233/viadot
tests/integration/tasks/test_azure_data_lake.py
Python
test_azure_data_lake_to_df_parquet
test_azure_data_lake_to_df_parquet
49
55
49
49
9cf8af86e9e07ad2cd6eaf42a63e1ad02822c062
bigcode/the-stack
train
cd0a257c93c8600df0957b38
train
function
def test_azure_data_lake_remove(): file = AzureDataLake(adls_path) assert file.exists() remove_task = AzureDataLakeRemove() remove_task.run(path=adls_path) assert not file.exists()
def test_azure_data_lake_remove():
file = AzureDataLake(adls_path) assert file.exists() remove_task = AzureDataLakeRemove() remove_task.run(path=adls_path) assert not file.exists()
file = AzureDataLake(adls_path_2) assert file.exists() def test_azure_data_lake_list(): list_task = AzureDataLakeList() files = list_task.run(path="raw/supermetrics") assert adls_path in files def test_azure_data_lake_remove():
64
64
49
9
54
angelika233/viadot
tests/integration/tasks/test_azure_data_lake.py
Python
test_azure_data_lake_remove
test_azure_data_lake_remove
71
76
71
71
cef8bd4277bee688e371be72967b8f9f3b52ac18
bigcode/the-stack
train
53ba1314cc7bc2828a840a65
train
function
def test_azure_data_lake_copy(): copy_task = AzureDataLakeCopy() copy_task.run(from_path=adls_path, to_path=adls_path_2) file = AzureDataLake(adls_path_2) assert file.exists()
def test_azure_data_lake_copy():
copy_task = AzureDataLakeCopy() copy_task.run(from_path=adls_path, to_path=adls_path_2) file = AzureDataLake(adls_path_2) assert file.exists()
_task.run(from_path=TEST_PARQUET_FILE_PATH, to_path=adls_path_parquet) lake_to_df_task = AzureDataLakeToDF() df = lake_to_df_task.run(path=adls_path_parquet) assert not df.empty def test_azure_data_lake_copy():
64
64
55
9
54
angelika233/viadot
tests/integration/tasks/test_azure_data_lake.py
Python
test_azure_data_lake_copy
test_azure_data_lake_copy
58
62
58
58
d0f0b5c2bdde0be4ac597bea259ddcd68a2d0128
bigcode/the-stack
train
4a6599f03d85ee4809561b06
train
class
class Config(): SECRET_KEY = os.environ.get('SECRET_KEY') # secret key for cookies and generating reset tokens SQLALCHEMY_DATABASE_URI = os.environ.get('SQLALCHEMY_DATABASE_URI') # relative path from where ever we are to site.db MAIL_SERVER = 'smtp.googlemail.com' MAIL_PORT = 465 MAIL_USE_SSL = Tr...
class Config():
SECRET_KEY = os.environ.get('SECRET_KEY') # secret key for cookies and generating reset tokens SQLALCHEMY_DATABASE_URI = os.environ.get('SQLALCHEMY_DATABASE_URI') # relative path from where ever we are to site.db MAIL_SERVER = 'smtp.googlemail.com' MAIL_PORT = 465 MAIL_USE_SSL = True MAIL_USER...
import os class Config():
6
64
103
3
2
ishmamt/Flask-Blog
flaskblog/config.py
Python
Config
Config
4
11
4
4
177ee34c3b45c792d9cfbcdbb84874725a4895c9
bigcode/the-stack
train
71dae25f93d6b25e7cfbf22a
train
function
def list_opts(): return { kafka_group: kafka_opts }
def list_opts():
return { kafka_group: kafka_opts }
format version ' 'for the brokers should be set to 0.9.0.0 to avoid ' 'performance issues until all consumers are upgraded.') ] def register_opts(conf): conf.register_group(kafka_group) conf.register_opts(kafka_opts, group=kafka_group) def list_opts():
64
64
16
4
60
openstack/monasca-notification
monasca_notification/conf/kafka.py
Python
list_opts
list_opts
80
83
80
80
fed399839ef5f9e76a158b185390c1d68f95490f
bigcode/the-stack
train
b43083b4fe55f7ba8aab07bc
train
function
def register_opts(conf): conf.register_group(kafka_group) conf.register_opts(kafka_opts, group=kafka_group)
def register_opts(conf):
conf.register_group(kafka_group) conf.register_opts(kafka_opts, group=kafka_group)
, help='Enable legacy Kafka client. When set old version of ' 'kafka-python library is used. Message format version ' 'for the brokers should be set to 0.9.0.0 to avoid ' 'performance issues until all consumers are upgraded.') ] def register...
64
64
26
5
59
openstack/monasca-notification
monasca_notification/conf/kafka.py
Python
register_opts
register_opts
75
77
75
75
498b39d40ff33a2a5624cf7f8d92640a7e3ee621
bigcode/the-stack
train
a2760a98a1914fe0ceeb4d89
train
class
class ShowBgpInstanceSessionGroupConfigurationSchema(MetaParser): """ Schema for show bgp instance session-group configuration""" schema = { 'instance': {Any(): {'peer_session': {Any(): {Optional('remote_as'): int, ...
class ShowBgpInstanceSessionGroupConfigurationSchema(MetaParser):
""" Schema for show bgp instance session-group configuration""" schema = { 'instance': {Any(): {'peer_session': {Any(): {Optional('remote_as'): int, Optional('remote_as_inherit'): str, ...
_name]['pp_name'][pp_name]\ ['as_override_inherit'] = m.groupdict()['inherit'] continue # # return empty if no attributes # if len(ret_dict['instance'][instance_name]['pp_name'][pp_name]) == 0: # ret_dict = {} return ret_dict ...
106
107
358
13
93
k01ek/genieparser
src/genie/libs/parser/iosxr/show_bgp.py
Python
ShowBgpInstanceSessionGroupConfigurationSchema
ShowBgpInstanceSessionGroupConfigurationSchema
702
744
702
702
2256b9a7ba325ab40749fe9aef08739085441a38
bigcode/the-stack
train
c3682d8ee15bd1a5d7d63af7
train
class
class ShowBgpInstanceNeighborsRoutesSchema(MetaParser): """Schema for: show bgp instance all all all neighbors <neighbor> routes show bgp instance all vrf all neighbors <neighbor> routes show bgp instance all vrf all ipv4 unicast neighbors <neighbor> routes show bgp instance all vrf...
class ShowBgpInstanceNeighborsRoutesSchema(MetaParser):
"""Schema for: show bgp instance all all all neighbors <neighbor> routes show bgp instance all vrf all neighbors <neighbor> routes show bgp instance all vrf all ipv4 unicast neighbors <neighbor> routes show bgp instance all vrf all ipv6 unicast neighbors <neighbor> routes """ ...
es sub_dict['processed_paths'] = processed_paths continue return ret_dict # ==================================================================== # Parser for: # 'show bgp instance all all all neighbors <WORD> routes' # 'show bgp instance all vrf all neighbors <WORD> routes' # ...
114
115
385
12
102
k01ek/genieparser
src/genie/libs/parser/iosxr/show_bgp.py
Python
ShowBgpInstanceNeighborsRoutesSchema
ShowBgpInstanceNeighborsRoutesSchema
4,309
4,364
4,309
4,310
5ef4780c30efd0b6c3eb929366d014839dda8011
bigcode/the-stack
train
53c74f5ed973b4057bfc6acc
train
class
class ShowBgpInstanceNeighborsRoutes(ShowBgpInstanceNeighborsRoutesSchema, ShowBgpInstanceNeighborsReceivedRoutes): """ Parser for: show bgp instance all all all neighbors <WORD> routes show bgp instance all vrf all neighbors <WORD> routes show bgp instance <instance> vrf <vrf> neighbor...
class ShowBgpInstanceNeighborsRoutes(ShowBgpInstanceNeighborsRoutesSchema, ShowBgpInstanceNeighborsReceivedRoutes):
""" Parser for: show bgp instance all all all neighbors <WORD> routes show bgp instance all vrf all neighbors <WORD> routes show bgp instance <instance> vrf <vrf> neighbors <WORD> routes show bgp instance <instance> all all neighbors <WORD> routes show bgp instance all vrf al...
str, Optional('weight'): str, Optional('path'): str, Optional('origin_codes'): str }, ...
71
71
237
25
46
k01ek/genieparser
src/genie/libs/parser/iosxr/show_bgp.py
Python
ShowBgpInstanceNeighborsRoutes
ShowBgpInstanceNeighborsRoutes
4,366
4,382
4,366
4,367
008acacc3aadf144d064c2f5d5c1f4356ed7e308
bigcode/the-stack
train
8e71b84414918eee846e8a97
train
class
class ShowBgpInstances(ShowBgpInstancesSchema): """Parser for show bgp instances""" cli_command = 'show bgp instances' def cli(self, output=None): if output is None: out = self.device.execute(self.cli_command) else: out = output p1 = re.compile(r'^(?P<inst...
class ShowBgpInstances(ShowBgpInstancesSchema):
"""Parser for show bgp instances""" cli_command = 'show bgp instances' def cli(self, output=None): if output is None: out = self.device.execute(self.cli_command) else: out = output p1 = re.compile(r'^(?P<instance_id>\d+) +(?P<placed_grp>[\w\_|\-]+) ' ...
().lower().replace(' ','_') == 'nhid'\ or group['key'].strip().lower().replace(' ','_') == 'ifh': update_value = group['value'].strip(',').split(',') update_value = [int(item.strip()) if item.strip().isdigit() \ else item.strip() for item i...
256
256
862
12
244
k01ek/genieparser
src/genie/libs/parser/iosxr/show_bgp.py
Python
ShowBgpInstances
ShowBgpInstances
203
291
203
204
d5be674fda00bcdc1572c4f1edf50d4c9419bdae
bigcode/the-stack
train
e4914d37b49d959162de2fa4
train
class
class ShowBgpInstanceAfGroupConfiguration(ShowBgpInstanceAfGroupConfigurationSchema): """Parser for show bgp instance af-group configuration""" cli_command = 'show run formal | i af-group' def cli(self, output=None): if output is None: out = self.device.execute(self.cli_command) ...
class ShowBgpInstanceAfGroupConfiguration(ShowBgpInstanceAfGroupConfigurationSchema):
"""Parser for show bgp instance af-group configuration""" cli_command = 'show run formal | i af-group' def cli(self, output=None): if output is None: out = self.device.execute(self.cli_command) else: out = output ret_dict = {} pp1 = re.compile(r'\s*...
_hop_self'): bool, Optional('next_hop_self_inherit'): str, Optional('route_map_name_in'): str, Optional('route_map_name_in_inherit'): str, Optional('route_map_name_out'): str, Optional('route_map...
256
256
2,491
18
238
k01ek/genieparser
src/genie/libs/parser/iosxr/show_bgp.py
Python
ShowBgpInstanceAfGroupConfiguration
ShowBgpInstanceAfGroupConfiguration
429
695
429
429
8141c6c6567228c79571a66404fec2b4770f3d1f
bigcode/the-stack
train
e2463b0387b1e3dd5df847ce
train
class
class ShowBgpInstanceAllAllSchema(MetaParser): """ Schema for: show bgp instance all all all show bgp instance all vrf all show bgp instance all vrf all ipv4 unicast show bgp instance all vrf all ipv6 unicast """ schema = { 'instance': {Any(): ...
class ShowBgpInstanceAllAllSchema(MetaParser):
""" Schema for: show bgp instance all all all show bgp instance all vrf all show bgp instance all vrf all ipv4 unicast show bgp instance all vrf all ipv6 unicast """ schema = { 'instance': {Any(): {Optional('vrf'): {Any...
]['neighbor'][neighbor]['address_family'][address_family]['state_pfxrcd'] = str(m.groupdict()['state_pfxrcd']) continue return bgp_instance_summary_dict # ============================================ # Parser for: # 'show bgp instance all all all' # 'show bgp instance all vrf ...
115
115
385
12
102
k01ek/genieparser
src/genie/libs/parser/iosxr/show_bgp.py
Python
ShowBgpInstanceAllAllSchema
ShowBgpInstanceAllAllSchema
4,841
4,898
4,841
4,842
83f3fff384130a1cefd4b17ddd628dc3eb515578
bigcode/the-stack
train
d77147b459cffcf57d23dc85
train
class
class ShowBgpSessions(ShowBgpSessionsSchema): """Parser for show bgp sessions""" # TODO schema cli_command = 'show bgp sessions' def cli(self, output=None): if output is None: out = self.device.execute(self.cli_command) else: out = output ...
class ShowBgpSessions(ShowBgpSessionsSchema):
"""Parser for show bgp sessions""" # TODO schema cli_command = 'show bgp sessions' def cli(self, output=None): if output is None: out = self.device.execute(self.cli_command) else: out = output ret_dict = {} instance = 'default' ...
prefixes, 50 paths m = p18.match(line) if m: group = m.groupdict() af_dict['processed_prefix'] = int(group['processed_prefix']) af_dict['processed_paths'] = int(group['processed_paths']) continue return parsed_dict ####...
201
201
671
12
188
k01ek/genieparser
src/genie/libs/parser/iosxr/show_bgp.py
Python
ShowBgpSessions
ShowBgpSessions
5,354
5,419
5,354
5,354
0d0023d22dc2be8492bb20337b5cc2dd8c9b9916
bigcode/the-stack
train
3fab1a387fc2c38aa9e7b741
train
class
class ShowBgpSessionsSchema(MetaParser): schema = { 'instance': { Any(): { 'vrf': { Any(): { 'neighbors': { Any(): { 'spk': int, 'as_number': in...
class ShowBgpSessionsSchema(MetaParser):
schema = { 'instance': { Any(): { 'vrf': { Any(): { 'neighbors': { Any(): { 'spk': int, 'as_number': int, 'in_q'...
group = m.groupdict() af_dict['processed_prefix'] = int(group['processed_prefix']) af_dict['processed_paths'] = int(group['processed_paths']) continue return parsed_dict ################################################################################ """Sche...
64
64
99
10
54
k01ek/genieparser
src/genie/libs/parser/iosxr/show_bgp.py
Python
ShowBgpSessionsSchema
ShowBgpSessionsSchema
5,328
5,348
5,328
5,328
688704cee1406b90b3a688c666a8115bbe304633
bigcode/the-stack
train
9335fb86612fe0f3f17feeb8
train
class
class ShowBgpInstanceNeighborsDetailSchema(MetaParser): """Schema for: show bgp instance all all all neighbors detail show bgp instance all vrf all neighbors detail show bgp instance all vrf all ipv4 unicast neighbors detail show bgp instance all vrf all ipv6 unicast neighbors detai...
class ShowBgpInstanceNeighborsDetailSchema(MetaParser):
"""Schema for: show bgp instance all all all neighbors detail show bgp instance all vrf all neighbors detail show bgp instance all vrf all ipv4 unicast neighbors detail show bgp instance all vrf all ipv6 unicast neighbors detail """ schema = { 'instance': ...
]['graceful_restart_stalepath_time'] # log_neighbor_changes if 'log_neighbor_changes' in yang_dict['vrf'][vrf]: sub_dict['log_neighbor_changes'] = \ yang_dict['vrf'][vrf]['log_neighbor_changes'] # address_family if 'address_family' in y...
255
256
1,545
12
243
k01ek/genieparser
src/genie/libs/parser/iosxr/show_bgp.py
Python
ShowBgpInstanceNeighborsDetailSchema
ShowBgpInstanceNeighborsDetailSchema
2,250
2,430
2,250
2,251
722ea68e6b04c57685da546a0ba78cd7710a8704
bigcode/the-stack
train
e8a1ffb10b47cfaf912a7a10
train
class
class ShowBgpInstancesSchema(MetaParser): """Schema for show bgp instances""" schema = { 'instance':{ Any(): { 'bgp_id': int, 'instance_id': int, 'placed_grp': str, 'num_vrfs': int, Optional('address_families')...
class ShowBgpInstancesSchema(MetaParser):
"""Schema for show bgp instances""" schema = { 'instance':{ Any(): { 'bgp_id': int, 'instance_id': int, 'placed_grp': str, 'num_vrfs': int, Optional('address_families'): list } }, Opt...
['value'] peer_dict.update({group['key'].strip().lower().\ replace(' ','_') : update_value}) continue return ret_dict # ======================================= # Parser for 'show bgp instances' # ==================================...
64
64
90
10
53
k01ek/genieparser
src/genie/libs/parser/iosxr/show_bgp.py
Python
ShowBgpInstancesSchema
ShowBgpInstancesSchema
186
201
186
187
410e98090c6a79b1236c585dd8a51c40bafb7b1f
bigcode/the-stack
train
851685e386cbfd3904f503f4
train
class
class ShowBgpVrfDbVrfAll(ShowBgpVrfDbVrfAllSchema): ''' Parser for: * 'show bgp vrf-db vrf all' ''' cli_command = 'show bgp vrf-db vrf all' def cli(self, output=None): if output is None: out = self.device.execute(self.cli_command) else: out = output ...
class ShowBgpVrfDbVrfAll(ShowBgpVrfDbVrfAllSchema):
''' Parser for: * 'show bgp vrf-db vrf all' ''' cli_command = 'show bgp vrf-db vrf all' def cli(self, output=None): if output is None: out = self.device.execute(self.cli_command) else: out = output # Init parsed_dict = {} vrf_di...
else self.device.execute( self.cli_command.format(instance=instance)) return super().cli(output=out) # =========================================== # Parser for # * 'show bgp instance all sessions' # =========================================== class ShowBgpInstanceAllSessions(ShowBgpSession...
256
256
990
22
234
k01ek/genieparser
src/genie/libs/parser/iosxr/show_bgp.py
Python
ShowBgpVrfDbVrfAll
ShowBgpVrfDbVrfAll
5,471
5,537
5,471
5,471
dc531aed4cc078596dcfd1ebc219fe46e1a378fe
bigcode/the-stack
train
9ec4932daed9da7e2b0bb95c
train
class
class ShowBgpInstanceSummarySchema(MetaParser): """ Schema for: show bgp instance all all all summary show bgp instance all vrf all summary show bgp instance all vrf all ipv4 unicast summary show bgp instance all vrf all ipv6 unicast summary """ schema = { 'instance...
class ShowBgpInstanceSummarySchema(MetaParser):
""" Schema for: show bgp instance all all all summary show bgp instance all vrf all summary show bgp instance all vrf all ipv4 unicast summary show bgp instance all vrf all ipv6 unicast summary """ schema = { 'instance': {Any(): {Optional(...
all', address_family='', route_type='routes', output=None): return super().cli(neighbor=neighbor, vrf_type=vrf_type, address_family=address_family, route_type='routes', vrf=vrf, instance=instance, output=output) # ==================================================== # Parser for: # 'show bgp insta...
133
134
448
11
122
k01ek/genieparser
src/genie/libs/parser/iosxr/show_bgp.py
Python
ShowBgpInstanceSummarySchema
ShowBgpInstanceSummarySchema
4,393
4,457
4,393
4,394
cacde1696d4d243972ef2b783bdcd1cce575f480
bigcode/the-stack
train
022a942c076a8465b7e0e138
train
class
class ShowBgpInstanceNeighborsDetail(ShowBgpInstanceNeighborsDetailSchema): """ Parser for: show bgp instance all all all neighbors detail show bgp instance all vrf all neighbors detail show bgp instance all vrf all ipv4 unicast neighbors detail show bgp instance all vrf all ipv6 un...
class ShowBgpInstanceNeighborsDetail(ShowBgpInstanceNeighborsDetailSchema):
""" Parser for: show bgp instance all all all neighbors detail show bgp instance all vrf all neighbors detail show bgp instance all vrf all ipv4 unicast neighbors detail show bgp instance all vrf all ipv6 unicast neighbors detail show bgp instance <instance> vrf <vrf> <addres...
as_in'): bool, Optional('allowas_in_as_number'): int, Optional('route_reflector_client'): bool, Optional('send_community'): str, Optional('soft_configuratio...
256
256
11,377
16
240
k01ek/genieparser
src/genie/libs/parser/iosxr/show_bgp.py
Python
ShowBgpInstanceNeighborsDetail
ShowBgpInstanceNeighborsDetail
2,432
3,456
2,432
2,433
377179d8fe04187b48549827e5bce35e20147b06
bigcode/the-stack
train
b877d5a59812c9cc4faa560d
train
class
class ShowBgpInstanceProcessDetailSchema(MetaParser): """Schema for: show bgp instance all all all process detail show bgp instance all vrf all process detail show bgp instance all vrf all ipv4 unicast process detail show bgp instance all vrf all ipv6 unicast process detail """ ...
class ShowBgpInstanceProcessDetailSchema(MetaParser):
"""Schema for: show bgp instance all all all process detail show bgp instance all vrf all process detail show bgp instance all vrf all ipv4 unicast process detail show bgp instance all vrf all ipv6 unicast process detail """ schema = { 'instance': {Any():...
[] m = p12.match(line) if m: ret_dict['instance'][instance_name]['peer_session'][ps_name]\ ['fall_over_bfd'] = True if m.groupdict()['inherit']: re...
256
256
1,097
12
243
k01ek/genieparser
src/genie/libs/parser/iosxr/show_bgp.py
Python
ShowBgpInstanceProcessDetailSchema
ShowBgpInstanceProcessDetailSchema
1,000
1,146
1,000
1,001
54fab56c41f53997400209edd67301c386d8513d
bigcode/the-stack
train
f10446fc22663b06efae1664
train
class
class ShowBgpNeighbors(ShowBgpInstanceNeighborsDetail): """Parser for show bgp neighbors show bgp neighbors {neighbor} show bgp vrf {vrf} neighbors show bgp vrf {vrf} neighbors {neighbor} show bgp {address_family} neighbors s...
class ShowBgpNeighbors(ShowBgpInstanceNeighborsDetail):
"""Parser for show bgp neighbors show bgp neighbors {neighbor} show bgp vrf {vrf} neighbors show bgp vrf {vrf} neighbors {neighbor} show bgp {address_family} neighbors show bgp {address_family} neighbors {neighbor} ...
show bgp l2vpn evpn neighbors <neighbor> """ cli_command = ['show bgp l2vpn evpn neighbors', 'show bgp l2vpn evpn neighbors {neighbor}'] def cli(self, neighbor='', output=None): if output is None: if neighbor: out = self.device.execute(self.cli_comman...
135
135
452
13
121
k01ek/genieparser
src/genie/libs/parser/iosxr/show_bgp.py
Python
ShowBgpNeighbors
ShowBgpNeighbors
6,549
6,595
6,549
6,550
adb44b6f3deadd387ac2ebf3f198bbc79f10d550
bigcode/the-stack
train
98e23cba0b2544639b46d166
train
class
class ShowBgpInstanceAfGroupConfigurationSchema(MetaParser): """Schema for show bgp instance af-group configuration""" schema = { 'instance': {Any(): {'pp_name': {Any(): {Optional('default_originate'): bool, ...
class ShowBgpInstanceAfGroupConfigurationSchema(MetaParser):
"""Schema for show bgp instance af-group configuration""" schema = { 'instance': {Any(): {'pp_name': {Any(): {Optional('default_originate'): bool, Optional('address_family'): str, O...
]['active'] = active ret_dict['program'][program]['instance'][instance]['standby'] = standby ret_dict['program'][program]['instance'][instance]['standby_state'] = standby_state ret_dict['program'][program]['instance'][instance]['active_state'] = active_state ...
109
110
368
14
95
k01ek/genieparser
src/genie/libs/parser/iosxr/show_bgp.py
Python
ShowBgpInstanceAfGroupConfigurationSchema
ShowBgpInstanceAfGroupConfigurationSchema
384
427
384
385
a3a3f6d7b241501ffcd1612b13a7ceb994f30fd4
bigcode/the-stack
train
9f77dc3e762431d7ebdf2343
train
class
class ShowBgpL2vpnEvpnNeighbors(ShowBgpInstanceNeighborsDetail): """Parser for show bgp l2vpn evpn neighbors show bgp l2vpn evpn neighbors <neighbor> """ cli_command = ['show bgp l2vpn evpn neighbors', 'show bgp l2vpn evpn neighbors {neighbor}'] def cli(self, neighbor='', output=Non...
class ShowBgpL2vpnEvpnNeighbors(ShowBgpInstanceNeighborsDetail):
"""Parser for show bgp l2vpn evpn neighbors show bgp l2vpn evpn neighbors <neighbor> """ cli_command = ['show bgp l2vpn evpn neighbors', 'show bgp l2vpn evpn neighbors {neighbor}'] def cli(self, neighbor='', output=None): if output is None: if neighbor: ...
p13.match(line) if m: value = m.groupdict()['extended_community'] attr_dict['extended_community'] = value.split() if value != None else [] continue return parsed_dict class ShowBgpL2vpnEvpnNeighbors(ShowBgpInstanceNeighborsDetail):
64
64
153
18
45
k01ek/genieparser
src/genie/libs/parser/iosxr/show_bgp.py
Python
ShowBgpL2vpnEvpnNeighbors
ShowBgpL2vpnEvpnNeighbors
6,527
6,546
6,527
6,528
3b6587bbc59bad5911f81f0bc6724347900e5f1b
bigcode/the-stack
train
86db386ce303a7046de6a356
train
class
class ShowBgpVrfDbVrfAllSchema(MetaParser): ''' Schema for: * 'show bgp vrf-db vrf all' ''' schema = { 'vrf': {Any(): {'id': str, 'rd': str, 'ref': int, 'afs': list, }, }, }
class ShowBgpVrfDbVrfAllSchema(MetaParser):
''' Schema for: * 'show bgp vrf-db vrf all' ''' schema = { 'vrf': {Any(): {'id': str, 'rd': str, 'ref': int, 'afs': list, }, }, }
, output=None): out = output if output else self.device.execute( self.cli_command) return super().cli(output=out) # ==================================== # Schema for 'show bgp vrf-db vrf all' # ==================================== class ShowBgpVrfDbVrfAllSchema(MetaParser):
64
64
79
15
49
k01ek/genieparser
src/genie/libs/parser/iosxr/show_bgp.py
Python
ShowBgpVrfDbVrfAllSchema
ShowBgpVrfDbVrfAllSchema
5,452
5,466
5,452
5,452
4c810250b9ee9063098caaf1cf9590519e210a28
bigcode/the-stack
train
0ce0b8a163917433ef3c57d5
train
class
class ShowBgpInstanceSessionGroupConfiguration(ShowBgpInstanceSessionGroupConfigurationSchema): """Parser for show bgp instance session-group configuration""" cli_command = 'show run formal | i session-group' def cli(self, output=None): if output is None: out = self.device.execute(sel...
class ShowBgpInstanceSessionGroupConfiguration(ShowBgpInstanceSessionGroupConfigurationSchema):
"""Parser for show bgp instance session-group configuration""" cli_command = 'show run formal | i session-group' def cli(self, output=None): if output is None: out = self.device.execute(self.cli_command) else: out = output ret_dict = {} cmd = '' ...
Optional('local_as_as_no'): int, Optional('local_no_prepend'): bool, Optional('local_dual_as'): bool, Optional('local_replace_as'): bool, Optional('local_as_inherit'): str, ...
256
256
2,399
18
238
k01ek/genieparser
src/genie/libs/parser/iosxr/show_bgp.py
Python
ShowBgpInstanceSessionGroupConfiguration
ShowBgpInstanceSessionGroupConfiguration
746
989
746
747
ee406b36de8adc4f4d0e8b9d6bc90681b092710d
bigcode/the-stack
train
a069d1c70f04fb05d6f0d954
train
class
class ShowPlacementProgramAllSchema(MetaParser): """Schema for show placement program all""" schema = { 'program': {Any(): {'instance': {Any(): {'group': str, 'jid': str, 'active': s...
class ShowPlacementProgramAllSchema(MetaParser):
"""Schema for show placement program all""" schema = { 'program': {Any(): {'instance': {Any(): {'group': str, 'jid': str, 'active': str, 'active_state': str, ...
: num = int(m3.groupdict()['number_of_bgp_instances']) ret_dict['number_of_bgp_instances'] = num continue return ret_dict # ======================================= # Parser for 'show placement program all' # ======================================= class ShowPla...
64
64
89
10
53
k01ek/genieparser
src/genie/libs/parser/iosxr/show_bgp.py
Python
ShowPlacementProgramAllSchema
ShowPlacementProgramAllSchema
297
316
297
298
c3bd25dcf03c6923d0095a1cb2e62cd298d1aa59
bigcode/the-stack
train
2601dacb030d67fb8f3350d9
train
class
class ShowBgpInstanceSessions(ShowBgpSessions): """Parser for show bgp instance {instance} sessions""" cli_command = 'show bgp instance {instance} sessions' def cli(self, instance, output=None): out = output if output else self.device.execute( self.cli_command.format(instance=instan...
class ShowBgpInstanceSessions(ShowBgpSessions):
"""Parser for show bgp instance {instance} sessions""" cli_command = 'show bgp instance {instance} sessions' def cli(self, instance, output=None): out = output if output else self.device.execute( self.cli_command.format(instance=instance)) return super().cli(output=out)
) if m: group = m.groupdict() instance = group['instance'] continue return ret_dict # =========================================== # Parser for # * 'show bgp instance {instance} sessions' # =========================================== class ShowBgpI...
64
64
78
12
51
k01ek/genieparser
src/genie/libs/parser/iosxr/show_bgp.py
Python
ShowBgpInstanceSessions
ShowBgpInstanceSessions
5,426
5,433
5,426
5,426
094542f141d41bb74903816fa4de8b4ed25d9293
bigcode/the-stack
train
e6ad6cc61e51e2c5ddcd3e52
train
class
class ShowBgpInstanceNeighborsReceivedRoutes(ShowBgpInstanceNeighborsReceivedRoutesSchema): """Parser for: show bgp instance all all all neighbors <neighbor> received routes show bgp instance all vrf all neighbors <neighbor> received routes show bgp instance all vrf all ipv4 unicast neighbo...
class ShowBgpInstanceNeighborsReceivedRoutes(ShowBgpInstanceNeighborsReceivedRoutesSchema):
"""Parser for: show bgp instance all all all neighbors <neighbor> received routes show bgp instance all vrf all neighbors <neighbor> received routes show bgp instance all vrf all ipv4 unicast neighbors <neighbor> received routes show bgp instance all vrf all ipv6 unicast neighbors <n...
vrf_id'): str, Optional('generic_scan_interval'): int, Optional('non_stop_routing'): bool, Optional('table_state'): str, Optional('table_id'): str, ...
256
256
4,742
18
238
k01ek/genieparser
src/genie/libs/parser/iosxr/show_bgp.py
Python
ShowBgpInstanceNeighborsReceivedRoutes
ShowBgpInstanceNeighborsReceivedRoutes
3,525
4,048
3,525
3,526
874cf80787a6f0debb34c7234e4181310ddbde69
bigcode/the-stack
train
2856ede37b67578d104b6f8d
train
class
class ShowBgpInstanceSummary(ShowBgpInstanceSummarySchema): """ Parser for: show bgp instance all all all summary show bgp instance all vrf all summary show bgp instance all vrf all ipv4 unicast summary show bgp instance all vrf all ipv6 unicast summary show bgp instance <in...
class ShowBgpInstanceSummary(ShowBgpInstanceSummarySchema):
""" Parser for: show bgp instance all all all summary show bgp instance all vrf all summary show bgp instance all vrf all ipv4 unicast summary show bgp instance all vrf all ipv6 unicast summary show bgp instance <instance> all all summary show bgp instance <instance> ...
, Optional('nsr_initial_init_ver_status'): str, Optional('nsr_issu_sync_group_versions'): str, Optional('scan_interval'): int, Optional('operation_mode'): str, ...
256
256
5,571
14
242
k01ek/genieparser
src/genie/libs/parser/iosxr/show_bgp.py
Python
ShowBgpInstanceSummary
ShowBgpInstanceSummary
4,459
4,830
4,459
4,460
670f30432d7498909bdd18563af7951f30d80a3f
bigcode/the-stack
train
0f60a522ab689fd9130a27f4
train
class
class ShowBgpInstanceNeighborsAdvertisedRoutesSchema(MetaParser): """ Schema for: show bgp instance all all all neighbors <neighbor> advertised-routes show bgp instance all vrf all neighbors <neighbor> advertised-routes show bgp instance all vrf all ipv4 unicast neighbors <neighbor> adverti...
class ShowBgpInstanceNeighborsAdvertisedRoutesSchema(MetaParser):
""" Schema for: show bgp instance all all all neighbors <neighbor> advertised-routes show bgp instance all vrf all neighbors <neighbor> advertised-routes show bgp instance all vrf all ipv4 unicast neighbors <neighbor> advertised-routes show bgp instance all vrf all ipv6 unicast neigh...
all all all neighbors <WORD> advertised-routes' # 'show bgp instance all vrf all neighbors <WORD> advertised-routes' # 'show bgp instance all vrf all ipv4 unicast neighbors <WORD> advertised-routes' # 'show bgp instance all vrf all ipv6 unicast neighbors <WORD> advertised-routes' # ====================================...
90
91
305
14
76
k01ek/genieparser
src/genie/libs/parser/iosxr/show_bgp.py
Python
ShowBgpInstanceNeighborsAdvertisedRoutesSchema
ShowBgpInstanceNeighborsAdvertisedRoutesSchema
4,059
4,103
4,059
4,060
02a0dedf9ea6c15c8d96f416315679f9dc712456
bigcode/the-stack
train
ebd8aa09e6af173e2e0ced41
train
class
class ShowBgpInstanceAllSessions(ShowBgpSessions): """Parser for show bgp instance all sessions""" cli_command = 'show bgp instance all sessions' def cli(self, output=None): out = output if output else self.device.execute( self.cli_command) return super().cli(output=out)
class ShowBgpInstanceAllSessions(ShowBgpSessions):
"""Parser for show bgp instance all sessions""" cli_command = 'show bgp instance all sessions' def cli(self, output=None): out = output if output else self.device.execute( self.cli_command) return super().cli(output=out)
out = output if output else self.device.execute( self.cli_command.format(instance=instance)) return super().cli(output=out) # =========================================== # Parser for # * 'show bgp instance all sessions' # =========================================== class ShowBgpInstanceAllS...
64
64
69
13
50
k01ek/genieparser
src/genie/libs/parser/iosxr/show_bgp.py
Python
ShowBgpInstanceAllSessions
ShowBgpInstanceAllSessions
5,440
5,447
5,440
5,440
34318d7c201d91d32be92880ca1af76511c0b30a
bigcode/the-stack
train
dc864809970d5a5adb3f2b53
train
class
class ShowBgpL2vpnEvpn(ShowBgpL2vpnEvpnSchema): """Parser for show bgp l2vpn evpn""" cli_command = 'show bgp l2vpn evpn' exclude = [ 'bgp_table_version', 'status_codes', 'local_router_id', 'path_type', 'weight'] def cli(self, output=None): if output is None: ...
class ShowBgpL2vpnEvpn(ShowBgpL2vpnEvpnSchema):
"""Parser for show bgp l2vpn evpn""" cli_command = 'show bgp l2vpn evpn' exclude = [ 'bgp_table_version', 'status_codes', 'local_router_id', 'path_type', 'weight'] def cli(self, output=None): if output is None: out = self.device.execute(self.cli_comman...
_interval'): int, Optional('default_vrf'): str, Optional('aggregate_address_ipv4_address'): str, Optional('aggregate_address_ipv4_mask'): str, Optional('aggregate_address_as_set'): bool, Optional...
256
256
8,639
20
235
k01ek/genieparser
src/genie/libs/parser/iosxr/show_bgp.py
Python
ShowBgpL2vpnEvpn
ShowBgpL2vpnEvpn
5,608
6,299
5,608
5,608
937b3bbefeb5200d6213450ad1eb7366024bfacc
bigcode/the-stack
train
3482c0e46d4a27dd9740a9e7
train
class
class ShowBgpInstanceProcessDetail(ShowBgpInstanceProcessDetailSchema): """Parser for: show bgp instance all all all process detail show bgp instance all vrf all process detail show bgp instance all vrf all ipv4 unicast process detail show bgp instance all vrf all ipv6 unicast proces...
class ShowBgpInstanceProcessDetail(ShowBgpInstanceProcessDetailSchema):
"""Parser for: show bgp instance all all all process detail show bgp instance all vrf all process detail show bgp instance all vrf all ipv4 unicast process detail show bgp instance all vrf all ipv6 unicast process detail parser class - implements detail parsing mechanisms for...
('attribute_download'): str, Optional('label_retention_timer_value'): str, Optional('soft_reconfig_entries'): str, Optional('table_bit_field_size'): str, Optional('chunk_elememt_size'): st...
256
256
10,780
16
240
k01ek/genieparser
src/genie/libs/parser/iosxr/show_bgp.py
Python
ShowBgpInstanceProcessDetail
ShowBgpInstanceProcessDetail
1,149
2,239
1,149
1,149
6331e96d1e59f2bab7ab3b123e88e32c43b2c478
bigcode/the-stack
train
6e801a96fc3d60d7abd16584
train
class
class ShowBgpEgressEngineering(ShowBgpEgressEngineeringSchema): ''' Parser for show bgp egress-engineering''' cli_command = ['show bgp egress-engineering'] def cli (self, output=None): if output is None: out=self.device.execute(self.cli_command[0]) else: out =...
class ShowBgpEgressEngineering(ShowBgpEgressEngineeringSchema):
''' Parser for show bgp egress-engineering''' cli_command = ['show bgp egress-engineering'] def cli (self, output=None): if output is None: out=self.device.execute(self.cli_command[0]) else: out = output ret_dict = {} # Egress Engineering Pee...
,\ Default, Use # Parser from genie.libs.parser.yang.bgp_openconfig_yang import BgpOpenconfigYang # Logger logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) # ======================================== # Parser for 'show bgp egress-engineering' # ==============...
250
250
834
16
234
k01ek/genieparser
src/genie/libs/parser/iosxr/show_bgp.py
Python
ShowBgpEgressEngineering
ShowBgpEgressEngineering
97
179
97
98
051c0cacb7bda551ed8fe4c76e7502e9d1884ef2
bigcode/the-stack
train
9232cb4ed10063cd426b0309
train
class
class ShowBgpEgressEngineeringSchema(MetaParser): ''' Schema for show bgp egress-engineering ''' schema = { 'peer_set':{ Any():{ 'peer_set_id': str, 'nexthop': str, 'version': int, 'rn_version': int, 'flags'...
class ShowBgpEgressEngineeringSchema(MetaParser):
''' Schema for show bgp egress-engineering ''' schema = { 'peer_set':{ Any():{ 'peer_set_id': str, 'nexthop': str, 'version': int, 'rn_version': int, 'flags': str, 'local_asn': int, ...
.parser.yang.bgp_openconfig_yang import BgpOpenconfigYang # Logger logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) # ======================================== # Parser for 'show bgp egress-engineering' # ======================================== class ShowBgpEgressEngineeringSchema(MetaParser):
63
64
171
13
50
k01ek/genieparser
src/genie/libs/parser/iosxr/show_bgp.py
Python
ShowBgpEgressEngineeringSchema
ShowBgpEgressEngineeringSchema
70
95
70
71
f7de962aeae799bed25736b838af793e194d1c2f
bigcode/the-stack
train
9f7121fd9d09c06d31faf752
train
class
class ShowBgpInstanceNeighborsAdvertisedRoutes(ShowBgpInstanceNeighborsAdvertisedRoutesSchema): """ Parser for: show bgp instance all all all neighbors <neighbor> advertised-routes show bgp instance all vrf all neighbors <neighbor> advertised-routes show bgp instance all vrf all ipv4 unicas...
class ShowBgpInstanceNeighborsAdvertisedRoutes(ShowBgpInstanceNeighborsAdvertisedRoutesSchema):
""" Parser for: show bgp instance all all all neighbors <neighbor> advertised-routes show bgp instance all vrf all neighbors <neighbor> advertised-routes show bgp instance all vrf all ipv4 unicast neighbors <neighbor> advertised-routes show bgp instance all vrf all ipv6 unicast neigh...
advertised-routes show bgp instance all vrf all ipv6 unicast neighbors <neighbor> advertised-routes show bgp instance <instance> vrf <vrf> <address_family> neighbors <neighbor> advertised-routes """ schema = {'instance': {Any(): {Optional('vrf'): ...
256
256
2,151
20
236
k01ek/genieparser
src/genie/libs/parser/iosxr/show_bgp.py
Python
ShowBgpInstanceNeighborsAdvertisedRoutes
ShowBgpInstanceNeighborsAdvertisedRoutes
4,105
4,298
4,105
4,106
1dbaf5c872ebce35bb02c0c646867756d0653f5c
bigcode/the-stack
train
559f0dc3c80c3d4b5ca59b11
train
class
class ShowBgpL2vpnEvpnAdvertised(ShowBgpL2vpnEvpnAdvertisedSchema): '''Parser for: * 'show bgp l2vpn evpn advertised' ''' cli_command = 'show bgp l2vpn evpn advertised' def cli(self, output=None): if output is None: out = self.device.execute(self.cli_command) else: ...
class ShowBgpL2vpnEvpnAdvertised(ShowBgpL2vpnEvpnAdvertisedSchema):
'''Parser for: * 'show bgp l2vpn evpn advertised' ''' cli_command = 'show bgp l2vpn evpn advertised' def cli(self, output=None): if output is None: out = self.device.execute(self.cli_command) else: out = output # Init parsed_dict = {} ...
''' schema = { 'neighbor': {Any(): {'address_family': {Any(): {'advertised': {Any(): {'index': {Any(): ...
256
256
1,613
24
231
k01ek/genieparser
src/genie/libs/parser/iosxr/show_bgp.py
Python
ShowBgpL2vpnEvpnAdvertised
ShowBgpL2vpnEvpnAdvertised
6,354
6,524
6,354
6,354
da61e3114a4f1f9870a9517ea3b94f87cef6749b
bigcode/the-stack
train
a6ad21d397eb98bbdc25ddfa
train
class
class ShowBgpL2vpnEvpnSchema(MetaParser): """Schema for: show bgp l2vpn evnpn """ schema = { 'vrf': {Any(): {'address_family': {Any(): { Optional('router_identifier'): str, ...
class ShowBgpL2vpnEvpnSchema(MetaParser):
"""Schema for: show bgp l2vpn evnpn """ schema = { 'vrf': {Any(): {'address_family': {Any(): { Optional('router_identifier'): str, Optional('local_as'): int, ...
afs'] = group['afs'].strip().replace(",", "").split() continue # Vv6u, L2evpn m = p2.match(line) if m: if vrf_dict: afs = m.groupdict()['item'].strip().replace(",", "...
121
121
405
14
106
k01ek/genieparser
src/genie/libs/parser/iosxr/show_bgp.py
Python
ShowBgpL2vpnEvpnSchema
ShowBgpL2vpnEvpnSchema
5,545
5,601
5,545
5,546
71552335cbca20b0d47420c09bd6003590c4b56c
bigcode/the-stack
train
13ade1c6f894ab01b0a7925e
train
class
class ShowPlacementProgramAll(ShowPlacementProgramAllSchema): """Parser for show placement program all""" cli_command = 'show placement program all' def cli(self, output=None): if output is None: out = self.device.execute(self.cli_command) else: out = output ...
class ShowPlacementProgramAll(ShowPlacementProgramAllSchema):
"""Parser for show placement program all""" cli_command = 'show placement program all' def cli(self, output=None): if output is None: out = self.device.execute(self.cli_command) else: out = output ret_dict = {} p1 = re.compile(r'^\s*(?P<program>[a-z...
ies'] = address_family_lst # Number of BGP instances: 1 m3 = p3.match(line) if m3: num = int(m3.groupdict()['number_of_bgp_instances']) ret_dict['number_of_bgp_instances'] = num continue return ret_dict # ===================...
186
186
621
12
174
k01ek/genieparser
src/genie/libs/parser/iosxr/show_bgp.py
Python
ShowPlacementProgramAll
ShowPlacementProgramAll
318
377
318
319
11d2f764f7f4b6439138ce47999863cc6c76dfaa
bigcode/the-stack
train
a9d78e6eec7ef7e17d832e8e
train
class
class ShowBgpSummary(ShowBgpInstanceSummary): ''' Parser for: * 'show bgp summary' * 'show bgp {address_family} summary' ''' cli_command = ['show bgp {address_family} summary', 'show bgp summary'] def cli(self, address_family='', output=None): if address_fa...
class ShowBgpSummary(ShowBgpInstanceSummary):
''' Parser for: * 'show bgp summary' * 'show bgp {address_family} summary' ''' cli_command = ['show bgp {address_family} summary', 'show bgp summary'] def cli(self, address_family='', output=None): if address_family: cmd = self.cli_command[0].for...
elif vrf: cmd = self.cli_command[2].format(vrf=vrf) else: cmd = self.cli_command[0] out = output or self.device.execute(cmd) return super().cli(output=out) class ShowBgpSummary(ShowBgpInstanceSummary):
64
64
150
12
52
k01ek/genieparser
src/genie/libs/parser/iosxr/show_bgp.py
Python
ShowBgpSummary
ShowBgpSummary
6,598
6,620
6,598
6,599
2315e9d6e42cb3d70d13661c84ec9b92b77e172c
bigcode/the-stack
train
eb4019d0ca0377b1fb2be465
train
class
class ShowBgpL2vpnEvpnAdvertisedSchema(MetaParser): '''Schema for: * 'show bgp l2vpn evpn advertised' ''' schema = { 'neighbor': {Any(): {'address_family': {Any(): {'advertised': {Any(): ...
class ShowBgpL2vpnEvpnAdvertisedSchema(MetaParser):
'''Schema for: * 'show bgp l2vpn evpn advertised' ''' schema = { 'neighbor': {Any(): {'address_family': {Any(): {'advertised': {Any(): {'index': ...
dict()['processed_paths']) af_dict['processed_prefix'] = processed_prefix af_dict['processed_paths'] = processed_paths continue return parsed_dict # =========================================== # Schema for 'show bgp l2vpn evpn advertised' # ======================...
73
73
245
16
56
k01ek/genieparser
src/genie/libs/parser/iosxr/show_bgp.py
Python
ShowBgpL2vpnEvpnAdvertisedSchema
ShowBgpL2vpnEvpnAdvertisedSchema
6,304
6,348
6,304
6,304
069eb24cca2d0fe604fba82bf01c39386e5294db
bigcode/the-stack
train
7b3cc2e52aafeaaaa1ddfbe1
train
class
class ShowBgpInstanceAllAll(ShowBgpInstanceAllAllSchema): '''Parser for: show bgp instance all all all show bgp instance all vrf all show bgp instance all vrf all ipv4 unicast show bgp instance all vrf all ipv6 unicast show bgp instance {instance} all all show bgp in...
class ShowBgpInstanceAllAll(ShowBgpInstanceAllAllSchema):
'''Parser for: show bgp instance all all all show bgp instance all vrf all show bgp instance all vrf all ipv4 unicast show bgp instance all vrf all ipv6 unicast show bgp instance {instance} all all show bgp instance {instance} vrf {vrf} {address_family} ''' c...
Optional('processed_prefix'): int, Optional('processed_paths'): int, Optional('scan_interval'): int, Optional('default_vrf'): str, Optional('route_distinguisher'): str, ...
256
256
4,895
16
239
k01ek/genieparser
src/genie/libs/parser/iosxr/show_bgp.py
Python
ShowBgpInstanceAllAll
ShowBgpInstanceAllAll
4,909
5,322
4,909
4,910
42d4f0178b21baeb98bcb71ac4855ab504c60fae
bigcode/the-stack
train
5a7ec38bdd49826c13d281d0
train
class
class ShowBgpInstanceNeighborsReceivedRoutesSchema(MetaParser): """Schema for: show bgp instance all all all neighbors <neighbor> received routes show bgp instance all vrf all neighbors <neighbor> received routes show bgp instance all vrf all ipv4 unicast neighbors <neighbor> received r...
class ShowBgpInstanceNeighborsReceivedRoutesSchema(MetaParser):
"""Schema for: show bgp instance all all all neighbors <neighbor> received routes show bgp instance all vrf all neighbors <neighbor> received routes show bgp instance all vrf all ipv4 unicast neighbors <neighbor> received routes show bgp instance all vrf all ipv6 unicast neighbors <n...
] = \ yang_dict['vrf'][vrf]['neighbor'][neighbor] # Return to caller return map_dict # ============================================================================= # Parser for: # 'show bgp instance all all all neighbors <neighbor> received routes' # 'show bgp instance all vrf al...
127
127
425
14
112
k01ek/genieparser
src/genie/libs/parser/iosxr/show_bgp.py
Python
ShowBgpInstanceNeighborsReceivedRoutesSchema
ShowBgpInstanceNeighborsReceivedRoutesSchema
3,467
3,523
3,467
3,468
554955b77bf74ef74b3ba8eaf74c68e9a81b27bd
bigcode/the-stack
train
f67f8d3c4a7075a42deca049
train
class
class MainTestCase(TestCase): def test_get_parser(self): m.get_parser()
class MainTestCase(TestCase):
def test_get_parser(self): m.get_parser()
# -*- coding: utf-8 -*- from mock import patch, PropertyMock from tests import TestCase import yarn_api_client.main as m class MainTestCase(TestCase):
37
64
19
7
29
71nn/hadoop-yarn-api-python-client
tests/test_main.py
Python
MainTestCase
MainTestCase
8
10
8
8
7fb27273bbc987137afdffc49a784f6afcd87862
bigcode/the-stack
train
276897aa657954d7f4a6c759
train
function
def process_telemetry_system(telemetry_system): """Process data in telemetry_system object.""" pass
def process_telemetry_system(telemetry_system):
"""Process data in telemetry_system object.""" pass
.gnmi.providers import gNMIServiceProvider from ydk.models.openconfig import openconfig_telemetry \ as oc_telemetry import os import logging YDK_REPO_DIR = os.path.expanduser("~/.ydk/") def process_telemetry_system(telemetry_system):
63
64
23
11
53
deom119/ydk-py-samples
samples/basic/crud/gnmi/models/openconfig/openconfig-telemetry/gn-read-oc-telemetry-10-ydk.py
Python
process_telemetry_system
process_telemetry_system
45
47
45
45
1122c0881be316e01697291c7f13da2c4179ffc1
bigcode/the-stack
train
2614834d29f943c92870f31a
train
function
def get_degree_to_names(tuples): ''' Returns dictionary of degrees to node names from given list of (name, deg) tuples ''' d = defaultdict(list) for name, deg in tuples: d[deg].append(name) return d
def get_degree_to_names(tuples):
''' Returns dictionary of degrees to node names from given list of (name, deg) tuples ''' d = defaultdict(list) for name, deg in tuples: d[deg].append(name) return d
_argument('-nt', '--n_tries', type=int, required=False, default=50) return parser.parse_args() def shuffle(arr): ''' Copy and shuffle given list''' arr_copy = arr[:] np.random.shuffle(arr_copy) return arr_copy def get_degree_to_names(tuples):
64
64
60
8
55
lrgr/HANDL
experiments/homology-scores-permutation-test/gen_random_network.py
Python
get_degree_to_names
get_degree_to_names
28
36
28
28
0a92f84f1037e95e8ac117d491793c57db28b735
bigcode/the-stack
train
92580b11ca3975764aa79933
train
function
def shuffle(arr): ''' Copy and shuffle given list''' arr_copy = arr[:] np.random.shuffle(arr_copy) return arr_copy
def shuffle(arr):
''' Copy and shuffle given list''' arr_copy = arr[:] np.random.shuffle(arr_copy) return arr_copy
.add_argument('-e', '--edgelist', type=str, required=True) parser.add_argument('-o', '--output', type=str, required=True) parser.add_argument('-nt', '--n_tries', type=int, required=False, default=50) return parser.parse_args() def shuffle(arr):
64
64
31
4
60
lrgr/HANDL
experiments/homology-scores-permutation-test/gen_random_network.py
Python
shuffle
shuffle
22
26
22
22
e0827bb00ab71cf608577807a564a9fe11eba301
bigcode/the-stack
train
ddcdf5c4f10b9ea8b22f8525
train
function
def parse_args(): parser = argparse.ArgumentParser() parser.add_argument('-e', '--edgelist', type=str, required=True) parser.add_argument('-o', '--output', type=str, required=True) parser.add_argument('-nt', '--n_tries', type=int, required=False, default=50) return parser.parse_args()
def parse_args():
parser = argparse.ArgumentParser() parser.add_argument('-e', '--edgelist', type=str, required=True) parser.add_argument('-o', '--output', type=str, required=True) parser.add_argument('-nt', '--n_tries', type=int, required=False, default=50) return parser.parse_args()
time import time import networkx as nx import numpy as np from sklearn.externals import joblib from sklearn.externals.joblib import Parallel, delayed from munk import util from munk import regularized_laplacian, rkhs_factor from munk.io import get_logger def parse_args():
64
64
73
4
59
lrgr/HANDL
experiments/homology-scores-permutation-test/gen_random_network.py
Python
parse_args
parse_args
15
20
15
15
08c8b42e9b7a259dc59d62d0e895d266626fac2d
bigcode/the-stack
train
1b1ec6bf5454eb389e4cca29
train
function
def main(args): log = get_logger() log.info('Loading edgelist from: %s', args.edgelist) seed_network = \ util.simple_two_core(nx.read_edgelist(args.edgelist, encoding='ascii'), verbose=False) log.info('Generating network...') t_start = time() data, tries = g...
def main(args):
log = get_logger() log.info('Loading edgelist from: %s', args.edgelist) seed_network = \ util.simple_two_core(nx.read_edgelist(args.edgelist, encoding='ascii'), verbose=False) log.info('Generating network...') t_start = time() data, tries = gen_random_networ...
, n_tries) nodes = sorted(random_graph.nodes()) D = regularized_laplacian(random_graph, nodes, lam=0.05) C = rkhs_factor(D) return dict(G=random_graph, D=D, C=C, nodes=nodes), tries def main(args):
64
64
146
4
59
lrgr/HANDL
experiments/homology-scores-permutation-test/gen_random_network.py
Python
main
main
86
101
86
86
56bedbeef162bd79fa84965cf49f804dd1e9b10a
bigcode/the-stack
train
8d40142169ca97588f639c67
train
function
def perturbed_graph(seed_graph): ''' Returns random graph with approximately the same degree distribution as given seed graph ''' # Generate new graph with given degree sequence deg_sequence = shuffle(list(seed_graph.degree)) new_G = nx.configuration_model(list(zip(*deg_sequence))[1]) #...
def perturbed_graph(seed_graph):
''' Returns random graph with approximately the same degree distribution as given seed graph ''' # Generate new graph with given degree sequence deg_sequence = shuffle(list(seed_graph.degree)) new_G = nx.configuration_model(list(zip(*deg_sequence))[1]) # Rename graph with nodes in seed_...
_names(unlabeled_G.degree) mapping_tuples = [] for deg, new_names in new_name_dict.items(): old_names = old_degree_dict[deg] mapping_tuples += (list(zip(old_names, shuffle(new_names)))) return dict(mapping_tuples) def perturbed_graph(seed_graph):
64
64
145
7
57
lrgr/HANDL
experiments/homology-scores-permutation-test/gen_random_network.py
Python
perturbed_graph
perturbed_graph
50
65
50
50
85f40a17b127a6658cd05b4e965facac9b9f676f
bigcode/the-stack
train
94fd91ab23e572e9560cc01b
train
function
def safe_perturbed_graph(seed_graph, n_tries=10): if n_tries > 0: for i in range(n_tries): new_G = perturbed_graph(seed_graph) if len(not_shared_nodes(new_G, seed_graph)) == 0: return new_G, i + 1 raise Exception()
def safe_perturbed_graph(seed_graph, n_tries=10):
if n_tries > 0: for i in range(n_tries): new_G = perturbed_graph(seed_graph) if len(not_shared_nodes(new_G, seed_graph)) == 0: return new_G, i + 1 raise Exception()
_relabelling(deg2names, new_G) new_G = nx.relabel_nodes(new_G, mapping) # Remove self loops and parallel edges and return return util.simple_two_core(nx.Graph(new_G), verbose=False) def safe_perturbed_graph(seed_graph, n_tries=10):
64
64
73
15
49
lrgr/HANDL
experiments/homology-scores-permutation-test/gen_random_network.py
Python
safe_perturbed_graph
safe_perturbed_graph
67
73
67
67
439a145db296aed0c2d59a7423bd0808cc3a89cc
bigcode/the-stack
train
920c1d9a10eb9d0c96627380
train
function
def not_shared_nodes(G1, G2): return set(G1.nodes) ^ set(G2.nodes)
def not_shared_nodes(G1, G2):
return set(G1.nodes) ^ set(G2.nodes)
tries > 0: for i in range(n_tries): new_G = perturbed_graph(seed_graph) if len(not_shared_nodes(new_G, seed_graph)) == 0: return new_G, i + 1 raise Exception() def not_shared_nodes(G1, G2):
64
64
23
10
54
lrgr/HANDL
experiments/homology-scores-permutation-test/gen_random_network.py
Python
not_shared_nodes
not_shared_nodes
75
76
75
75
6b210368c237a8dc8568ca9a1ccc5209003c6f75
bigcode/the-stack
train
bf824159ba0755fbcbeb6fb6
train
function
def gen_random_network_data(seed_graph, n_tries=10): log = get_logger() random_graph, tries = safe_perturbed_graph(seed_graph, n_tries) nodes = sorted(random_graph.nodes()) D = regularized_laplacian(random_graph, nodes, lam=0.05) C = rkhs_factor(D) return dict(G=random_graph, D=D, C=C, nodes=nod...
def gen_random_network_data(seed_graph, n_tries=10):
log = get_logger() random_graph, tries = safe_perturbed_graph(seed_graph, n_tries) nodes = sorted(random_graph.nodes()) D = regularized_laplacian(random_graph, nodes, lam=0.05) C = rkhs_factor(D) return dict(G=random_graph, D=D, C=C, nodes=nodes), tries
(not_shared_nodes(new_G, seed_graph)) == 0: return new_G, i + 1 raise Exception() def not_shared_nodes(G1, G2): return set(G1.nodes) ^ set(G2.nodes) def gen_random_network_data(seed_graph, n_tries=10):
64
64
93
14
50
lrgr/HANDL
experiments/homology-scores-permutation-test/gen_random_network.py
Python
gen_random_network_data
gen_random_network_data
78
84
78
78
f667a8532e6fe79b80f75943c9b799615ec315c1
bigcode/the-stack
train
9ae52cf01c80ffb17e8fb002
train
function
def get_degree_preserving_relabelling(new_name_dict, unlabeled_G): ''' Returns name mapping given between degree to node names dictionary and unlabeled graph G ''' old_degree_dict = get_degree_to_names(unlabeled_G.degree) mapping_tuples = [] for deg, new_names in new_name_dict.items(): ...
def get_degree_preserving_relabelling(new_name_dict, unlabeled_G):
''' Returns name mapping given between degree to node names dictionary and unlabeled graph G ''' old_degree_dict = get_degree_to_names(unlabeled_G.degree) mapping_tuples = [] for deg, new_names in new_name_dict.items(): old_names = old_degree_dict[deg] mapping_tuples += (list...
dictionary of degrees to node names from given list of (name, deg) tuples ''' d = defaultdict(list) for name, deg in tuples: d[deg].append(name) return d def get_degree_preserving_relabelling(new_name_dict, unlabeled_G):
64
64
104
16
47
lrgr/HANDL
experiments/homology-scores-permutation-test/gen_random_network.py
Python
get_degree_preserving_relabelling
get_degree_preserving_relabelling
38
48
38
38
3f0da4ef6eaf4989af0d8889a72806a8f18550a0
bigcode/the-stack
train
a6ad4affc0833711f27652ea
train
class
class TestBitcoinCli(BitcoinTestFramework): def set_test_params(self): self.setup_clean_chain = True self.num_nodes = 1 def run_test(self): """Main test logic""" cli_response = self.nodes[0].cli("-version").send_cli() self.log.info("Received response:" + cli_response) ...
class TestBitcoinCli(BitcoinTestFramework):
def set_test_params(self): self.setup_clean_chain = True self.num_nodes = 1 def run_test(self): """Main test logic""" cli_response = self.nodes[0].cli("-version").send_cli() self.log.info("Received response:" + cli_response) assert("Tapyrus Core RPC client versi...
#!/usr/bin/env python3 # Copyright (c) 2017-2018 The Bitcoin Core developers # Copyright (c) 2019 Chaintope Inc. # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test bitcoin-cli""" from test_framework.test_framework import Bitco...
108
256
904
9
98
winnie-chaintope/tapyrus-core
test/functional/interface_bitcoin_cli.py
Python
TestBitcoinCli
TestBitcoinCli
12
76
12
13
b30df56b438ee725633806c96438a200df4906ac
bigcode/the-stack
train
b747e03579aa804faf4a1a39
train
function
def main(host): client = capnp.TwoPartyClient(host) # Pass "calculator" to ez_restore (there's also a `restore` function that # takes a struct or AnyPointer as an argument), and then cast the returned # capability to it's proper type. This casting is due to capabilities not # having a reference to ...
def main(host):
client = capnp.TwoPartyClient(host) # Pass "calculator" to ez_restore (there's also a `restore` function that # takes a struct or AnyPointer as an argument), and then cast the returned # capability to it's proper type. This casting is due to capabilities not # having a reference to their schema ...
#!/usr/bin/env python from __future__ import print_function import argparse import socket import capnp import calculator_capnp class PowerFunction(calculator_capnp.Calculator.Function.Server): '''An implementation of the Function interface wrapping pow(). Note that we're implementing this on the client si...
235
256
2,404
4
231
HolgerPeters/pycapnp
examples/calculator_client.py
Python
main
main
35
303
35
35
811493e3cc72c4a980e4b1f0002cb310b72c87eb
bigcode/the-stack
train
e8b453edf24519056bbf87c1
train
function
def parse_args(): parser = argparse.ArgumentParser(usage='Connects to the Calculator server \ at the given address and does some RPCs') parser.add_argument("host", help="HOST:PORT") return parser.parse_args()
def parse_args():
parser = argparse.ArgumentParser(usage='Connects to the Calculator server \ at the given address and does some RPCs') parser.add_argument("host", help="HOST:PORT") return parser.parse_args()
over time. Also, by default, a _context variable is passed to all server methods, but you can also return results directly as python objects, and they'll be added to the results struct in the correct order''' return pow(params[0], params[1]) def parse_args():
64
64
49
4
60
HolgerPeters/pycapnp
examples/calculator_client.py
Python
parse_args
parse_args
27
32
27
27
b681d7681630fe7126765db20488ccef5736fa32
bigcode/the-stack
train
bcaa28d1150d3f88a7568445
train
class
class PowerFunction(calculator_capnp.Calculator.Function.Server): '''An implementation of the Function interface wrapping pow(). Note that we're implementing this on the client side and will pass a reference to the server. The server will then be able to make calls back to the client.''' def call(se...
class PowerFunction(calculator_capnp.Calculator.Function.Server):
'''An implementation of the Function interface wrapping pow(). Note that we're implementing this on the client side and will pass a reference to the server. The server will then be able to make calls back to the client.''' def call(self, params, **kwargs): '''Note the **kwargs. This is very n...
#!/usr/bin/env python from __future__ import print_function import argparse import socket import capnp import calculator_capnp class PowerFunction(calculator_capnp.Calculator.Function.Server):
41
64
153
12
28
HolgerPeters/pycapnp
examples/calculator_client.py
Python
PowerFunction
PowerFunction
11
24
11
12
d51a5cd694b45bbe5f80f2e8b3a2116d1c92caf5
bigcode/the-stack
train
bdfdda39c97353065ff3129d
train
function
def EntityLinker_v1( tok2vec: Model, nO: Optional[int] = None ) -> Model[List[Doc], Floats2d]: chain = registry.get("layers", "chain.v1") clone = registry.get("layers", "clone.v1") with Model.define_operators({">>": chain, "**": clone}): token_width = tok2vec.maybe_get_dim("nO") Linear ...
def EntityLinker_v1( tok2vec: Model, nO: Optional[int] = None ) -> Model[List[Doc], Floats2d]:
chain = registry.get("layers", "chain.v1") clone = registry.get("layers", "clone.v1") with Model.define_operators({">>": chain, "**": clone}): token_width = tok2vec.maybe_get_dim("nO") Linear = registry.get("layers", "Linear.v1") output_layer = Linear(nO=nO, nI=token_width) ...
from typing import Optional, List from thinc.types import Floats2d from thinc.api import Model from spacy.util import registry from spacy.tokens import Doc def EntityLinker_v1( tok2vec: Model, nO: Optional[int] = None ) -> Model[List[Doc], Floats2d]:
73
83
277
35
37
danieldk/spacy-legacy
spacy_legacy/architectures/entity_linker.py
Python
EntityLinker_v1
EntityLinker_v1
9
34
9
11
f5421c1ef6cf1738d71e531750be1d6d15126e4b
bigcode/the-stack
train
1852cc3596d44f7bac0b9ad8
train
class
class Keymap(wx.Frame, Module): def __init__(self, *args, **kwds): # begin wxGlade: Keymap.__init__ kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE | wx.FRAME_TOOL_WINDOW | wx.STAY_ON_TOP wx.Frame.__init__(self, *args, **kwds) Module.__init__(self) self.Se...
class Keymap(wx.Frame, Module):
def __init__(self, *args, **kwds): # begin wxGlade: Keymap.__init__ kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE | wx.FRAME_TOOL_WINDOW | wx.STAY_ON_TOP wx.Frame.__init__(self, *args, **kwds) Module.__init__(self) self.SetSize((500, 530)) self.l...
import wx from Kernel import Module _ = wx.GetTranslation class Keymap(wx.Frame, Module):
22
256
1,010
8
13
jaredly/meerk40t
Keymap.py
Python
Keymap
Keymap
8
105
8
8
cdeb5526ff4bcef12d2b0437f982368d032a958f
bigcode/the-stack
train
61f34935a9850fa1b732b48c
train
function
@typemap def eye_like(x, sparse_output = True, name=''): ''' Creates a matrix with diagonal set to 1s and of the same shape and the same dynamic axes as ``x``. To be a matrix, ``x`` must have exactly two axes (counting both dynamic and static axes). Example: >>> x0 = np.arange(12).reshape((3, ...
@typemap def eye_like(x, sparse_output = True, name=''):
''' Creates a matrix with diagonal set to 1s and of the same shape and the same dynamic axes as ``x``. To be a matrix, ``x`` must have exactly two axes (counting both dynamic and static axes). Example: >>> x0 = np.arange(12).reshape((3, 4)).astype('f') >>> x = C.input_variable(4) ...
.]]], dtype=float32) Args: x: numpy array or any :class:`~cntk.ops.functions.Function` that outputs a tensor name (str, optional): the name of the Function instance in the network Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import zeros_like x = sani...
109
109
364
17
92
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
eye_like
eye_like
2,321
2,348
2,321
2,322
b6103bd5c58a5496a86472e523633ea9a44b68d0
bigcode/the-stack
train
7725385b09a76d9d7b88c13b
train
function
@typemap def atan(x, name=''): ''' Computes the element-wise arctan (inverse tangent) of ``x``: The output tensor has the same shape as ``x``. Example: >>> np.round(C.atan([-1, 0, 1]).eval(), 5) array([-0.78539997, 0. , 0.78539997], dtype=float32) Args: x: numpy a...
@typemap def atan(x, name=''):
''' Computes the element-wise arctan (inverse tangent) of ``x``: The output tensor has the same shape as ``x``. Example: >>> np.round(C.atan([-1, 0, 1]).eval(), 5) array([-0.78539997, 0. , 0.78539997], dtype=float32) Args: x: numpy array or any :class:`~cntk.ops.f...
optional): the name of the Function instance in the network Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import asin x = sanitize_input(x) return asin(x, name) @typemap def atan(x, name=''):
64
64
175
11
53
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
atan
atan
1,791
1,810
1,791
1,792
be5fa705cbaafca97e969fdd8e4703a38058eced
bigcode/the-stack
train
664f5108861f91d8b396d7e0
train
function
@typemap def reduce_sum_square(x, axis=None, keepdims = True, name=''): ''' Computes the sum square of the input tensor's element along the provided axes. The resulted tensor has the same rank as the input if keepdims equal 1. If keepdims equal 0, then the resulted tensor have the reduced dimension pr...
@typemap def reduce_sum_square(x, axis=None, keepdims = True, name=''):
''' Computes the sum square of the input tensor's element along the provided axes. The resulted tensor has the same rank as the input if keepdims equal 1. If keepdims equal 0, then the resulted tensor have the reduced dimension pruned. Example: >>> C.reduce_sum_square([[[1,2], [3,4]]], 2)...
Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import reduce_l2 x = sanitize_input(x) axis = sanitize_multi_axis_reduction_list(axis) return reduce_l2(x, axis, keepdims, name) @typemap def reduce_sum_square(x, axis=None, keepdims = True, name=''):
83
83
278
21
62
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
reduce_sum_square
reduce_sum_square
3,287
3,311
3,287
3,288
73f78741774fc577f716b293125953eb895193b1
bigcode/the-stack
train
cb45fe3c745e8680a67693a1
train
function
@typemap def sum(*operands, **kw_name): ''' Create a new Function instance that computes element-wise sum of input tensors. Example: >>> in1_data = np.asarray([[1., 2., 3., 4.]], np.float32) >>> in2_data = np.asarray([[0., 5., -3., 2.]], np.float32) >>> in1 = C.input_variable(np.sh...
@typemap def sum(*operands, **kw_name):
''' Create a new Function instance that computes element-wise sum of input tensors. Example: >>> in1_data = np.asarray([[1., 2., 3., 4.]], np.float32) >>> in2_data = np.asarray([[0., 5., -3., 2.]], np.float32) >>> in1 = C.input_variable(np.shape(in1_data)) >>> in2 = C.input...
ands[0], (tuple, list)): operands = operands[0] if isinstance(operands, tuple): operands = list(operands) operands_unfold = [] for o in operands: if hasattr(o, 'outputs') and len(o.outputs) > 1: operands_unfold += o.outputs else: operands_unfold += [o]...
106
106
356
14
92
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
sum
sum
119
152
119
120
60e444a6d63e7923d72ae78ea4c3ce036d3ac343
bigcode/the-stack
train
2a26ea3ac5436cf416bf21c2
train
function
@typemap def roipooling(operand, rois, pooling_type, roi_output_shape, spatial_scale, name=''): ''' The ROI (Region of Interest) pooling operation pools over sub-regions of an input volume and produces a fixed sized output volume regardless of the ROI size. It is used for example for object detection. ...
@typemap def roipooling(operand, rois, pooling_type, roi_output_shape, spatial_scale, name=''):
''' The ROI (Region of Interest) pooling operation pools over sub-regions of an input volume and produces a fixed sized output volume regardless of the ROI size. It is used for example for object detection. Each input image has a fixed number of regions of interest, which are specified as bounding boxe...
_shape(output_shape) dilation = sanitize_shape(dilation) return convolution_transpose(convolution_map, operand, strides, sharing, auto_padding, output_shape, dilation, reduction_rank, max_temp_mem_size_in_samples, name) from cntk.cntk_py import PoolingType_Max, PoolingType_Aver...
133
133
444
27
106
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
roipooling
roipooling
497
529
497
498
69c6a28d467ecd817666c64d44e1185f244b8e53
bigcode/the-stack
train
76417e3ea0cfa38df34ba1a2
train
function
@typemap def log(x, name=''): ''' Computes the element-wise the natural logarithm of ``x``: Example: >>> C.log([1., 2.]).eval() array([ 0. , 0.693147], dtype=float32) Args: x: numpy array or any :class:`~cntk.ops.functions.Function` that outputs a tensor name (str...
@typemap def log(x, name=''):
''' Computes the element-wise the natural logarithm of ``x``: Example: >>> C.log([1., 2.]).eval() array([ 0. , 0.693147], dtype=float32) Args: x: numpy array or any :class:`~cntk.ops.functions.Function` that outputs a tensor name (str, optional): the name of the F...
name (str, optional): the name of the Function instance in the network Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import exp x = sanitize_input(x) return exp(x, name) @typemap def log(x, name=''):
69
69
231
11
58
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
log
log
2,051
2,074
2,051
2,052
71d33dd3211d9b49f0d91bfebcba8bcfa819f06a
bigcode/the-stack
train
e0a1d614d0ff8e1931326915
train
function
@typemap def element_not(x, name=''): ''' Computes the element-wise logic NOT of ``x`` and ``y``. Example: >>> C.element_not([1, 1, 0, 0]).eval() array([ 0., 0., 1., 1.], dtype=float32) Args: x, y: numpy array or any :class:`~cntk.ops.functions.Function` that outputs a tenso...
@typemap def element_not(x, name=''):
''' Computes the element-wise logic NOT of ``x`` and ``y``. Example: >>> C.element_not([1, 1, 0, 0]).eval() array([ 0., 0., 1., 1.], dtype=float32) Args: x, y: numpy array or any :class:`~cntk.ops.functions.Function` that outputs a tensor name (str, optional): the na...
Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import element_and x = sanitize_input(x) y = sanitize_input(y) return element_and(x, y, name) @typemap def element_not(x, name=''):
64
64
161
12
52
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
element_not
element_not
2,164
2,181
2,164
2,165
ae315c68befa4af79efe5b2217a024ed9cc7f556
bigcode/the-stack
train