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
1a48d159db8d8c7994a03825
train
class
class HTTPInsufficientStorage(HTTPServerError): status_code = 507
class HTTPInsufficientStorage(HTTPServerError):
status_code = 507
503 class HTTPGatewayTimeout(HTTPServerError): status_code = 504 class HTTPVersionNotSupported(HTTPServerError): status_code = 505 class HTTPVariantAlsoNegotiates(HTTPServerError): status_code = 506 class HTTPInsufficientStorage(HTTPServerError):
64
64
17
10
53
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPInsufficientStorage
HTTPInsufficientStorage
398
399
398
398
6afcfc70ec4c6a0502202adcc66345f3a3917245
bigcode/the-stack
train
00f6e171c1dbee4a6b0eac18
train
class
class HTTPRequestHeaderFieldsTooLarge(HTTPClientError): status_code = 431
class HTTPRequestHeaderFieldsTooLarge(HTTPClientError):
status_code = 431
424 class HTTPUpgradeRequired(HTTPClientError): status_code = 426 class HTTPPreconditionRequired(HTTPClientError): status_code = 428 class HTTPTooManyRequests(HTTPClientError): status_code = 429 class HTTPRequestHeaderFieldsTooLarge(HTTPClientError):
64
64
19
12
51
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPRequestHeaderFieldsTooLarge
HTTPRequestHeaderFieldsTooLarge
333
334
333
333
8ffa0ebb663e7fd2da32c26f3da70326a072611c
bigcode/the-stack
train
3863a23f6f65e15f9674906d
train
class
class HTTPNotFound(HTTPClientError): status_code = 404
class HTTPNotFound(HTTPClientError):
status_code = 404
Error): status_code = 400 class HTTPUnauthorized(HTTPClientError): status_code = 401 class HTTPPaymentRequired(HTTPClientError): status_code = 402 class HTTPForbidden(HTTPClientError): status_code = 403 class HTTPNotFound(HTTPClientError):
64
64
16
9
54
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPNotFound
HTTPNotFound
226
227
226
226
08a99a6bc325b8f9ad4d62debb6a0855f7043dec
bigcode/the-stack
train
f40e1401a8ccc32ee40e0871
train
class
class HTTPBadGateway(HTTPServerError): status_code = 502
class HTTPBadGateway(HTTPServerError):
status_code = 502
# codes are applicable to any request method. class HTTPServerError(HTTPError): pass class HTTPInternalServerError(HTTPServerError): status_code = 500 class HTTPNotImplemented(HTTPServerError): status_code = 501 class HTTPBadGateway(HTTPServerError):
64
64
16
9
54
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPBadGateway
HTTPBadGateway
378
379
378
378
e8ef64790b4e719cbedecd815f6d70192fd03495
bigcode/the-stack
train
45fc33e9b3c7af0145cc90cd
train
class
class HTTPPreconditionFailed(HTTPClientError): status_code = 412
class HTTPPreconditionFailed(HTTPClientError):
status_code = 412
status_code = 408 class HTTPConflict(HTTPClientError): status_code = 409 class HTTPGone(HTTPClientError): status_code = 410 class HTTPLengthRequired(HTTPClientError): status_code = 411 class HTTPPreconditionFailed(HTTPClientError):
64
64
17
10
53
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPPreconditionFailed
HTTPPreconditionFailed
274
275
274
274
1c5db90d1fe78887f0110e0f9c0229ed13ca5129
bigcode/the-stack
train
93080cd66ba5461aee45a097
train
class
class HTTPNonAuthoritativeInformation(HTTPSuccessful): status_code = 203
class HTTPNonAuthoritativeInformation(HTTPSuccessful):
status_code = 203
200s.""" class HTTPOk(HTTPSuccessful): status_code = 200 class HTTPCreated(HTTPSuccessful): status_code = 201 class HTTPAccepted(HTTPSuccessful): status_code = 202 class HTTPNonAuthoritativeInformation(HTTPSuccessful):
64
64
18
11
52
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPNonAuthoritativeInformation
HTTPNonAuthoritativeInformation
123
124
123
123
32493858cc9a2e3cae9123e22d9c6bf45abe6c9d
bigcode/the-stack
train
1798e949c03d1db59bafd552
train
class
class HTTPRequestURITooLong(HTTPClientError): status_code = 414
class HTTPRequestURITooLong(HTTPClientError):
status_code = 414
: float, **kwargs: Any) -> None: kwargs.setdefault( 'text', 'Maximum request body size {} exceeded, ' 'actual body size {}'.format(max_size, actual_size) ) super().__init__(**kwargs) class HTTPRequestURITooLong(HTTPClientError):
64
64
18
11
53
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPRequestURITooLong
HTTPRequestURITooLong
293
294
293
293
a35b24db6f6c31e968686e29b04d458fff28574f
bigcode/the-stack
train
787ff0ff537cd036bf4ffa48
train
function
def load_dict_from_json(file_: str, key_type: type = int): """ Read in json file. Convert keys to `key_type'. Inverse to `save_dict_to_json`. Parameters ---------- file_: Name of the file to read in. key_type: Type to convert the keys into. Returns ------- dct: ...
def load_dict_from_json(file_: str, key_type: type = int):
""" Read in json file. Convert keys to `key_type'. Inverse to `save_dict_to_json`. Parameters ---------- file_: Name of the file to read in. key_type: Type to convert the keys into. Returns ------- dct: The json file contents. """ with open(file_, 'r') a...
---------- dct: The dictionary to write to file. file_: Name of the file to write to. """ with open(file_, 'w') as f: json.dump(dct, f) def load_dict_from_json(file_: str, key_type: type = int):
64
64
137
16
48
chrhck/pyABC
pyabc/storage/json.py
Python
load_dict_from_json
load_dict_from_json
19
40
19
19
2f7520a05d2d81fbfebfa9265925601cfa0af26b
bigcode/the-stack
train
f2db8650a577f2fa89db97d1
train
function
def save_dict_to_json(dct: dict, file_: str): """ Save dict to file. Inverse to `load_dict_from_json`. Parameters ---------- dct: The dictionary to write to file. file_: Name of the file to write to. """ with open(file_, 'w') as f: json.dump(dct, f)
def save_dict_to_json(dct: dict, file_: str):
""" Save dict to file. Inverse to `load_dict_from_json`. Parameters ---------- dct: The dictionary to write to file. file_: Name of the file to write to. """ with open(file_, 'w') as f: json.dump(dct, f)
import json def save_dict_to_json(dct: dict, file_: str):
17
64
82
14
2
chrhck/pyABC
pyabc/storage/json.py
Python
save_dict_to_json
save_dict_to_json
4
16
4
4
0f24df8bee50f3f865b5fe7595257009a75db4a1
bigcode/the-stack
train
3d17902582e90444e863c44f
train
class
class DFGN_Roberta(BertPreTrainedModel): """BERT model for Question Answering (span extraction). This module is composed of the BERT model with a linear layer on top of the sequence output that computes start_logits and end_logits Params: `config`: a BertConfig class instance with the configura...
class DFGN_Roberta(BertPreTrainedModel):
"""BERT model for Question Answering (span extraction). This module is composed of the BERT model with a linear layer on top of the sequence output that computes start_logits and end_logits Params: `config`: a BertConfig class instance with the configuration to build a new model. Inputs: ...
, batch['q_type']) # loss3 = self.sp_lambda * criterion(sp.view(-1, 2), batch['is_support'].long().view(-1)) # loss = loss1 + loss2 + loss3 # # loss4 = 0 # if self.bfs_clf: # for l in range(self.n_layers): # pred_mask = masks[l]...
256
256
893
14
241
wuhenbai/hotpot
model/GNN.py
Python
DFGN_Roberta
DFGN_Roberta
256
325
256
256
f08c52a738b909bcd7c2faf79983610e2731a21c
bigcode/the-stack
train
64aa54f10a84c0d2f45eeb5d
train
class
class DFGN_Albert(BertPreTrainedModel): """BERT model for Question Answering (span extraction). This module is composed of the BERT model with a linear layer on top of the sequence output that computes start_logits and end_logits Params: `config`: a BertConfig class instance with the configurat...
class DFGN_Albert(BertPreTrainedModel):
"""BERT model for Question Answering (span extraction). This module is composed of the BERT model with a linear layer on top of the sequence output that computes start_logits and end_logits Params: `config`: a BertConfig class instance with the configuration to build a new model. Inputs: ...
, config, graph_config): super(DFGN_Roberta, self).__init__(config) self.roberta = RobertaModel(config) # TODO check with Google if it's normal there is no dropout on the token classifier of SQuAD in the TF version self.DFGN = GraphFusionNet(graph_config) # self.apply(self.init_b...
256
256
899
13
243
wuhenbai/hotpot
model/GNN.py
Python
DFGN_Albert
DFGN_Albert
328
398
328
328
3165791cabf2be6de5c4e4cded30a86ead880011
bigcode/the-stack
train
4681e93691649dee18ebcd63
train
class
class GraphFusionNet(nn.Module): """ Packing Query Version """ def __init__(self, config): super(GraphFusionNet, self).__init__() self.config = config self.n_layers = config.n_layers self.max_query_length = 50 self.bi_attention = BiAttention(input_dim=config.inpu...
class GraphFusionNet(nn.Module):
""" Packing Query Version """ def __init__(self, config): super(GraphFusionNet, self).__init__() self.config = config self.n_layers = config.n_layers self.max_query_length = 50 self.bi_attention = BiAttention(input_dim=config.input_dim, ...
from pytorch_pretrained_bert.modeling import * from transformers import AlbertModel, AlbertTokenizer, BertPreTrainedModel, RobertaModel, BertModel from model.layers import * class GraphFusionNet(nn.Module):
45
240
801
7
38
wuhenbai/hotpot
model/GNN.py
Python
GraphFusionNet
GraphFusionNet
8
87
8
8
02bc91635261188d01ed6257acad5acdb1fbfbe6
bigcode/the-stack
train
c14385bb94bdbc98ba46c092
train
class
class DFGN_Bert(BertPreTrainedModel): """BERT model for Question Answering (span extraction). This module is composed of the BERT model with a linear layer on top of the sequence output that computes start_logits and end_logits Params: `config`: a BertConfig class instance with the configuratio...
class DFGN_Bert(BertPreTrainedModel):
"""BERT model for Question Answering (span extraction). This module is composed of the BERT model with a linear layer on top of the sequence output that computes start_logits and end_logits Params: `config`: a BertConfig class instance with the configuration to build a new model. Inputs: ...
super(DFGN_Albert, self).__init__(config) self.albert = AlbertModel(config) # TODO check with Google if it's normal there is no dropout on the token classifier of SQuAD in the TF version self.DFGN = GraphFusionNet(graph_config) # self.apply(self.init_bert_weights) self.init_weig...
256
256
899
13
243
wuhenbai/hotpot
model/GNN.py
Python
DFGN_Bert
DFGN_Bert
400
470
400
400
ed324f5e7e253d469b5f9f7fa6e33135178696be
bigcode/the-stack
train
0d823efdd6ba01cfcc499d03
train
class
class DFGN(PreTrainedBertModel): """BERT model for Question Answering (span extraction). This module is composed of the BERT model with a linear layer on top of the sequence output that computes start_logits and end_logits Params: `config`: a BertConfig class instance with the configuration to ...
class DFGN(PreTrainedBertModel):
"""BERT model for Question Answering (span extraction). This module is composed of the BERT model with a linear layer on top of the sequence output that computes start_logits and end_logits Params: `config`: a BertConfig class instance with the configuration to build a new model. Inputs: ...
, 0]]) input_mask = torch.LongTensor([[1, 1, 1], [1, 1, 0]]) token_type_ids = torch.LongTensor([[0, 0, 1], [0, 1, 0]]) config = BertConfig(vocab_size_or_config_json_file=32000, hidden_size=768, num_hidden_layers=12, num_attention_heads=12, intermediate_size=3072) model = BertForQuestionAnsweri...
256
256
869
12
243
wuhenbai/hotpot
model/GNN.py
Python
DFGN
DFGN
156
222
156
156
c29f5a3fca9a401307bf2044164225ae36138ee6
bigcode/the-stack
train
59e2fed01630f36f9c40b7cc
train
class
class BertForQuestionAnswering(PreTrainedBertModel): """BERT model for Question Answering (span extraction). This module is composed of the BERT model with a linear layer on top of the sequence output that computes start_logits and end_logits Params: `config`: a BertConfig class instance with t...
class BertForQuestionAnswering(PreTrainedBertModel):
"""BERT model for Question Answering (span extraction). This module is composed of the BERT model with a linear layer on top of the sequence output that computes start_logits and end_logits Params: `config`: a BertConfig class instance with the configuration to build a new model. Inputs: ...
entity_state = None # for l in range(self.n_layers): # input_state, entity_state, softmask = self.basicblocks[l](input_state, query_vec, batch) # softmasks.append(softmask) # if self.config.q_update: # query_attn_output, _ = self.query_update_layers[l](trunc_...
228
228
761
14
213
wuhenbai/hotpot
model/GNN.py
Python
BertForQuestionAnswering
BertForQuestionAnswering
91
152
91
91
73d5e84870d79cf0ae5db8d1c7b4c04d69958b4d
bigcode/the-stack
train
d667b6dcccab0c69cdfa38ad
train
function
def get_api_key(client, username, secret): """Attempts API-Key and password auth to get an API key. This will also generate an API key if one doesn't exist """ # Try to use a client with username/api key if len(secret) == 64: try: client.auth = auth.BasicAuthentication(username...
def get_api_key(client, username, secret):
"""Attempts API-Key and password auth to get an API key. This will also generate an API key if one doesn't exist """ # Try to use a client with username/api key if len(secret) == 64: try: client.auth = auth.BasicAuthentication(username, secret) client['Account'].get...
os.path import click import SoftLayer from SoftLayer import auth from SoftLayer.CLI import config from SoftLayer.CLI import environment from SoftLayer.CLI import exceptions from SoftLayer.CLI import formatting from SoftLayer import utils def get_api_key(client, username, secret):
64
64
212
10
53
corneil/softlayer-python
SoftLayer/CLI/config/setup.py
Python
get_api_key
get_api_key
16
41
16
16
71ee14506e280a52976c972cc3d2b06d081774e3
bigcode/the-stack
train
1df322f588ebd1e9f39354f5
train
function
@click.command() @environment.pass_env def cli(env): """Edit configuration.""" username, secret, endpoint_url, timeout = get_user_input(env) env.client.transport.transport.endpoint_url = endpoint_url api_key = get_api_key(env.client, username, secret) path = '~/.softlayer' if env.config_file:...
@click.command() @environment.pass_env def cli(env):
"""Edit configuration.""" username, secret, endpoint_url, timeout = get_user_input(env) env.client.transport.transport.endpoint_url = endpoint_url api_key = get_api_key(env.client, username, secret) path = '~/.softlayer' if env.config_file: path = env.config_file config_path = os....
else: # Try to use a client with username/password client.authenticate_with_password(username, secret) user_record = client['Account'].getCurrentUser( mask='id, apiAuthenticationKeys') api_keys = user_record['apiAuthenticationKeys'] if len(api_keys) == 0: ...
106
106
356
12
94
corneil/softlayer-python
SoftLayer/CLI/config/setup.py
Python
cli
cli
44
91
44
46
5febcd8d99287b9133ba50bb5457cefbe87e0d27
bigcode/the-stack
train
beeabef61d10bffb8b17908e
train
function
def get_user_input(env): """Ask for username, secret (api_key or password) and endpoint_url.""" defaults = config.get_settings_from_client(env.client) # Ask for username username = env.input('Username', default=defaults['username']) # Ask for 'secret' which can be api_key or their password se...
def get_user_input(env):
"""Ask for username, secret (api_key or password) and endpoint_url.""" defaults = config.get_settings_from_client(env.client) # Ask for username username = env.input('Username', default=defaults['username']) # Ask for 'secret' which can be api_key or their password secret = env.getpass('API K...
) config_fd = os.fdopen(os.open(config_path, (os.O_WRONLY | os.O_CREAT | os.O_TRUNC), 0o600), 'w') try: parsed_config.write(config_fd) finally: config_fd.close() env.fout("Configuration Update...
72
72
243
6
66
corneil/softlayer-python
SoftLayer/CLI/config/setup.py
Python
get_user_input
get_user_input
94
122
94
94
f425a2d6ea91376a544d25b5f5d6fc91288ff4d1
bigcode/the-stack
train
4db71388d1043bd760958417
train
class
class PlotStat: """ class to display median values of the Global Metric Parameters --------------- dbDir: str location directory of the files forPlot: str configuration file (dbNames, marker, colors, ...) """ def __init__(self, dbDir, forPlot): self.config = forPl...
class PlotStat:
""" class to display median values of the Global Metric Parameters --------------- dbDir: str location directory of the files forPlot: str configuration file (dbNames, marker, colors, ...) """ def __init__(self, dbDir, forPlot): self.config = forPlot # fir...
vary, legy, nightBeg=0, nightEnd=365): """ Method to plot vary vs varx Parameters --------------- varx: str variable to display - xaxis vary: str variable to display - yaxis legx: str x-axis legend legy: str y-axis...
255
255
851
4
251
LSSTDESC/sn_plotters
sn_plotter_metrics/globalPlot.py
Python
PlotStat
PlotStat
197
293
197
197
504fb66232a87ee0bc676e47b0c2957178fa17ee
bigcode/the-stack
train
672f3d63e64ddb0ac6870a21
train
class
class PlotTime: """ Class to plot some variable vs time (night number) Parameters --------------- dbDir: str location dir of the files dbName: str OS to display forPlot: pandas df configuration parameters (marker, color, ...) """ def __init__(self, dbDir, dbName...
class PlotTime:
""" Class to plot some variable vs time (night number) Parameters --------------- dbDir: str location dir of the files dbName: str OS to display forPlot: pandas df configuration parameters (marker, color, ...) """ def __init__(self, dbDir, dbName, forPlot): ...
(['dbName']).median().reset_index() ax.barh(meds['dbName'],meds[plotstr]) """ for dbName in np.unique(self.data['dbName']): idx = self.data['dbName'] == dbName sel = self.data[idx] print('hhhh',sel.columns) ax.barh(sel['dbName'],sel[plotstr]) ...
128
128
427
4
124
LSSTDESC/sn_plotters
sn_plotter_metrics/globalPlot.py
Python
PlotTime
PlotTime
129
194
129
129
6386fc0213e6475f696acf4a4dcba804675b1c75
bigcode/the-stack
train
d4e50799552894756cbe5c1b
train
class
class PlotHist: """ class to plot histograms for a set of OS Parameters --------------- dbDir: str loca. directory of the files forPlot: pandas df configuration parameters """ def __init__(self, dbDir, forPlot): self.data = pd.DataFrame() for i,row in forP...
class PlotHist:
""" class to plot histograms for a set of OS Parameters --------------- dbDir: str loca. directory of the files forPlot: pandas df configuration parameters """ def __init__(self, dbDir, forPlot): self.data = pd.DataFrame() for i,row in forPlot.iterrows(): ...
import pandas as pd import numpy as np import numpy.lib.recfunctions as rf from . import plt class PlotHist:
27
256
874
4
22
LSSTDESC/sn_plotters
sn_plotter_metrics/globalPlot.py
Python
PlotHist
PlotHist
7
125
7
7
45f23df9510398d907e17809b7d35de06bbf6c90
bigcode/the-stack
train
b398d580a85db557f75bdad0
train
function
def add_gene_coords(tsv_in, tsv_out, bed, hgnc_handle, log): log.write('reading coords...\n') chroms = {} low = {} high = {} for idx, line in enumerate(bed): fields = line.strip().split('\t') if len(fields) < 4: continue chrom = fields[0] start = int(field...
def add_gene_coords(tsv_in, tsv_out, bed, hgnc_handle, log):
log.write('reading coords...\n') chroms = {} low = {} high = {} for idx, line in enumerate(bed): fields = line.strip().split('\t') if len(fields) < 4: continue chrom = fields[0] start = int(fields[1]) finish = int(fields[1]) gene = fields[3...
#!/usr/bin/env python import collections import sys def add_gene_coords(tsv_in, tsv_out, bed, hgnc_handle, log):
33
206
687
21
11
MelbourneGenomics/iq
iq/add_gene_coords.py
Python
add_gene_coords
add_gene_coords
6
73
6
6
3117ae157c51d3f03d50bcb540771fbfdf2dae6f
bigcode/the-stack
train
ca0950b3b08cff5e6b847380
train
class
class Migration(migrations.Migration): dependencies = [ ('app_api', '0008_auto_20210406_1545'), ] operations = [ migrations.CreateModel( name='Track', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name...
class Migration(migrations.Migration):
dependencies = [ ('app_api', '0008_auto_20210406_1545'), ] operations = [ migrations.CreateModel( name='Track', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('track_key', m...
# Generated by Django 3.1.2 on 2021-04-12 20:21 from django.db import migrations, models import django.db.models.deletion import tyadmin_api_cli.fields class Migration(migrations.Migration):
52
218
727
7
44
pkucsie/SIEPServer
app_api/migrations/0009_auto_20210412_2021.py
Python
Migration
Migration
8
76
8
9
1593d84ce22e53e6af00a8acb9f0fc1a72656537
bigcode/the-stack
train
7ceecfb81e1dfc9643677ef5
train
class
class ForegroundDetector(object): def __init__(self, interactive_mode=True): self.interactive_mode = interactive_mode self.roi_points = [] self.state = DetectorState.INIT self.background_substraction = cv2.createBackgroundSubtractorMOG2(history=500, varThreshold=150, detectShadows=Tr...
class ForegroundDetector(object):
def __init__(self, interactive_mode=True): self.interactive_mode = interactive_mode self.roi_points = [] self.state = DetectorState.INIT self.background_substraction = cv2.createBackgroundSubtractorMOG2(history=500, varThreshold=150, detectShadows=True) if self.interactive_m...
import cv2 import math import numpy as np from pyuwds3.types.detection import Detection class DetectorState(object): INIT = 0 WAITING = 1 READY = 2 RUNNING = 3 state = {0: "INIT", 1: "WAITING", 2: "READY", 3: "RUNNING"} class ForegroundDetector(object):
89
256
1,728
6
83
Alexandre-Bonneau/uwds3_perception
src/uwds3_perception/detection/foreground_detector.py
Python
ForegroundDetector
ForegroundDetector
16
161
16
16
d3582100fbdb5ad469884b45d0fdf3eead029beb
bigcode/the-stack
train
6654ecbd38e8064f545a3476
train
class
class DetectorState(object): INIT = 0 WAITING = 1 READY = 2 RUNNING = 3 state = {0: "INIT", 1: "WAITING", 2: "READY", 3: "RUNNING"}
class DetectorState(object):
INIT = 0 WAITING = 1 READY = 2 RUNNING = 3 state = {0: "INIT", 1: "WAITING", 2: "READY", 3: "RUNNING"}
import cv2 import math import numpy as np from pyuwds3.types.detection import Detection class DetectorState(object):
28
64
60
5
22
Alexandre-Bonneau/uwds3_perception
src/uwds3_perception/detection/foreground_detector.py
Python
DetectorState
DetectorState
7
13
7
7
34cadec9eba3e6c54249f66e10aed93587bea8b6
bigcode/the-stack
train
3f1daba8e4085f14c92ce701
train
class
class User(AbstractUser): nickName = models.CharField(max_length=50,blank=True) headphoto = models.ImageField(default='default/headphoto.jpg') class Meta(AbstractUser.Meta): pass
class User(AbstractUser):
nickName = models.CharField(max_length=50,blank=True) headphoto = models.ImageField(default='default/headphoto.jpg') class Meta(AbstractUser.Meta): pass
from django.db import models from django.contrib.auth.models import AbstractUser class User(AbstractUser):
20
64
44
5
14
lizheng3401/MetaStudio
account/models.py
Python
User
User
5
9
5
5
5caf13289bd883692b26c59774b14da7afc34d79
bigcode/the-stack
train
a0568e627761f722f2907f3f
train
class
class MessageGame(models.Model): mes = models.TextField() createTime = models.DateTimeField(auto_now_add=True) isRead = models.BooleanField(default=False) game = models.ForeignKey("game.Game") user = models.ForeignKey("User", related_name="user_app") toUser = models.ForeignKey("User", related_...
class MessageGame(models.Model):
mes = models.TextField() createTime = models.DateTimeField(auto_now_add=True) isRead = models.BooleanField(default=False) game = models.ForeignKey("game.Game") user = models.ForeignKey("User", related_name="user_app") toUser = models.ForeignKey("User", related_name="toUser_app") def __str_...
django.db import models from django.contrib.auth.models import AbstractUser class User(AbstractUser): nickName = models.CharField(max_length=50,blank=True) headphoto = models.ImageField(default='default/headphoto.jpg') class Meta(AbstractUser.Meta): pass class MessageGame(models.Model):
64
64
91
6
57
lizheng3401/MetaStudio
account/models.py
Python
MessageGame
MessageGame
12
23
12
13
4739fbbbe241510acddd5b19c6490f22a51b4a62
bigcode/the-stack
train
c93608dab3809d37902fc81f
train
class
class MessageBlog(models.Model): mes = models.TextField() createTime = models.DateTimeField(auto_now_add=True) isRead = models.BooleanField(default=False) post = models.ForeignKey("blog.Post") user = models.ForeignKey("User", related_name="user_post") toUser = models.ForeignKey("User", related...
class MessageBlog(models.Model):
mes = models.TextField() createTime = models.DateTimeField(auto_now_add=True) isRead = models.BooleanField(default=False) post = models.ForeignKey("blog.Post") user = models.ForeignKey("User", related_name="user_post") toUser = models.ForeignKey("User", related_name="toUse_post") def __str...
(default=False) game = models.ForeignKey("game.Game") user = models.ForeignKey("User", related_name="user_app") toUser = models.ForeignKey("User", related_name="toUser_app") def __str__(self): return self.mes class MessageBlog(models.Model):
64
64
90
6
57
lizheng3401/MetaStudio
account/models.py
Python
MessageBlog
MessageBlog
26
37
26
27
ea5e483aa12cc4481da147d4b040943d00eaf21d
bigcode/the-stack
train
758b959833355ee7fb15127f
train
class
class StringResource(Resource): """ Holds a String. Things the compiler can know about a string: * Literal value: string is statically known. Every method expect working with non-static strings supported These limitations are in place to allow efficient iteration over a string. A more muta...
class StringResource(Resource):
""" Holds a String. Things the compiler can know about a string: * Literal value: string is statically known. Every method expect working with non-static strings supported These limitations are in place to allow efficient iteration over a string. A more mutable string class may be added la...
from __future__ import annotations import re from string import Formatter from typing import Dict, Optional, Tuple, TYPE_CHECKING from mcscript.lang.Type import Type from mcscript.lang.atomic_types import String from mcscript.lang.resource.base.ResourceBase import Resource from mcscript.utils.JsonTextFormat.objectFor...
116
130
434
5
110
Inky-developer/McScript
mcscript/lang/resource/StringResource.py
Python
StringResource
StringResource
18
78
18
18
f08774f1daf393506c3847beb8a8ff80bc07917b
bigcode/the-stack
train
ee9f643b8ee372721f5e442d
train
class
class TestTimezones(unittest.TestCase): def test_default_tz(self): default = default_timezone() set_default_tz("America/Chicago") local_time = now_local() local_tz = default_timezone() us_time = datetime.datetime.now(tz=tz.gettz("America/Chicago")) self.assertEqual(n...
class TestTimezones(unittest.TestCase):
def test_default_tz(self): default = default_timezone() set_default_tz("America/Chicago") local_time = now_local() local_tz = default_timezone() us_time = datetime.datetime.now(tz=tz.gettz("America/Chicago")) self.assertEqual(nice_date_time(local_time), ...
5', 'should format 5.5 ' 'as 5.5 not {}'.format( nice_number(5.5, lang='as-df'))) # Should throw a warning. Would raise the same text as a # NotImplementedError, but nice_number() bypasses and returns # its input as a string self.asser...
94
94
315
8
86
OpenVoiceOS/ovos-lingua-franca
test/unittests/test_format.py
Python
TestTimezones
TestTimezones
67
97
67
67
25e406a3148a86d349ff4c07ea127227f8e0ca3e
bigcode/the-stack
train
ca6c1c261db87fef3fa6cb38
train
class
class TestMixedFraction(unittest.TestCase): def test_convert_to_fraction(self): self.assertEqual(cmf(8), (8, 0, 1)) self.assertEqual(cmf(8.00001), (8, 0, 1)) self.assertEqual(cmf(8.5), (8, 1, 2)) self.assertEqual(cmf(8.587465135), None) self.assertEqual(cmf(8.587465135, range...
class TestMixedFraction(unittest.TestCase):
def test_convert_to_fraction(self): self.assertEqual(cmf(8), (8, 0, 1)) self.assertEqual(cmf(8.00001), (8, 0, 1)) self.assertEqual(cmf(8.5), (8, 1, 2)) self.assertEqual(cmf(8.587465135), None) self.assertEqual(cmf(8.587465135, range(1, 101)), (8, 47, 80))
13, 2, 3, tzinfo=default_timezone()) self.assertTrue(len(nice_year(dt, lang=lang)) > 0) # Looking through the date sequence can be helpful unload_language(lang) set_default_lang('en') class TestMixedFraction(unittest.TestCase):
64
64
119
8
56
OpenVoiceOS/ovos-lingua-franca
test/unittests/test_format.py
Python
TestMixedFraction
TestMixedFraction
218
224
218
218
fd7e97aaa7bb28b180d30fe52d7cd70c6c5a6760
bigcode/the-stack
train
6f705cb0e75dcd45ae77b7e3
train
function
def tearDownModule(): unload_language("en")
def tearDownModule():
unload_language("en")
from lingua_franca.lang.format_common import convert_to_mixed_fraction as cmf from lingua_franca.time import default_timezone, set_default_tz, now_local, \ to_local def setUpModule(): load_language("en") set_default_lang('en-us') def tearDownModule():
64
64
11
5
59
OpenVoiceOS/ovos-lingua-franca
test/unittests/test_format.py
Python
tearDownModule
tearDownModule
43
44
43
43
e9cd65e5b143bcd91a510b1aed116fd73f0398d8
bigcode/the-stack
train
2c67a3de0b4901d3ea52b2de
train
class
class TestNiceDateFormat(unittest.TestCase): @classmethod def setUpClass(cls): # Read date_time_test.json files for test data cls.test_config = {} p = Path(date_time_format.config_path) for sub_dir in [x for x in p.iterdir() if x.is_dir()]: if (sub_dir / 'date_time_te...
class TestNiceDateFormat(unittest.TestCase): @classmethod
def setUpClass(cls): # Read date_time_test.json files for test data cls.test_config = {} p = Path(date_time_format.config_path) for sub_dir in [x for x in p.iterdir() if x.is_dir()]: if (sub_dir / 'date_time_test.json').exists(): print("Getting test for " ...
_time(local_time), nice_date_time(us_time)) self.assertEqual(local_time.tzinfo, local_tz) # naive datetimes assumed to be in default timezone already! # in the case of datetime.now this corresponds to tzlocal() # otherwise timezone is undefined and can not be gu...
256
256
1,148
13
243
OpenVoiceOS/ovos-lingua-franca
test/unittests/test_format.py
Python
TestNiceDateFormat
TestNiceDateFormat
100
215
100
101
46349f04bf211e14e0cf8f6012c2d5ac639cc8e7
bigcode/the-stack
train
3a4377a1532cdc6c028f06d8
train
class
class TestNiceNumberFormat(unittest.TestCase): def test_unknown_language(self): """ An unknown / unhandled language should return the string representation of the input number. """ def bypass_warning(): self.assertEqual( nice_number(5.5, lang='as-df'...
class TestNiceNumberFormat(unittest.TestCase):
def test_unknown_language(self): """ An unknown / unhandled language should return the string representation of the input number. """ def bypass_warning(): self.assertEqual( nice_number(5.5, lang='as-df'), '5.5', 'should format 5.5 ' ...
cmf from lingua_franca.time import default_timezone, set_default_tz, now_local, \ to_local def setUpModule(): load_language("en") set_default_lang('en-us') def tearDownModule(): unload_language("en") class TestNiceNumberFormat(unittest.TestCase):
64
64
151
9
55
OpenVoiceOS/ovos-lingua-franca
test/unittests/test_format.py
Python
TestNiceNumberFormat
TestNiceNumberFormat
47
64
47
48
3edc15e8d47b49cc532bda5eb97351ee0fc1def2
bigcode/the-stack
train
fcde1b900bed414276e0961c
train
function
def setUpModule(): load_language("en") set_default_lang('en-us')
def setUpModule():
load_language("en") set_default_lang('en-us')
_number from lingua_franca.format import nice_time from lingua_franca.format import nice_year from lingua_franca.lang.format_common import convert_to_mixed_fraction as cmf from lingua_franca.time import default_timezone, set_default_tz, now_local, \ to_local def setUpModule():
64
64
19
5
58
OpenVoiceOS/ovos-lingua-franca
test/unittests/test_format.py
Python
setUpModule
setUpModule
38
40
38
38
ca01c93fa9fe9a7ba3dff4df9bad0ffe502fd0aa
bigcode/the-stack
train
40ec8765c68d4b8cd8a1f444
train
function
@app.route('/', methods=['GET', ]) def index(): return 'My flask-blog working!'
@app.route('/', methods=['GET', ]) def index():
return 'My flask-blog working!'
# -*- encoding: utf-8 -*- from flask import Flask app = Flask('blog') @app.route('/', methods=['GET', ]) def index():
30
64
19
11
19
coder17x/flask-blog
main_wsgi.py
Python
index
index
7
9
7
8
cd82cb1bd2c7b6adeb95f82a9dbc4bbee14fceb2
bigcode/the-stack
train
043bbbbce050985e2560fe38
train
function
def get_sys_temp_dir_for_path(*path): return os.path.join(SYS_TMP_DIR, *path)
def get_sys_temp_dir_for_path(*path):
return os.path.join(SYS_TMP_DIR, *path)
.integration.__init__ TMP = os.path.join(SYS_TMP_DIR, 'salt-tests-tmpdir') def get_salt_temp_dir(): return TMP def get_salt_temp_dir_for_path(*path): return os.path.join(TMP, *path) def get_sys_temp_dir_for_path(*path):
64
64
23
10
54
byteskeptical/salt
tests/integration/files/file/base/_modules/runtests_helpers.py
Python
get_sys_temp_dir_for_path
get_sys_temp_dir_for_path
43
44
43
43
5809fc8bb5df2c82cbe2db811316fa390b8849b0
bigcode/the-stack
train
8545f37387bdc8e45db1ae2f
train
function
def modules_available(*names): ''' Returns a list of modules not available. Empty list if modules are all available ''' not_found = [] for name in names: if '.' not in name: name = name + '.*' if not fnmatch.filter(list(__salt__), name): not_found.append(name)...
def modules_available(*names):
''' Returns a list of modules not available. Empty list if modules are all available ''' not_found = [] for name in names: if '.' not in name: name = name + '.*' if not fnmatch.filter(list(__salt__), name): not_found.append(name) return not_found
(docstring, dict) and not re.search(r'([E|e]xample(?:s)?)+(?:.*):?', docstring): noexample.add(fun) return {'missing_docstring': sorted(nodoc), 'missing_cli_example': sorted(noexample)} def modules_available(*names):
63
64
76
6
57
byteskeptical/salt
tests/integration/files/file/base/_modules/runtests_helpers.py
Python
modules_available
modules_available
123
133
123
123
7e955d0733f1d18ddfa11572aa5d78247ea94e83
bigcode/the-stack
train
e34ea4158b1c084698040f66
train
function
def get_salt_temp_dir(): return TMP
def get_salt_temp_dir():
return TMP
os.environ.get('TMPDIR', tempfile.gettempdir()) if not salt.utils.platform.is_darwin() else '/tmp' ) # This tempdir path is defined on tests.integration.__init__ TMP = os.path.join(SYS_TMP_DIR, 'salt-tests-tmpdir') def get_salt_temp_dir():
64
64
11
7
57
byteskeptical/salt
tests/integration/files/file/base/_modules/runtests_helpers.py
Python
get_salt_temp_dir
get_salt_temp_dir
35
36
35
35
f5701d8ce7bf04cc6ea232214d69bddaca72fb3c
bigcode/the-stack
train
71cf16cb1c43a91afc0ffac6
train
function
def fail_function(*args, **kwargs): # pylint: disable=unused-argument ''' Return False no matter what is passed to it ''' return False
def fail_function(*args, **kwargs): # pylint: disable=unused-argument
''' Return False no matter what is passed to it ''' return False
def nonzero_retcode_return_false(): ''' Sets a nonzero retcode before returning. Designed to test orchestration. ''' __context__['retcode'] = 1 return False def fail_function(*args, **kwargs): # pylint: disable=unused-argument
64
64
38
19
44
byteskeptical/salt
tests/integration/files/file/base/_modules/runtests_helpers.py
Python
fail_function
fail_function
152
156
152
152
d6a956785e1315faeb1063c672ad8d5e3ee2e2d0
bigcode/the-stack
train
5014cdc101cb0ad592b7143d
train
function
def nonzero_retcode_return_true(): ''' Sets a nonzero retcode before returning. Designed to test orchestration. ''' __context__['retcode'] = 1 return True
def nonzero_retcode_return_true():
''' Sets a nonzero retcode before returning. Designed to test orchestration. ''' __context__['retcode'] = 1 return True
modules are all available ''' not_found = [] for name in names: if '.' not in name: name = name + '.*' if not fnmatch.filter(list(__salt__), name): not_found.append(name) return not_found def nonzero_retcode_return_true():
64
64
44
8
55
byteskeptical/salt
tests/integration/files/file/base/_modules/runtests_helpers.py
Python
nonzero_retcode_return_true
nonzero_retcode_return_true
136
141
136
136
ce647c3de48e021c639fc5867a861ee2805e644b
bigcode/the-stack
train
8bd44ccd1adcb7c9d292e469
train
function
def get_invalid_docs(): ''' Outputs the functions which do not have valid CLI example, or are missing a docstring. ''' allow_failure = ( 'cmd.win_runas', 'cp.recv', 'cp.recv_chunked', 'glance.warn_until', 'ipset.long_range', 'libcloud_compute.get_drive...
def get_invalid_docs():
''' Outputs the functions which do not have valid CLI example, or are missing a docstring. ''' allow_failure = ( 'cmd.win_runas', 'cp.recv', 'cp.recv_chunked', 'glance.warn_until', 'ipset.long_range', 'libcloud_compute.get_driver', 'libcloud_dn...
on MacOS as they yield a base path too long # for unix sockets: ``error: AF_UNIX path too long`` # Gentoo Portage prefers ebuild tests are rooted in ${TMPDIR} os.environ.get('TMPDIR', tempfile.gettempdir()) if not salt.utils.platform.is_darwin() else '/tmp' ) # This tempdir path is defined on tests.integra...
165
165
550
5
160
byteskeptical/salt
tests/integration/files/file/base/_modules/runtests_helpers.py
Python
get_invalid_docs
get_invalid_docs
47
120
47
47
5ce5d528babe1acc8d68539389c6c445db9b6e60
bigcode/the-stack
train
fe78088a59720a04d0c5367b
train
function
def get_salt_temp_dir_for_path(*path): return os.path.join(TMP, *path)
def get_salt_temp_dir_for_path(*path):
return os.path.join(TMP, *path)
.utils.platform.is_darwin() else '/tmp' ) # This tempdir path is defined on tests.integration.__init__ TMP = os.path.join(SYS_TMP_DIR, 'salt-tests-tmpdir') def get_salt_temp_dir(): return TMP def get_salt_temp_dir_for_path(*path):
64
64
22
11
52
byteskeptical/salt
tests/integration/files/file/base/_modules/runtests_helpers.py
Python
get_salt_temp_dir_for_path
get_salt_temp_dir_for_path
39
40
39
39
9df855ffbf8685e27420486fc079d83e6ad02e3c
bigcode/the-stack
train
10b45b55fbde7e8f19b08d5e
train
function
def nonzero_retcode_return_false(): ''' Sets a nonzero retcode before returning. Designed to test orchestration. ''' __context__['retcode'] = 1 return False
def nonzero_retcode_return_false():
''' Sets a nonzero retcode before returning. Designed to test orchestration. ''' __context__['retcode'] = 1 return False
): not_found.append(name) return not_found def nonzero_retcode_return_true(): ''' Sets a nonzero retcode before returning. Designed to test orchestration. ''' __context__['retcode'] = 1 return True def nonzero_retcode_return_false():
64
64
44
8
55
byteskeptical/salt
tests/integration/files/file/base/_modules/runtests_helpers.py
Python
nonzero_retcode_return_false
nonzero_retcode_return_false
144
149
144
144
94d8f057422ab8e26e4f47b6ef12af10202d6f58
bigcode/the-stack
train
59b73b8ff15b965f81a40cd3
train
function
def get_python_executable(): ''' Return the path to the python executable. This is particularly important when running the test suite within a virtualenv, while trying to create virtualenvs on windows. ''' try: if salt.utils.is_windows(): python_binary = os.path.join(sys.rea...
def get_python_executable():
''' Return the path to the python executable. This is particularly important when running the test suite within a virtualenv, while trying to create virtualenvs on windows. ''' try: if salt.utils.is_windows(): python_binary = os.path.join(sys.real_prefix, os.path.basename(sy...
tration. ''' __context__['retcode'] = 1 return False def fail_function(*args, **kwargs): # pylint: disable=unused-argument ''' Return False no matter what is passed to it ''' return False def get_python_executable():
64
64
142
6
57
byteskeptical/salt
tests/integration/files/file/base/_modules/runtests_helpers.py
Python
get_python_executable
get_python_executable
159
176
159
159
8d2d91a0abb03432a04b2e1e274bcb869ef26aec
bigcode/the-stack
train
9b9ef70fb32b31e1b8b4a874
train
class
class ImportExportMutations(graphene.ObjectType): product_variant_export = ProductVariantExport.Field() product_variant_import = ProductVariantImport.Field() export_obj_delete = ExportObjDelete.Field() export_obj_bulk_delete = ExportObjBulkDelete.Field()
class ImportExportMutations(graphene.ObjectType):
product_variant_export = ProductVariantExport.Field() product_variant_import = ProductVariantImport.Field() export_obj_delete = ExportObjDelete.Field() export_obj_bulk_delete = ExportObjBulkDelete.Field()
info, id): return graphene.Node.get_node_from_global_id(info, id, ExportObjType) @staticmethod def resolve_export_obj_list(self, info, ids=None, **kwargs): return resolve_export_obj_list(info, ids, **kwargs) class ImportExportMutations(graphene.ObjectType):
64
64
52
10
54
vladkoblynsky/shop
stroylux/main/graphql/export_import/schema.py
Python
ImportExportMutations
ImportExportMutations
41
46
41
41
df3df2f418bf51fbfd54c74e5eda1a6875682a81
bigcode/the-stack
train
ddb446198e6dae654e668408
train
class
class ImportExportQueries: export_obj = graphene.Field( ExportObjType, id=graphene.Argument( graphene.ID, required=True, description="ID of the export obj." ), description="Look up a export obj by ID.", ) export_obj_list = FilterInputConnectionField( Expor...
class ImportExportQueries:
export_obj = graphene.Field( ExportObjType, id=graphene.Argument( graphene.ID, required=True, description="ID of the export obj." ), description="Look up a export obj by ID.", ) export_obj_list = FilterInputConnectionField( ExportObjType, filter=Ex...
ql.export_import.mutations import ProductVariantExport, \ ExportObjDelete, ProductVariantImport from main.graphql.export_import.resolvers import resolve_export_obj_list from main.graphql.export_import.sorters import ExportObjOrder from main.graphql.export_import.types import ExportObjType class ImportExportQueries:...
64
64
199
5
58
vladkoblynsky/shop
stroylux/main/graphql/export_import/schema.py
Python
ImportExportQueries
ImportExportQueries
13
38
13
13
28895758df344edff81d43178c5c471ca3386bd6
bigcode/the-stack
train
8b116e605c5061415655b100
train
class
@registry.register_problem class LanguagemodelPtbCharacters(LanguagemodelPtb10k): """PTB, character-level.""" @property def vocab_type(self): return text_problems.VocabType.CHARACTER
@registry.register_problem class LanguagemodelPtbCharacters(LanguagemodelPtb10k):
"""PTB, character-level.""" @property def vocab_type(self): return text_problems.VocabType.CHARACTER
as f: for line in f: line = " ".join(line.replace("\n", " %s " % EOS).split()) yield {"targets": line} return _generate_samples() @registry.register_problem class LanguagemodelPtbCharacters(LanguagemodelPtb10k):
64
64
52
22
42
spacegoing/t2t_caps
tensor2tensor/data_generators/ptb.py
Python
LanguagemodelPtbCharacters
LanguagemodelPtbCharacters
167
173
167
168
82e85b26777718a253ecbed1daff100051f343a4
bigcode/the-stack
train
2a019f769daa07c512bb14e9
train
function
def _build_vocab(filename, vocab_path, vocab_size): """Reads a file to build a vocabulary of `vocab_size` most common words. The vocabulary is sorted by occurrence count and has one word per line. Originally from: https://github.com/tensorflow/models/blob/master/tutorials/rnn/ptb/reader.py Args: file...
def _build_vocab(filename, vocab_path, vocab_size):
"""Reads a file to build a vocabulary of `vocab_size` most common words. The vocabulary is sorted by occurrence count and has one word per line. Originally from: https://github.com/tensorflow/models/blob/master/tutorials/rnn/ptb/reader.py Args: filename: file to read list of words from. vocab_pat...
[0] >= 3: return f.read().replace("\n", " %s " % EOS).split() else: return f.read().decode("utf-8").replace("\n", " %s " % EOS).split() def _build_vocab(filename, vocab_path, vocab_size):
64
64
188
12
52
spacegoing/t2t_caps
tensor2tensor/data_generators/ptb.py
Python
_build_vocab
_build_vocab
50
68
50
50
cf0df6ed4bca9aacc3b4fdb3978c5ecc81ec2127
bigcode/the-stack
train
402e960613c9e462121039fc
train
function
def _read_words(filename): """Reads words from a file.""" with tf.gfile.GFile(filename, "r") as f: if sys.version_info[0] >= 3: return f.read().replace("\n", " %s " % EOS).split() else: return f.read().decode("utf-8").replace("\n", " %s " % EOS).split()
def _read_words(filename):
"""Reads words from a file.""" with tf.gfile.GFile(filename, "r") as f: if sys.version_info[0] >= 3: return f.read().replace("\n", " %s " % EOS).split() else: return f.read().decode("utf-8").replace("\n", " %s " % EOS).split()
from tensor2tensor.data_generators import text_problems from tensor2tensor.utils import registry import tensorflow as tf EOS = text_encoder.EOS PTB_URL = "http://www.fit.vutbr.cz/~imikolov/rnnlm/simple-examples.tgz" def _read_words(filename):
64
64
86
6
58
spacegoing/t2t_caps
tensor2tensor/data_generators/ptb.py
Python
_read_words
_read_words
41
47
41
41
ef6d84f3f273729f220173f71894db391f3dffa7
bigcode/the-stack
train
ada62e1373debb5a51a613f2
train
class
@registry.register_problem class LanguagemodelPtb10k(text_problems.Text2SelfProblem): """PTB, 10k vocab.""" @property def dataset_splits(self): return [{ "split": problem.DatasetSplit.TRAIN, "shards": 10, }, { "split": problem.DatasetSplit.EVAL, "shards": 1, }] @pro...
@registry.register_problem class LanguagemodelPtb10k(text_problems.Text2SelfProblem):
"""PTB, 10k vocab.""" @property def dataset_splits(self): return [{ "split": problem.DatasetSplit.TRAIN, "shards": 10, }, { "split": problem.DatasetSplit.EVAL, "shards": 1, }] @property def is_generate_per_split(self): return True @property def vocab_file...
" in m.name: if "char" in m.name: ptb_char_files += [m.name] else: ptb_files += [m.name] files += [m] tgz.extractall(tmp_dir, members=files) if vocab_type == text_problems.VocabType.CHARACTER: return ptb_char_files else: return ptb_files @registry.register_p...
107
107
357
22
84
spacegoing/t2t_caps
tensor2tensor/data_generators/ptb.py
Python
LanguagemodelPtb10k
LanguagemodelPtb10k
114
164
114
115
548e6e8124c48b8c0190766fd6410ea51fe94cd1
bigcode/the-stack
train
219058a46fb3b20d12fbde82
train
function
def _get_token_encoder(vocab_dir, vocab_name, filename): """Reads from file and returns a `TokenTextEncoder` for the vocabulary.""" vocab_path = os.path.join(vocab_dir, vocab_name) if not tf.gfile.Exists(vocab_path): _build_vocab(filename, vocab_path, 10000) return text_encoder.TokenTextEncoder(vocab_path)
def _get_token_encoder(vocab_dir, vocab_name, filename):
"""Reads from file and returns a `TokenTextEncoder` for the vocabulary.""" vocab_path = os.path.join(vocab_dir, vocab_name) if not tf.gfile.Exists(vocab_path): _build_vocab(filename, vocab_path, 10000) return text_encoder.TokenTextEncoder(vocab_path)
x[1], x[0])) words, _ = list(zip(*count_pairs)) words = words[:vocab_size] with open(vocab_path, "w") as f: f.write("\n".join(words)) def _get_token_encoder(vocab_dir, vocab_name, filename):
64
64
80
14
50
spacegoing/t2t_caps
tensor2tensor/data_generators/ptb.py
Python
_get_token_encoder
_get_token_encoder
71
76
71
71
be5effa3ec532eafe926d41272918fdb49e941eb
bigcode/the-stack
train
d188a53a20443bd4d8e29bba
train
function
def _maybe_download_corpus(tmp_dir, vocab_type): """Download and unpack the corpus. Args: tmp_dir: directory containing dataset. vocab_type: which vocabulary are we using. Returns: The list of names of files. """ filename = os.path.basename(PTB_URL) compressed_filepath = generator_utils.maybe_...
def _maybe_download_corpus(tmp_dir, vocab_type):
"""Download and unpack the corpus. Args: tmp_dir: directory containing dataset. vocab_type: which vocabulary are we using. Returns: The list of names of files. """ filename = os.path.basename(PTB_URL) compressed_filepath = generator_utils.maybe_download( tmp_dir, filename, PTB_URL) ptb...
TokenTextEncoder` for the vocabulary.""" vocab_path = os.path.join(vocab_dir, vocab_name) if not tf.gfile.Exists(vocab_path): _build_vocab(filename, vocab_path, 10000) return text_encoder.TokenTextEncoder(vocab_path) def _maybe_download_corpus(tmp_dir, vocab_type):
69
69
233
12
57
spacegoing/t2t_caps
tensor2tensor/data_generators/ptb.py
Python
_maybe_download_corpus
_maybe_download_corpus
79
111
79
79
804ced9e04050817a9b151319a2ac6662a0da073
bigcode/the-stack
train
12c98d689968f82983dc536d
train
class
class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='PaymentMethod', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ...
class Migration(migrations.Migration):
initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='PaymentMethod', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('method', models.CharField(max_len...
# Generated by Django 2.1.4 on 2019-01-23 15:01 from django.db import migrations, models class Migration(migrations.Migration):
38
64
77
7
30
Nezale/Cloud_Warehouse_Project
payment_method/migrations/0001_initial.py
Python
Migration
Migration
6
21
6
7
1362c9ed93a8670a8c13959c586a94aba79582bb
bigcode/the-stack
train
552c2fbfb31f0d7d4a481297
train
class
class NonadaptiveGRU(nn.Module): def __init__(self, input_size, hidden_size, output_size, hard=False): super(NonadaptiveGRU, self).__init__() self.input_size = input_size self.hidden_size = hidden_size self.output_size = output_size self.hard = hard ...
class NonadaptiveGRU(nn.Module):
def __init__(self, input_size, hidden_size, output_size, hard=False): super(NonadaptiveGRU, self).__init__() self.input_size = input_size self.hidden_size = hidden_size self.output_size = output_size self.hard = hard use_gpu = torch.cuda.is_available...
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable class NonadaptiveGRU(nn.Module):
36
219
733
8
27
ardywibowo/vfds
HAR/NonadaptiveConcreteGRU.py
Python
NonadaptiveGRU
NonadaptiveGRU
7
96
7
7
3277f71d8245911d9cf0122c5cbbe3d8cafb15ea
bigcode/the-stack
train
4dcd936e3234d20757d5624e
train
class
class ProductFeedSchedule( AbstractCrudObject, ): def __init__(self, fbid=None, parent_id=None, api=None): self._isProductFeedSchedule = True super(ProductFeedSchedule, self).__init__(fbid, parent_id, api) class Field(AbstractObject.Field): day_of_month = 'day_of_month' day...
class ProductFeedSchedule( AbstractCrudObject, ):
def __init__(self, fbid=None, parent_id=None, api=None): self._isProductFeedSchedule = True super(ProductFeedSchedule, self).__init__(fbid, parent_id, api) class Field(AbstractObject.Field): day_of_month = 'day_of_month' day_of_week = 'day_of_week' hour = 'hour' ...
A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. from face...
177
177
591
11
166
s-nez/facebook-python-business-sdk
facebook_business/adobjects/productfeedschedule.py
Python
ProductFeedSchedule
ProductFeedSchedule
35
117
35
38
680d5d9ed8a7878a8e4fc34eeb859e040ea62594
bigcode/the-stack
train
d337ed00d7f4730af4b7daf1
train
class
class Video(Media): """A video object. :param str source: The fully qualified path to the video file. """ __name__ = 'Video' #: Valid extensions for video files. extensions = ('avi', 'm4v', 'mov', 'mp4', 'mpg', 'mpeg', '3gp', 'mts') def __init__(self, source=None): super(Video, ...
class Video(Media):
"""A video object. :param str source: The fully qualified path to the video file. """ __name__ = 'Video' #: Valid extensions for video files. extensions = ('avi', 'm4v', 'mov', 'mp4', 'mpg', 'mpeg', '3gp', 'mts') def __init__(self, source=None): super(Video, self).__init__(source...
""" The video module contains the :class:`Video` class, which represents video objects (AVI, MOV, etc.). .. moduleauthor:: Jaisen Mathai <jaisen@jmathai.com> """ from __future__ import print_function from __future__ import absolute_import from __future__ import division # load modules from datetime import datetime i...
94
203
678
4
89
dirextric/elodie
elodie/media/video.py
Python
Video
Video
21
103
21
22
8ca73cbcf47fab622be4f7b690d28418bcde2963
bigcode/the-stack
train
1a60898c0d645cfc80dc8097
train
function
def get_heat_value(pose_coord, heatmap): _, h, w = heatmap.shape heatmap_nocenter = heatmap[:-1].flatten(1,2).transpose(0,1) y_b = torch.clamp(torch.floor(pose_coord[:,:,1]), 0, h-1).long() x_l = torch.clamp(torch.floor(pose_coord[:,:,0]), 0, w-1).long() heatval = torch.gather(heatmap_nocenter, 0, ...
def get_heat_value(pose_coord, heatmap):
_, h, w = heatmap.shape heatmap_nocenter = heatmap[:-1].flatten(1,2).transpose(0,1) y_b = torch.clamp(torch.floor(pose_coord[:,:,1]), 0, h-1).long() x_l = torch.clamp(torch.floor(pose_coord[:,:,0]), 0, w-1).long() heatval = torch.gather(heatmap_nocenter, 0, y_b * w + x_l).unsqueeze(-1) return h...
@mail.ustc.edu.cn). # Modified by Zigang Geng (zigang@mail.ustc.edu.cn). # ------------------------------------------------------------------------------ from __future__ import absolute_import from __future__ import division from __future__ import print_function import torch def get_heat_value(pose_coord, heatmap):
64
64
128
11
52
jenhaoyang/DEKR
lib/core/nms.py
Python
get_heat_value
get_heat_value
15
22
15
15
337079dee94b6097ce2dace9c2002a86ea9324c1
bigcode/the-stack
train
07227e9185e34ad48af010ec
train
function
def pose_nms(cfg, heatmap_avg, poses): """ NMS for the regressed poses results. Args: heatmap_avg (Tensor): Avg of the heatmaps at all scales (1, 1+num_joints, w, h) poses (List): Gather of the pose proposals [(num_people, num_joints, 3)] """ scale1_index = sorted(cfg.TEST.SCALE_FAC...
def pose_nms(cfg, heatmap_avg, poses):
""" NMS for the regressed poses results. Args: heatmap_avg (Tensor): Avg of the heatmaps at all scales (1, 1+num_joints, w, h) poses (List): Gather of the pose proposals [(num_people, num_joints, 3)] """ scale1_index = sorted(cfg.TEST.SCALE_FACTOR, reverse=True).index(1.0) pose_...
in range(nms_pose.shape[0]): if i in ignored_pose_inds: continue keep_inds = nms_pose[i].nonzero().cpu().numpy() keep_inds = [list(kind)[0] for kind in keep_inds] keep_scores = heat_score[keep_inds] ind = torch.argmax(keep_scores) keep_ind = keep_inds[ind] ...
135
135
450
12
122
jenhaoyang/DEKR
lib/core/nms.py
Python
pose_nms
pose_nms
62
104
62
62
d04a9db6f39ae26dc191497351f6462b07ca686f
bigcode/the-stack
train
fb816c368c4826ee63273e9c
train
function
def nms_core(cfg, pose_coord, heat_score): num_people, num_joints, _ = pose_coord.shape pose_area = cal_area_2_torch(pose_coord)[:,None].repeat(1,num_people*num_joints) pose_area = pose_area.reshape(num_people,num_people,num_joints) pose_diff = pose_coord[:, None, :, :] - pose_coord pose_diff.p...
def nms_core(cfg, pose_coord, heat_score):
num_people, num_joints, _ = pose_coord.shape pose_area = cal_area_2_torch(pose_coord)[:,None].repeat(1,num_people*num_joints) pose_area = pose_area.reshape(num_people,num_people,num_joints) pose_diff = pose_coord[:, None, :, :] - pose_coord pose_diff.pow_(2) pose_dist = pose_diff.sum(3) ...
_2_torch(v): w = torch.max(v[:, :, 0], -1)[0] - torch.min(v[:, :, 0], -1)[0] h = torch.max(v[:, :, 1], -1)[0] - torch.min(v[:, :, 1], -1)[0] return w * w + h * h def nms_core(cfg, pose_coord, heat_score):
88
88
294
12
75
jenhaoyang/DEKR
lib/core/nms.py
Python
nms_core
nms_core
31
59
31
31
9df983f056b508eb612bd334ef400b946652e790
bigcode/the-stack
train
49f7c17b294db893fa744b62
train
function
def cal_area_2_torch(v): w = torch.max(v[:, :, 0], -1)[0] - torch.min(v[:, :, 0], -1)[0] h = torch.max(v[:, :, 1], -1)[0] - torch.min(v[:, :, 1], -1)[0] return w * w + h * h
def cal_area_2_torch(v):
w = torch.max(v[:, :, 0], -1)[0] - torch.min(v[:, :, 0], -1)[0] h = torch.max(v[:, :, 1], -1)[0] - torch.min(v[:, :, 1], -1)[0] return w * w + h * h
torch.clamp(torch.floor(pose_coord[:,:,0]), 0, w-1).long() heatval = torch.gather(heatmap_nocenter, 0, y_b * w + x_l).unsqueeze(-1) return heatval def cal_area_2_torch(v):
64
64
79
9
54
jenhaoyang/DEKR
lib/core/nms.py
Python
cal_area_2_torch
cal_area_2_torch
25
28
25
25
f6e72a6ae8c978b6258c1df2c196dac3612041d5
bigcode/the-stack
train
af3fe6ce4cc402cf93f60f52
train
class
class EmailSheriffTest(testing_common.TestCase): def _AddTestToStubDataStore(self): """Adds a test which will be used in the methods below.""" bug_label_patterns.AddBugLabelPattern('label1', '*/*/dromaeo/dom') bug_label_patterns.AddBugLabelPattern('label2', '*/*/other/test') testing_common.AddTests( ...
class EmailSheriffTest(testing_common.TestCase):
def _AddTestToStubDataStore(self): """Adds a test which will be used in the methods below.""" bug_label_patterns.AddBugLabelPattern('label1', '*/*/dromaeo/dom') bug_label_patterns.AddBugLabelPattern('label2', '*/*/other/test') testing_common.AddTests( ['ChromiumPerf'], ['Win7'], {'dromaeo': {'...
# Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import sys import unittest import urllib import mock from google.appengine.ext import ndb from dashboard import email_sheriff from dashboard import testin...
146
256
1,354
11
135
maidiHaitai/haitaibrowser
third_party/catapult/dashboard/dashboard/email_sheriff_test.py
Python
EmailSheriffTest
EmailSheriffTest
24
142
24
25
f160a5cd178962a2c54b9b6aa6cc809161b8df93
bigcode/the-stack
train
10654122598e2550e8e9a93c
train
function
def getWakeInfo(hoodId = None, zoneId = None): wakeWaterHeight = 0 showWake = 0 try: if hoodId is None: hoodId = base.cr.playGame.getPlaceId() if zoneId is None: zoneId = base.cr.playGame.getPlace().getZoneId() canonicalZoneId = getCanonicalZoneId(zoneId) ...
def getWakeInfo(hoodId = None, zoneId = None):
wakeWaterHeight = 0 showWake = 0 try: if hoodId is None: hoodId = base.cr.playGame.getPlaceId() if zoneId is None: zoneId = base.cr.playGame.getPlace().getZoneId() canonicalZoneId = getCanonicalZoneId(zoneId) if canonicalZoneId == DonaldsDock: ...
tutorialDict is already set!') tutorialDict = {'branch': branch, 'exteriors': exteriorList, 'interiors': interiorList} def overrideOff(): global tutorialDict tutorialDict = None return def getWakeInfo(hoodId = None, zoneId = None):
64
64
211
15
48
TheFamiliarScoot/open-toontown
toontown/hood/ZoneUtil.py
Python
getWakeInfo
getWakeInfo
215
239
215
215
6d61f052a9be85ea2cf7f8c7eb823a6b2557e0a5
bigcode/the-stack
train
1d230ab26014fa2720d0f5cd
train
function
def getToonWhereName(zoneId): where = getWhereName(zoneId, 1) return where
def getToonWhereName(zoneId):
where = getWhereName(zoneId, 1) return where
loaderName = 'townLoader' return loaderName def getBranchLoaderName(zoneId): return getLoaderName(getBranchZone(zoneId)) def getSuitWhereName(zoneId): where = getWhereName(zoneId, 0) return where def getToonWhereName(zoneId):
64
64
25
9
54
TheFamiliarScoot/open-toontown
toontown/hood/ZoneUtil.py
Python
getToonWhereName
getToonWhereName
58
60
58
58
cca4185498e92ab6170971d27ddb2a12a938d6cf
bigcode/the-stack
train
95465569d5ab482e4edfcbc8
train
function
def getCanonicalZoneId(zoneId): if zoneId == WelcomeValleyToken: zoneId = ToontownCentral elif zoneId >= WelcomeValleyBegin and zoneId < WelcomeValleyEnd: zoneId = zoneId % 2000 if zoneId < 1000: zoneId = zoneId + ToontownCentral else: zoneId = zoneId - 10...
def getCanonicalZoneId(zoneId):
if zoneId == WelcomeValleyToken: zoneId = ToontownCentral elif zoneId >= WelcomeValleyBegin and zoneId < WelcomeValleyEnd: zoneId = zoneId % 2000 if zoneId < 1000: zoneId = zoneId + ToontownCentral else: zoneId = zoneId - 1000 + GoofySpeedway return zo...
Id def getCanonicalBranchZone(zoneId): return getBranchZone(getCanonicalZoneId(zoneId)) def isWelcomeValley(zoneId): return zoneId == WelcomeValleyToken or zoneId >= WelcomeValleyBegin and zoneId < WelcomeValleyEnd def getCanonicalZoneId(zoneId):
64
64
101
8
55
TheFamiliarScoot/open-toontown
toontown/hood/ZoneUtil.py
Python
getCanonicalZoneId
getCanonicalZoneId
141
150
141
141
1d88f1c8e0b429f4722c4b445666c4c155941354
bigcode/the-stack
train
3f898a509f02acffc7ef99c5
train
function
def getCanonicalHoodId(zoneId): return getHoodId(getCanonicalZoneId(zoneId))
def getCanonicalHoodId(zoneId):
return getHoodId(getCanonicalZoneId(zoneId))
1000 return hoodId def getSafeZoneId(zoneId): hoodId = getHoodId(zoneId) if hoodId in HQToSafezone: hoodId = HQToSafezone[hoodId] return hoodId def getCanonicalHoodId(zoneId):
64
64
22
9
54
TheFamiliarScoot/open-toontown
toontown/hood/ZoneUtil.py
Python
getCanonicalHoodId
getCanonicalHoodId
181
182
181
181
0225742986b89e204ca706c85e9cb85f933d571d
bigcode/the-stack
train
275c4cf1390b7d5de7776383
train
function
def getSafeZoneId(zoneId): hoodId = getHoodId(zoneId) if hoodId in HQToSafezone: hoodId = HQToSafezone[hoodId] return hoodId
def getSafeZoneId(zoneId):
hoodId = getHoodId(zoneId) if hoodId in HQToSafezone: hoodId = HQToSafezone[hoodId] return hoodId
ofySpeedway + offset + 1000 return zoneId def getHoodId(zoneId): if tutorialDict: hoodId = Tutorial else: hoodId = zoneId - zoneId % 1000 return hoodId def getSafeZoneId(zoneId):
64
64
46
8
55
TheFamiliarScoot/open-toontown
toontown/hood/ZoneUtil.py
Python
getSafeZoneId
getSafeZoneId
174
178
174
174
4bf2f3dc0b8463787e0ee8a8bf8ceb82c0d0434d
bigcode/the-stack
train
67a482ec5bb80d8a964a1ca3
train
function
def isPetshop(zoneId): if zoneId == 2522 or zoneId == 1510 or zoneId == 3511 or zoneId == 4508 or zoneId == 5505 or zoneId == 9508: return True return False
def isPetshop(zoneId):
if zoneId == 2522 or zoneId == 1510 or zoneId == 3511 or zoneId == 4508 or zoneId == 5505 or zoneId == 9508: return True return False
def isPlayground(zoneId): whereName = getWhereName(zoneId, False) if whereName == 'cogHQExterior': return True else: return zoneId % 1000 == 0 and zoneId < DynamicZonesBegin def isPetshop(zoneId):
64
64
59
7
56
TheFamiliarScoot/open-toontown
toontown/hood/ZoneUtil.py
Python
isPetshop
isPetshop
71
74
71
71
463d3a9c2cfab76f0c2ba8cf38b906da72d1ed27
bigcode/the-stack
train
702a826c6c776b71f90abe81
train
function
def isPlayground(zoneId): whereName = getWhereName(zoneId, False) if whereName == 'cogHQExterior': return True else: return zoneId % 1000 == 0 and zoneId < DynamicZonesBegin
def isPlayground(zoneId):
whereName = getWhereName(zoneId, False) if whereName == 'cogHQExterior': return True else: return zoneId % 1000 == 0 and zoneId < DynamicZonesBegin
LoaderName(getBranchZone(zoneId)) def getSuitWhereName(zoneId): where = getWhereName(zoneId, 0) return where def getToonWhereName(zoneId): where = getWhereName(zoneId, 1) return where def isPlayground(zoneId):
64
64
56
7
56
TheFamiliarScoot/open-toontown
toontown/hood/ZoneUtil.py
Python
isPlayground
isPlayground
63
68
63
63
dea7b97631713ee67c9aa17fad25114d3163b508
bigcode/the-stack
train
966fcf0aa2cf95a6f12774d4
train
function
def getSuitWhereName(zoneId): where = getWhereName(zoneId, 0) return where
def getSuitWhereName(zoneId):
where = getWhereName(zoneId, 0) return where
ogHQLoader' elif suffix < 100: loaderName = 'safeZoneLoader' else: loaderName = 'townLoader' return loaderName def getBranchLoaderName(zoneId): return getLoaderName(getBranchZone(zoneId)) def getSuitWhereName(zoneId):
64
64
24
8
56
TheFamiliarScoot/open-toontown
toontown/hood/ZoneUtil.py
Python
getSuitWhereName
getSuitWhereName
53
55
53
53
f6e12213bd21fd55fe33f2a4bc966d3143833757
bigcode/the-stack
train
a515b4e054caf57e33175d68
train
function
def getTrueZoneId(zoneId, currentZoneId): if zoneId >= WelcomeValleyBegin and zoneId < WelcomeValleyEnd or zoneId == WelcomeValleyToken: zoneId = getCanonicalZoneId(zoneId) if currentZoneId >= WelcomeValleyBegin and currentZoneId < WelcomeValleyEnd: hoodId = getHoodId(zoneId) offset = cu...
def getTrueZoneId(zoneId, currentZoneId):
if zoneId >= WelcomeValleyBegin and zoneId < WelcomeValleyEnd or zoneId == WelcomeValleyToken: zoneId = getCanonicalZoneId(zoneId) if currentZoneId >= WelcomeValleyBegin and currentZoneId < WelcomeValleyEnd: hoodId = getHoodId(zoneId) offset = currentZoneId - currentZoneId % 2000 ...
zoneId % 2000 if zoneId < 1000: zoneId = zoneId + ToontownCentral else: zoneId = zoneId - 1000 + GoofySpeedway return zoneId def getTrueZoneId(zoneId, currentZoneId):
64
64
148
12
51
TheFamiliarScoot/open-toontown
toontown/hood/ZoneUtil.py
Python
getTrueZoneId
getTrueZoneId
153
163
153
153
b9d70b38e530e4ce7cd84013acf006983f3f3617
bigcode/the-stack
train
8ccb7d2ca374b5a37a3a1428
train
function
def getCanonicalSafeZoneId(zoneId): return getSafeZoneId(getCanonicalZoneId(zoneId))
def getCanonicalSafeZoneId(zoneId):
return getSafeZoneId(getCanonicalZoneId(zoneId))
HoodId(zoneId) if hoodId in HQToSafezone: hoodId = HQToSafezone[hoodId] return hoodId def getCanonicalHoodId(zoneId): return getHoodId(getCanonicalZoneId(zoneId)) def getCanonicalSafeZoneId(zoneId):
64
64
22
9
55
TheFamiliarScoot/open-toontown
toontown/hood/ZoneUtil.py
Python
getCanonicalSafeZoneId
getCanonicalSafeZoneId
185
186
185
185
98696c9adec98d771f1c885b53bc44651b173cc4
bigcode/the-stack
train
af4adaefc2243332330185f0
train
function
def getBranchZone(zoneId): if tutorialDict: branchId = tutorialDict['branch'] else: branchId = zoneId - zoneId % 100 if not isCogHQZone(zoneId): if zoneId % 1000 >= 500: branchId -= 500 return branchId
def getBranchZone(zoneId):
if tutorialDict: branchId = tutorialDict['branch'] else: branchId = zoneId - zoneId % 100 if not isCogHQZone(zoneId): if zoneId % 1000 >= 500: branchId -= 500 return branchId
elif suffix == 0: where = 'playground' elif suffix >= 500: if isToon: where = 'toonInterior' else: where = 'suitInterior' else: where = 'street' return where def getBranchZone(zoneId):
64
64
71
7
56
TheFamiliarScoot/open-toontown
toontown/hood/ZoneUtil.py
Python
getBranchZone
getBranchZone
122
130
122
122
598608c1d694a91d9471e2863ad3cb962c10c1d5
bigcode/the-stack
train
738ab25fe44f013bb9abdb94
train
function
def isGoofySpeedwayZone(zoneId): return zoneId == 8000
def isGoofySpeedwayZone(zoneId):
return zoneId == 8000
from toontown.toonbase.ToontownGlobals import * from direct.directnotify import DirectNotifyGlobal zoneUtilNotify = DirectNotifyGlobal.directNotify.newCategory('ZoneUtil') tutorialDict = None def isGoofySpeedwayZone(zoneId):
51
64
19
10
40
TheFamiliarScoot/open-toontown
toontown/hood/ZoneUtil.py
Python
isGoofySpeedwayZone
isGoofySpeedwayZone
6
7
6
6
1266c3c1049925b09f77cb6199b42f2dc460ae3e
bigcode/the-stack
train
a1cf653e523bebf5bf88de85
train
function
def getLoaderName(zoneId): if tutorialDict: if zoneId == ToontownCentral: loaderName = 'safeZoneLoader' else: loaderName = 'townLoader' else: suffix = zoneId % 1000 if suffix >= 500: suffix -= 500 if isCogHQZone(zoneId): loa...
def getLoaderName(zoneId):
if tutorialDict: if zoneId == ToontownCentral: loaderName = 'safeZoneLoader' else: loaderName = 'townLoader' else: suffix = zoneId % 1000 if suffix >= 500: suffix -= 500 if isCogHQZone(zoneId): loaderName = 'cogHQLoader' ...
): return zoneId >= DynamicZonesBegin and zoneId < DynamicZonesEnd def getStreetName(branchId): global tutorialDict if tutorialDict: return StreetNames[20000][-1] else: return StreetNames[branchId][-1] def getLoaderName(zoneId):
64
64
120
7
57
TheFamiliarScoot/open-toontown
toontown/hood/ZoneUtil.py
Python
getLoaderName
getLoaderName
30
46
30
30
30fc92892b09aa34306155c8eac979d154143b60
bigcode/the-stack
train
ef5567fded13b3364fab1c1b
train
function
def isMintInteriorZone(zoneId): return zoneId in (CashbotMintIntA, CashbotMintIntB, CashbotMintIntC)
def isMintInteriorZone(zoneId):
return zoneId in (CashbotMintIntA, CashbotMintIntB, CashbotMintIntC)
.directNotify.newCategory('ZoneUtil') tutorialDict = None def isGoofySpeedwayZone(zoneId): return zoneId == 8000 def isCogHQZone(zoneId): return zoneId >= 10000 and zoneId < 15000 def isMintInteriorZone(zoneId):
64
64
32
8
55
TheFamiliarScoot/open-toontown
toontown/hood/ZoneUtil.py
Python
isMintInteriorZone
isMintInteriorZone
14
15
14
14
2968af9791e46e45bbafe76f87ce620f7a69141e
bigcode/the-stack
train
97a5fd9a7fca1c7f4bb4e6ec
train
function
def isWelcomeValley(zoneId): return zoneId == WelcomeValleyToken or zoneId >= WelcomeValleyBegin and zoneId < WelcomeValleyEnd
def isWelcomeValley(zoneId):
return zoneId == WelcomeValleyToken or zoneId >= WelcomeValleyBegin and zoneId < WelcomeValleyEnd
100 if not isCogHQZone(zoneId): if zoneId % 1000 >= 500: branchId -= 500 return branchId def getCanonicalBranchZone(zoneId): return getBranchZone(getCanonicalZoneId(zoneId)) def isWelcomeValley(zoneId):
64
64
34
8
56
TheFamiliarScoot/open-toontown
toontown/hood/ZoneUtil.py
Python
isWelcomeValley
isWelcomeValley
137
138
137
137
75271dd1eb4bb09eb668aa9a0effa7bebb3e4098
bigcode/the-stack
train
1308996e427332d4269fd266
train
function
def overrideOn(branch, exteriorList, interiorList): global tutorialDict if tutorialDict: zoneUtilNotify.warning('setTutorialDict: tutorialDict is already set!') tutorialDict = {'branch': branch, 'exteriors': exteriorList, 'interiors': interiorList}
def overrideOn(branch, exteriorList, interiorList):
global tutorialDict if tutorialDict: zoneUtilNotify.warning('setTutorialDict: tutorialDict is already set!') tutorialDict = {'branch': branch, 'exteriors': exteriorList, 'interiors': interiorList}
Id): if tutorialDict: if zoneId in tutorialDict['interiors']: r = 1 else: r = 0 else: r = zoneId % 1000 >= 500 return r def overrideOn(branch, exteriorList, interiorList):
64
64
62
11
52
TheFamiliarScoot/open-toontown
toontown/hood/ZoneUtil.py
Python
overrideOn
overrideOn
200
206
200
200
a3f1834bc312579fd7fd78c4a4325410e53729ac
bigcode/the-stack
train
6be11750a394b76e922c68f8
train
function
def getHoodId(zoneId): if tutorialDict: hoodId = Tutorial else: hoodId = zoneId - zoneId % 1000 return hoodId
def getHoodId(zoneId):
if tutorialDict: hoodId = Tutorial else: hoodId = zoneId - zoneId % 1000 return hoodId
2000 if hoodId == ToontownCentral: return zoneId - ToontownCentral + offset elif hoodId == GoofySpeedway: return zoneId - GoofySpeedway + offset + 1000 return zoneId def getHoodId(zoneId):
64
64
41
8
55
TheFamiliarScoot/open-toontown
toontown/hood/ZoneUtil.py
Python
getHoodId
getHoodId
166
171
166
166
fdbd86305ae5d1887de30a8a2cff1e2b2fe4bf34
bigcode/the-stack
train
52c76392deed0706533a1299
train
function
def isCogHQZone(zoneId): return zoneId >= 10000 and zoneId < 15000
def isCogHQZone(zoneId):
return zoneId >= 10000 and zoneId < 15000
onbase.ToontownGlobals import * from direct.directnotify import DirectNotifyGlobal zoneUtilNotify = DirectNotifyGlobal.directNotify.newCategory('ZoneUtil') tutorialDict = None def isGoofySpeedwayZone(zoneId): return zoneId == 8000 def isCogHQZone(zoneId):
64
64
24
8
55
TheFamiliarScoot/open-toontown
toontown/hood/ZoneUtil.py
Python
isCogHQZone
isCogHQZone
10
11
10
10
37bf231f2e88e4b3be2c3f6cec641d6f7c352435
bigcode/the-stack
train
48f4297e4ad226e8ca38769e
train
function
def getWhereName(zoneId, isToon): if tutorialDict: if zoneId in tutorialDict['interiors']: where = 'toonInterior' elif zoneId in tutorialDict['exteriors']: where = 'street' elif zoneId == ToontownCentral or zoneId == WelcomeValleyToken: where = 'playground...
def getWhereName(zoneId, isToon):
if tutorialDict: if zoneId in tutorialDict['interiors']: where = 'toonInterior' elif zoneId in tutorialDict['exteriors']: where = 'street' elif zoneId == ToontownCentral or zoneId == WelcomeValleyToken: where = 'playground' else: zoneUt...
whereName = getWhereName(zoneId, False) if whereName == 'cogHQExterior': return True else: return zoneId % 1000 == 0 and zoneId < DynamicZonesBegin def isPetshop(zoneId): if zoneId == 2522 or zoneId == 1510 or zoneId == 3511 or zoneId == 4508 or zoneId == 5505 or zoneId == 9508: r...
118
118
395
11
106
TheFamiliarScoot/open-toontown
toontown/hood/ZoneUtil.py
Python
getWhereName
getWhereName
77
119
77
77
6d99dda3e2d9b61a9715476e7e6f35582c924bd2
bigcode/the-stack
train
71d55caafc8d7c692a7a9bbb
train
function
def isDynamicZone(zoneId): return zoneId >= DynamicZonesBegin and zoneId < DynamicZonesEnd
def isDynamicZone(zoneId):
return zoneId >= DynamicZonesBegin and zoneId < DynamicZonesEnd
def isCogHQZone(zoneId): return zoneId >= 10000 and zoneId < 15000 def isMintInteriorZone(zoneId): return zoneId in (CashbotMintIntA, CashbotMintIntB, CashbotMintIntC) def isDynamicZone(zoneId):
64
64
23
7
57
TheFamiliarScoot/open-toontown
toontown/hood/ZoneUtil.py
Python
isDynamicZone
isDynamicZone
18
19
18
18
ba268cbb2e9849c53ef0511fe88fd1576844607d
bigcode/the-stack
train
d128a82a1dccb218dfcf20ec
train
function
def getStreetName(branchId): global tutorialDict if tutorialDict: return StreetNames[20000][-1] else: return StreetNames[branchId][-1]
def getStreetName(branchId):
global tutorialDict if tutorialDict: return StreetNames[20000][-1] else: return StreetNames[branchId][-1]
00 def isMintInteriorZone(zoneId): return zoneId in (CashbotMintIntA, CashbotMintIntB, CashbotMintIntC) def isDynamicZone(zoneId): return zoneId >= DynamicZonesBegin and zoneId < DynamicZonesEnd def getStreetName(branchId):
64
64
40
7
56
TheFamiliarScoot/open-toontown
toontown/hood/ZoneUtil.py
Python
getStreetName
getStreetName
22
27
22
22
0bb104f854b15a812be6b2784a4cfe897b7abb0e
bigcode/the-stack
train
6e30c8016e7f9c511eea708d
train
function
def isInterior(zoneId): if tutorialDict: if zoneId in tutorialDict['interiors']: r = 1 else: r = 0 else: r = zoneId % 1000 >= 500 return r
def isInterior(zoneId):
if tutorialDict: if zoneId in tutorialDict['interiors']: r = 1 else: r = 0 else: r = zoneId % 1000 >= 500 return r
= HQToSafezone[hoodId] return hoodId def getCanonicalHoodId(zoneId): return getHoodId(getCanonicalZoneId(zoneId)) def getCanonicalSafeZoneId(zoneId): return getSafeZoneId(getCanonicalZoneId(zoneId)) def isInterior(zoneId):
64
64
57
6
58
TheFamiliarScoot/open-toontown
toontown/hood/ZoneUtil.py
Python
isInterior
isInterior
189
197
189
189
7638394f815099de8d1ee64a9502e357fdd6e030
bigcode/the-stack
train
5bab8b19311644e97375a129
train
function
def overrideOff(): global tutorialDict tutorialDict = None return
def overrideOff():
global tutorialDict tutorialDict = None return
On(branch, exteriorList, interiorList): global tutorialDict if tutorialDict: zoneUtilNotify.warning('setTutorialDict: tutorialDict is already set!') tutorialDict = {'branch': branch, 'exteriors': exteriorList, 'interiors': interiorList} def overrideOff():
64
64
18
4
60
TheFamiliarScoot/open-toontown
toontown/hood/ZoneUtil.py
Python
overrideOff
overrideOff
209
212
209
209
c15963f4c766c80651e044274cdca89415a7abe7
bigcode/the-stack
train
eb3b3add750d3cbdf4b2be17
train
function
def getCanonicalBranchZone(zoneId): return getBranchZone(getCanonicalZoneId(zoneId))
def getCanonicalBranchZone(zoneId):
return getBranchZone(getCanonicalZoneId(zoneId))
= tutorialDict['branch'] else: branchId = zoneId - zoneId % 100 if not isCogHQZone(zoneId): if zoneId % 1000 >= 500: branchId -= 500 return branchId def getCanonicalBranchZone(zoneId):
64
64
20
8
55
TheFamiliarScoot/open-toontown
toontown/hood/ZoneUtil.py
Python
getCanonicalBranchZone
getCanonicalBranchZone
133
134
133
133
38d695344dbdc823aff98d7102042b523681af9e
bigcode/the-stack
train
812aca255fd125a277dddbb8
train
function
def getBranchLoaderName(zoneId): return getLoaderName(getBranchZone(zoneId))
def getBranchLoaderName(zoneId):
return getLoaderName(getBranchZone(zoneId))
-= 500 if isCogHQZone(zoneId): loaderName = 'cogHQLoader' elif suffix < 100: loaderName = 'safeZoneLoader' else: loaderName = 'townLoader' return loaderName def getBranchLoaderName(zoneId):
64
64
19
8
55
TheFamiliarScoot/open-toontown
toontown/hood/ZoneUtil.py
Python
getBranchLoaderName
getBranchLoaderName
49
50
49
49
fd90c522f43a4bece430d1881770b87e93585a85
bigcode/the-stack
train
1532e6893592889a8afc7fb9
train
class
class Kalman: meas=[] # save measured values pred=[] # save predicted values kalman = None # actual OpenCV Kalman filter lastPred = None lastCorr = None stuck = False # TODO: might not be needed averageValue = (0,0) averageVelocity = (0,0) def __init__(self,point,q=0.03,r=0.00003): ...
class Kalman:
meas=[] # save measured values pred=[] # save predicted values kalman = None # actual OpenCV Kalman filter lastPred = None lastCorr = None stuck = False # TODO: might not be needed averageValue = (0,0) averageVelocity = (0,0) def __init__(self,point,q=0.03,r=0.00003): self.ka...
# -*- coding: utf-8 -*- """ Created on Sun Mar 20 14:02:51 2016 @author: mmorel, haiming, Colin Eason """ import numpy as np import cv2 import copy import math # Wrapper class for an OpenCV 2 measurement Kalman filter that provides some # history about predictions and measurements class Kalman:
82
256
894
4
77
ColinAE/Computer-Vision-Classifier
kalman.py
Python
Kalman
Kalman
15
106
15
15
2bfad57ab5868536e32430d1d547710c60d6755b
bigcode/the-stack
train
1dda6340825c1fba1a73cee7
train
function
def _entity_corresponds_to(given, entity): """determine if 'given' corresponds to 'entity', in terms of an entity passed to Query that would match the same entity being referred to elsewhere in the query. """ if entity.is_aliased_class: if given.is_aliased_class: if entity._base...
def _entity_corresponds_to(given, entity):
"""determine if 'given' corresponds to 'entity', in terms of an entity passed to Query that would match the same entity being referred to elsewhere in the query. """ if entity.is_aliased_class: if given.is_aliased_class: if entity._base_alias() is given._base_alias(): ...
a session flush. This is regardless of whether or not the object is persistent or detached. .. seealso:: :attr:`.InstanceState.was_deleted` """ state = attributes.instance_state(object_) return state.was_deleted def _entity_corresponds_to(given, entity):
64
64
138
12
51
vyonna6519/pitches
virtual/lib/python3.8/site-packages/sqlalchemy/orm/util.py
Python
_entity_corresponds_to
_entity_corresponds_to
1,949
1,966
1,949
1,949
a12f97883e7290726090b2d71d1afa20c641b417
bigcode/the-stack
train
083c28ae9c7e797ed0a586e7
train
class
class LoaderCriteriaOption(CriteriaOption): """Add additional WHERE criteria to the load for all occurrences of a particular entity. :class:`_orm.LoaderCriteriaOption` is invoked using the :func:`_orm.with_loader_criteria` function; see that function for details. .. versionadded:: 1.4 """...
class LoaderCriteriaOption(CriteriaOption):
"""Add additional WHERE criteria to the load for all occurrences of a particular entity. :class:`_orm.LoaderCriteriaOption` is invoked using the :func:`_orm.with_loader_criteria` function; see that function for details. .. versionadded:: 1.4 """ _traverse_internals = [ ("root...
[%s])" % ( self._target.__name__, ", ".join( mp.class_.__name__ for mp in self.with_polymorphic_mappers if mp is not self.mapper ), ) else: return "aliased(%s)" % (self._target.__...
256
256
2,503
8
248
vyonna6519/pitches
virtual/lib/python3.8/site-packages/sqlalchemy/orm/util.py
Python
LoaderCriteriaOption
LoaderCriteriaOption
924
1,212
924
924
f8b446b64e7204ae00d37a047a593094eef45193
bigcode/the-stack
train
16f0998586abba6bbcb68ddd
train
function
def has_identity(object_): """Return True if the given object has a database identity. This typically corresponds to the object being in either the persistent or detached state. .. seealso:: :func:`.was_deleted` """ state = attributes.instance_state(object_) return state.has_...
def has_identity(object_):
"""Return True if the given object has a database identity. This typically corresponds to the object being in either the persistent or detached state. .. seealso:: :func:`.was_deleted` """ state = attributes.instance_state(object_) return state.has_identity
prop = getattr(mapper.class_, prop).property elif isinstance(prop, attributes.QueryableAttribute): if prop._of_type: from_entity = prop._of_type prop = prop.property return prop._with_parent(instance, from_entity=from_entity) def has_identity(object_):
64
64
68
6
58
vyonna6519/pitches
virtual/lib/python3.8/site-packages/sqlalchemy/orm/util.py
Python
has_identity
has_identity
1,916
1,929
1,916
1,916
e32f62318c3c82ccd3c3db86d6db361ed5eb6e82
bigcode/the-stack
train
edaf6867b1eee89d6d0573c7
train
function
def with_parent(instance, prop, from_entity=None): """Create filtering criterion that relates this query's primary entity to the given related instance, using established :func:`_orm.relationship()` configuration. E.g.:: stmt = select(Address).where(with_parent(some_user, User.addresses)) ...
def with_parent(instance, prop, from_entity=None):
"""Create filtering criterion that relates this query's primary entity to the given related instance, using established :func:`_orm.relationship()` configuration. E.g.:: stmt = select(Address).where(with_parent(some_user, User.addresses)) The SQL rendered is the same as that rendered...
0.8 the ``join_to_left`` parameter is deprecated, and will be removed in a future release. The parameter has no effect. """ return _ORMJoin(left, right, onclause, isouter, full) def outerjoin(left, right, onclause=None, full=False, join_to_left=None): """Produce a left outer join betwee...
161
161
539
11
150
vyonna6519/pitches
virtual/lib/python3.8/site-packages/sqlalchemy/orm/util.py
Python
with_parent
with_parent
1,846
1,913
1,846
1,846
92efb427cf75646ef5b81a7cdaf678ddd561685e
bigcode/the-stack
train
03509edd616842ffa376ebc4
train
function
def polymorphic_union( table_map, typecolname, aliasname="p_union", cast_nulls=True ): """Create a ``UNION`` statement used by a polymorphic mapper. See :ref:`concrete_inheritance` for an example of how this is used. :param table_map: mapping of polymorphic identities to :class:`_schema.Tabl...
def polymorphic_union( table_map, typecolname, aliasname="p_union", cast_nulls=True ):
"""Create a ``UNION`` statement used by a polymorphic mapper. See :ref:`concrete_inheritance` for an example of how this is used. :param table_map: mapping of polymorphic identities to :class:`_schema.Table` objects. :param typecolname: string name of a "discriminator" column, which will be ...
initiator): if include_backrefs or not detect_is_backref(state, initiator): obj = state.obj() values[:] = [validator(obj, key, value) for value in values] def set_(state, value, oldvalue, initiator): if include_backrefs or not detect_is_backref(state, in...
183
183
611
25
158
vyonna6519/pitches
virtual/lib/python3.8/site-packages/sqlalchemy/orm/util.py
Python
polymorphic_union
polymorphic_union
196
275
196
198
2818be492a272ec26ee01ffc12bc63fa239338cf
bigcode/the-stack
train
6dcf83a6de1e30cf065979ce
train
function
def aliased(element, alias=None, name=None, flat=False, adapt_on_names=False): """Produce an alias of the given element, usually an :class:`.AliasedClass` instance. E.g.:: my_alias = aliased(MyClass) session.query(MyClass, my_alias).filter(MyClass.id > my_alias.id) The :func:`.aliase...
def aliased(element, alias=None, name=None, flat=False, adapt_on_names=False):
"""Produce an alias of the given element, usually an :class:`.AliasedClass` instance. E.g.:: my_alias = aliased(MyClass) session.query(MyClass, my_alias).filter(MyClass.id > my_alias.id) The :func:`.aliased` function is used to create an ad-hoc mapping of a mapped class to a new ...
self.process_compile_state(compile_state) def process_compile_state(self, compile_state): """Apply a modification to a given :class:`.CompileState`.""" # if options to limit the criteria to immediate query only, # use compile_state.attributes instead if compile_state.compile_opti...
256
256
1,102
19
237
vyonna6519/pitches
virtual/lib/python3.8/site-packages/sqlalchemy/orm/util.py
Python
aliased
aliased
1,219
1,331
1,219
1,219
87074fd0e9d5a27ea99df73ef0e685eff3e93039
bigcode/the-stack
train
c1e72de4a151c4b7547a09a5
train
function
def _entity_corresponds_to_use_path_impl(given, entity): """determine if 'given' corresponds to 'entity', in terms of a path of loader options where a mapped attribute is taken to be a member of a parent entity. e.g.:: someoption(A).someoption(A.b) # -> fn(A, A) -> True someoption(A)....
def _entity_corresponds_to_use_path_impl(given, entity):
"""determine if 'given' corresponds to 'entity', in terms of a path of loader options where a mapped attribute is taken to be a member of a parent entity. e.g.:: someoption(A).someoption(A.b) # -> fn(A, A) -> True someoption(A).someoption(C.d) # -> fn(A, C) -> False a1 = ali...
_aliased_class: if given.is_aliased_class: if entity._base_alias() is given._base_alias(): return True return False elif given.is_aliased_class: if given._use_mapper_path: return entity in given.with_polymorphic_mappers else: return...
96
96
320
15
81
vyonna6519/pitches
virtual/lib/python3.8/site-packages/sqlalchemy/orm/util.py
Python
_entity_corresponds_to_use_path_impl
_entity_corresponds_to_use_path_impl
1,969
2,001
1,969
1,969
8fdebee3dc8ce3599ad3f155bf7361561ffce71e
bigcode/the-stack
train
b0ed370ad20ae6d7db1fb891
train
function
def _orm_deannotate(element): """Remove annotations that link a column to a particular mapping. Note this doesn't affect "remote" and "foreign" annotations passed by the :func:`_orm.foreign` and :func:`_orm.remote` annotators. """ return sql_util._deep_deannotate( element, values=("_o...
def _orm_deannotate(element):
"""Remove annotations that link a column to a particular mapping. Note this doesn't affect "remote" and "foreign" annotations passed by the :func:`_orm.foreign` and :func:`_orm.remote` annotators. """ return sql_util._deep_deannotate( element, values=("_orm_adapt", "parententity") ...
the given ClauseElement, annotating each element with the "_orm_adapt" flag. Elements within the exclude collection will be cloned but not annotated. """ return sql_util._deep_annotate(element, {"_orm_adapt": True}, exclude) def _orm_deannotate(element):
64
64
87
8
56
vyonna6519/pitches
virtual/lib/python3.8/site-packages/sqlalchemy/orm/util.py
Python
_orm_deannotate
_orm_deannotate
1,626
1,637
1,626
1,626
73cc49be36ea22c072c011a141325459d974cade
bigcode/the-stack
train
67a8fc2e69f550470a7769d0
train
function
def _orm_annotate(element, exclude=None): """Deep copy the given ClauseElement, annotating each element with the "_orm_adapt" flag. Elements within the exclude collection will be cloned but not annotated. """ return sql_util._deep_annotate(element, {"_orm_adapt": True}, exclude)
def _orm_annotate(element, exclude=None):
"""Deep copy the given ClauseElement, annotating each element with the "_orm_adapt" flag. Elements within the exclude collection will be cloned but not annotated. """ return sql_util._deep_annotate(element, {"_orm_adapt": True}, exclude)
ref:`bundles` - includes an example of subclassing. """ keyed_tuple = result_tuple(labels, [() for l in labels]) def proc(row): return keyed_tuple([proc(row) for proc in procs]) return proc def _orm_annotate(element, exclude=None):
64
64
71
11
52
vyonna6519/pitches
virtual/lib/python3.8/site-packages/sqlalchemy/orm/util.py
Python
_orm_annotate
_orm_annotate
1,616
1,623
1,616
1,616
c1432cb07933594e3de4c98c15cc7a9816a255c1
bigcode/the-stack
train
5dba37a76a2eb61f5ce6bf55
train
function
def join( left, right, onclause=None, isouter=False, full=False, join_to_left=None ): r"""Produce an inner join between left and right clauses. :func:`_orm.join` is an extension to the core join interface provided by :func:`_expression.join()`, where the left and right selectables may be not only c...
def join( left, right, onclause=None, isouter=False, full=False, join_to_left=None ):
r"""Produce an inner join between left and right clauses. :func:`_orm.join` is an extension to the core join interface provided by :func:`_expression.join()`, where the left and right selectables may be not only core selectable objects such as :class:`_schema.Table`, but also mapped classes or ...
( self, right, onclause=None, isouter=False, full=False, join_to_left=None, ): return _ORMJoin(self, right, onclause, full=full, isouter=isouter) def outerjoin(self, right, onclause=None, full=False, join_to_left=None): return _ORMJoin(self, right...
120
120
402
26
94
vyonna6519/pitches
virtual/lib/python3.8/site-packages/sqlalchemy/orm/util.py
Python
join
join
1,790
1,832
1,790
1,792
9c585abb4f4611a4ee17ec599a8807abe4ef899a
bigcode/the-stack
train
a90ebebdaceebfda90f07c8f
train
class
class ORMAdapter(sql_util.ColumnAdapter): """ColumnAdapter subclass which excludes adaptation of entities from non-matching mappers. """ def __init__( self, entity, equivalents=None, adapt_DataRequired=False, allow_label_resolve=True, anonymize_labels=Fa...
class ORMAdapter(sql_util.ColumnAdapter):
"""ColumnAdapter subclass which excludes adaptation of entities from non-matching mappers. """ def __init__( self, entity, equivalents=None, adapt_DataRequired=False, allow_label_resolve=True, anonymize_labels=False, ): info = inspection.insp...
) else: instance = kwargs.pop("instance") if kwargs: raise sa_exc.ArgumentError( "unknown keyword arguments: %s" % ", ".join(kwargs.keys) ) mapper = object_mapper(instance) return mapper.identity_key_from_instance(instance) class ORMAdapter(sq...
65
65
219
8
57
vyonna6519/pitches
virtual/lib/python3.8/site-packages/sqlalchemy/orm/util.py
Python
ORMAdapter
ORMAdapter
382
418
382
382
18d696ad517d9d308bf3b0674b70676220037640
bigcode/the-stack
train
1879f91c665bf637f9dab059
train
function
def randomize_unitofwork(): """Use random-ordering sets within the unit of work in order to detect unit of work sorting issues. This is a utility function that can be used to help reproduce inconsistent unit of work sorting issues. For example, if two kinds of objects A and B are being inserted, ...
def randomize_unitofwork():
"""Use random-ordering sets within the unit of work in order to detect unit of work sorting issues. This is a utility function that can be used to help reproduce inconsistent unit of work sorting issues. For example, if two kinds of objects A and B are being inserted, and B has a foreign key ...
_entity_isa(given, mapper): """determine if 'given' "is a" mapper, in terms of the given would load rows of type 'mapper'. """ if given.is_aliased_class: return mapper in given.with_polymorphic_mappers or given.mapper.isa( mapper ) elif given.with_polymorphic_mappers: ...
111
111
370
7
104
vyonna6519/pitches
virtual/lib/python3.8/site-packages/sqlalchemy/orm/util.py
Python
randomize_unitofwork
randomize_unitofwork
2,019
2,052
2,019
2,019
47ce7f50ffcafd737a2825a346d57674798ab84a
bigcode/the-stack
train