id stringlengths 20 20 | title stringclasses 1
value | text stringlengths 8 768k |
|---|---|---|
ff41938eedf752cd43e0 | def normalize_dataframe(self):
# drop empty rows and columns
self.df.dropna(how="all", inplace=True)
self.df.dropna(axis=1, how="all", inplace=True)
# change all na and NaN to an empty string
self.df.fillna("", inplace=True)
# change all to string
self.df = self... | |
ff41c3cbd026264a9ada | def getRun(self):
return self.__id | |
ff41c829dea3af547ba0 | def get_sub_list(self):
raise NotImplementedError | |
ff41cb3ee12c7bca9c49 | def new_branches(node):
for pot_node in not_in_min_span_tree:
pot_weight = np.sqrt((node[0] - pot_node[0])**2 + (node[1] - pot_node[1])**2 + (node[2] - pot_node[2])**2)
i = pot_node[3]
""" how do we insert into the array here? """
... | |
ff41d12d412196d848f3 | def parse(element):
if str(element.getAttribute('type')) == 'file':
for n in element.childNodes:
if n.localName == "name":
filename = str(n.firstChild.nodeValue).strip(" \n\t")
return ZIPFileLocator(filename)
return None
els... | |
ff41d2a8952ee6203a6f | def parse(self, prefs, element):
pass | |
ff41e5c6d0be8417587a | def define_actions(self):
raise NotImplementedError | |
ff41f6dcff0a3a92d6b0 | def ignore_user(self, nickname, channel):
self.send_message("/ignore {}".format(nickname), channel) | |
ff423a9237c8809134fb | def save_model(self, save_path):
if not self.model:
raise ModelError('Model has not been constructed yet! '
'Please build the model before saving it. Use the "create_model()" method')
file_manager = FileManager(file=self.model)
file_manager.save_file... | |
ff42c39ad634169d5c99 | def time_signature_color_tags(self, path=None) -> typing.List[str]:
tags = [
self.EXPLICIT_TIME_SIGNATURE_COLOR,
self.REAPPLIED_TIME_SIGNATURE_COLOR,
self.REDUNDANT_TIME_SIGNATURE_COLOR,
]
if path and not path.is_segment():
tags.append(self.REA... | |
ff42f296c262c2bbb3c7 | def existing_url(module):
# Build the format dictionary
url_base = "/axapi/v3/router/ipv6/ospf/{process-id}"
f_dict = {}
f_dict["process-id"] = module.params["process-id"]
return url_base.format(**f_dict) | |
ff42ff247937abe44d04 | def __load(self):
try:
file = open(self.__filename, "r") # open the file in read mode
for line in file: # take line by line
self.__elements.append(Sentence(line.strip("\n"))) # edit the sentence and append as a Sentence object
file.close()
except IO... | |
ff43158c6d90d41944f2 | def add_node(self, node: Node) -> None:
self.nodes.append(node)
node.index = len(self.nodes) - 1
for row in self.adjacency_matrix:
row.append(0)
self.adjacency_matrix.append([0] * (len(self.adjacency_matrix) + 1)) | |
ff43228062cb8cb6022b | def donutMask(N,M,R,r):
centerY = N/2.
centerX = M/2.
mask = np.zeros((N,M))
for i in range(N):
xDist = i-centerY
xDistSq = xDist**2
for j in range(M):
yDist = j-centerX
yDistSq = yDist**2
rSq = xDistSq+yDistSq
if rSq <= R**2 and rS... | |
ff433f99504958c18618 | def direct(self):
author_affiliation_pointer = '^([^@]+)\s*@(.+)$'
instructions = {
'end':r'\end{document}',
'maketitle':'\\maketitle',
'title':r'\title{%s}'%self.specs.spec('title'),
'abstract':('\n\\begin{abstract}\n'+'\n'.join(self.specs.specblock('abstract'))+'\n\\end{abstract}'
if self.specs.s... | |
ff435809631843720d8a | def __init__(__self__, *,
name: Optional[pulumi.Input[str]] = None):
if name is not None:
pulumi.set(__self__, "name", name) | |
ff4359f129d990a09066 | def plot(x,y,title,xaxislabel, yaxislabel):
fig, ax = plt.subplots()
plt.xlabel(xaxislabel)#Labels x axis.
plt.ylabel(yaxislabel)#labels y axis.
plt.grid(True) #adds crid to graph
plt.title(title)#Labels title
plt.plot(x,y)
plt.show() | |
ff436daefad353519791 | async def _tweets(self, ctx):
pass | |
ff437131593aacbe06c7 | def bad_member(cls, val):
return cls('bad_member', val) | |
ff438c2b218d68b9e63a | def __create_feature_label_arrays(training_data):
features = []
labels = []
for feature, label in training_data:
features.append(feature)
labels.append(label)
return features, labels | |
ff43a55634424e35095d | def info(self):
return self.rest('GET', self.uri_db + '-/') | |
ff43bcbd2b2e26cf2648 | def __init__(self):
_alt_bn128.ZKProvingKey_swiginit(self, _alt_bn128.new_ZKProvingKey()) | |
ff43c7f0d76a7964b944 | def __exit__(self, *_, **__):
self.stop() | |
ff43d0e0cae6f16bc7a3 | def revision(self, identifier):
out = self.git_log(identifier=identifier,
template=self.rev_log_tpl)
return Revision(out) | |
ff43f8663458269dba3a | def resample_models(dw,starmodel_wv,starmodel_flux,ld_coeff,\
planetmodel_wv,planetmodel_rprs,pars,tracePars):
wv1=p2w(tracePars,pars.xout+1,1,1)
wv2=p2w(tracePars,0,1,1)
for norder in range(1,4):
wv1=np.min((p2w(tracePars,pars.xout+1,1,norder),wv1))
wv2=np.max((p2w(tracePars,0,1,n... | |
ff43f89015a38f9ae19c | def find(self):
return self.database.database.find(self.name) | |
ff440fea4caa8e214a89 | def test_template_exception(self):
self.assertRaises(templating.TemplateException, templating.parse,
"{{ boom() }}", boom=fail_fixture) | |
ff444e9812a9c3be99b0 | def run_Kfold(self):
print "Entering the Testing Phase"
x = 1
l_loss = 0
h_loss = 0
loss = 0
mrr = 0
top3 = 0
count = 0
for train_idx, test_idx in self.k_fold:
classifier = Classifier(self.train, [], self.targets, self.stratification, s... | |
ff445b42cceaf576d51e | def label_diff(ax,text,r1,r2,max_corr,yer1,yer2,ymax,barWidth):
dx = int(abs((r1-r2))+0.1)
y = max(max_corr+ yer2/2, max_corr+ yer1/2) + 0.1*dx*ymax
x = r1 + dx/2.0
lx = r1+0.1*barWidth
rx = r1+dx*barWidth-0.1*barWidth
barh = 0.05*ymax*dx
barx = [lx, lx, rx, rx]
bary = [y, y+barh, y+ba... | |
ff445fb0c6a545f8c592 | def _OnPosText(self, evt):
assert self.contiguous
text = evt.GetString()
xy = parse_num_pair(text)
ctrl_id = self.pos_ctrl.GetId()
if xy is None:
self.main_section.SetValidationState(False, ctrl_id, 'Should be in the form "X, Y"')
return
pos = Vec... | |
ff446c752a9dedf57de6 | def get_authorization_url(self):
if getattr(self, 'request_token', None) is None:
self.get_request_token()
return self.session.authorization_url(self.AUTHORIZATION_URL) | |
ff447e714910f1b26a08 | def gzip_wrap(path):
iterator = gzip.open(path, 'rb')
running = True
while running:
try:
yield next(iterator)
except IOError:
running = False | |
ff44cd380c0a6c2cffb7 | def createModel(self):
with open('objects//dataFrame'+'.pkl','rb') as fd:
[data1, data2] = pickle.load(fd)
counts1 = self.count_vectorizer1.fit_transform(data1['words'].values)
self.model1.fit(counts1, data1['class1'].values)
counts2 = self.count_vectorizer2.fit_transform(dat... | |
ff44d0d6bbd36b7ed4a1 | def get_order_price_quantum(self, trading_pair: str, price: object):
trading_rule: TradingRule = self._trading_rules[trading_pair]
return trading_rule.min_price_increment | |
ff44d4c786c875c2f1f4 | def fasta_sizes_from_file(file):
seqs = dict()
current_id = None
for line in open(file):
line = line.rstrip()
m = re.search('>(\S+)\s*(.*)', line)
if m:
## new residue line matched, set the new seq ID
current_id = m.group(1)
seqs[current_id] =... | |
ff44fa389c50dad112e1 | def _fix_value(self, value):
try:
new_value = self._contained_type(value)
except:
raise ValueError("Can't put '%s' (%s) into a %s" %
(value, type(value), self.__class__))
return new_value | |
ff450ee8c0630c6243e0 | def do_GET(self):
# First, we establish the object classes.
client = OpenFDAClient()
html_builder = OpenFDAHTML()
json_parser = OpenFDAParser()
#Generic response for any urls except the defined one
response_code = 404
response = html_builder.show_page_not_found(... | |
ff453c60f6bbdb64ee34 | def __init__(self, filename):
self.fail = False
with open(filename, 'r') as f:
text = f.read()
# get staff definition string
self.raw = Score.get_staff_def(text)
# if couldn't find staff definition, fail
if len(self.raw) == 0:
self.fail = True
return
# perform substitutions
self.raw += " " +... | |
ff4545750766e8db59ef | def get_model_name_map(unique_models: TypeModelSet) -> Dict[TypeModelOrEnum, str]:
name_model_map = {}
conflicting_names: Set[str] = set()
for model in unique_models:
model_name = normalize_name(model.__name__)
if model_name in conflicting_names:
model_name = get_long_model_name(... | |
ff455929e22e2b188855 | def adjusted_previous_close(self, stock=''):
return self.get_quote_list(stock, 'adjusted_previous_close') | |
ff45787d659ee463c947 | def add_address_range(self, addr_range):
# TODO Do better overlap detection. For now we just check if the exact range exists
current_ranges = maas_iprange.IpRanges(self.api_client)
current_ranges.refresh()
exists = current_ranges.query({
'start_ip': addr_range.get('start', ... | |
ff458643a4b28738668e | def live_restart_service(self, app_name, svc_name):
self._http_client.update(self.url + "applications/" + app_name + "/services/" + svc_name + "/_restart", decode = False) | |
ff4599ea0f121d9cb8bc | def __len__(self):
length = self.headers.get('Content-Length')
return int(length) if length else 0 | |
ff45aabd23e0b07b1546 | def setGraphDefinition(self, **data):
uid = data['uid']
del data['uid']
for axis_vals in ('miny', 'maxy'):
try:
x = float(data[axis_vals])
except (ValueError, KeyError):
x = -1
data[axis_vals] = x
obj = self._getFacade()... | |
ff45f16127a761ab20b5 | def _initialize(self):
self.outputGroup._initialize() | |
ff461853a40b0568ebf6 | def __init__(self):
try:
kv_config = config.get_config("KeyVault")
except KeyError as err:
raise MsticpyKeyVaultConfigError(
"No KeyVault section found in msticpyconfig.yaml",
title="missing Key Vault configuration",
) from err
... | |
ff462552f3e9780d11e8 | def send_data_task(username, channel_code, channel_pk):
user = User.objects.get(username=username)
channel = INTEGRATED_CHANNEL_CHOICES[channel_code].objects.get(pk=channel_pk)
LOGGER.info(
'Processing courses for integrated channel using configuration: %s',
channel,
)
try:
... | |
ff4627cd1328621aee5e | def push(self, element):
self.stack.append(element) | |
ff463a225e34627455a9 | def run(self):
while True:
sleep(0.3)
if self.state == 1:
self.WaitForJoin()
elif self.state == 2:
self.ClientStay()
"""self.Send([1,2,3,4,5,6]) # test
self.state = 3"""
... | |
ff465a9655b98c6b77f8 | def test_copy(gather):
dest_folder, asn_path, source_folder, exptypes, excludes = gather
asn = LoadAsAssociation.load(asn_path)
for product in asn['products']:
for member in product['members']:
path = Path(dest_folder / member['expname'])
assert path.exists(), f'File does n... | |
ff4665bf4abde06ea076 | def create_match_api_tcam_subtable(self, source_id, table_id, table_name,
max_table_entries, match_field_type_pairs,
actions):
self.maa.create_maa_tcam_subtable(source_id, table_id, table_name,
... | |
ff4674add0ab4d4b0387 | def run_beam_pipeline():
# Params used for running the Beam pipeline. Update these based on your
# requirements.
params = {}
# Specify the projectid for BigQuery
params['projectId'] = 'my_project_id'
# Specify the datasetid for BigQuery
params['datasetId'] = 'my_dataset_id'
# Specify the table for BigQ... | |
ff467d3367c7c5672177 | def sl3_util_find_file(start_dir, name, parent=False, limit=None, aux_dirs=[]):
for d in sl3_util_climb(start_dir, limit=limit):
target = os.path.join(d, name)
if os.path.exists(target):
if parent:
return d
return target
for d in aux_dirs:
d = o... | |
ff4690adee3ee2b65835 | def computeIdMap(self, authors:Iterable, duplicates:dict, filename:str=None) -> None :
if(not isinstance(authors,Iterable)):
raise TypeError("authors must be an Iterable but %s was passed"%str(type(authors)))
if(not isinstance(duplicates,dict)):
raise TypeError("duplicates must b... | |
ff469aa853cdb415a3d6 | def number_of_protein_atoms(protein_atoms):
# leave for later
pass | |
ff46ad7cbde9cdb1ca33 | def inputs(*args, **kwargs):
return args, kwargs | |
ff46c6e56ad53575aeca | def settlement_balance(self, from_bal, to_bal, currency):
from_bal -= currency
to_bal += currency
return {'from_trader_bal': from_bal, 'to_trader_bal': to_bal} | |
ff46fc80678c877a9280 | def __int__(self):
return int(self._w) | |
ff470dab7a6fbb33ce48 | def xyz2enu(lat, lon, x, y, z):
rot_matrix = rotation_matrix(angular_typecheck(lat), angular_typecheck(lon))
xyz = np.array([[x], [y], [z]])
enu = rot_matrix.transpose() @ xyz
east = enu[0, 0]
north = enu[1, 0]
up = enu[2, 0]
return east, north, up | |
ff47148d16208c18d8d6 | def mag(b):
return b[0]**2.0 + b[1]**2.0 + b[2]**2.0 | |
ff472c374b810ab80223 | def display(self, items):
return [str(i) for i in items] | |
ff4751b1d79d1d897b93 | def _fill_buffer(self, model):
pass | |
ff47796b186487a7ad76 | def _paginate_list(self, after=None, filter=None, order=None, limit=None, include=None):
# Filter query parameters
query_params = filter.to_api() if filter else {}
# Add in other query parameters
return self._client.call_api(
method="get",
path="/v3/update-campa... | |
ff478244a7104a19903d | def get_absolute_url(self, action="display"):
route_kwargs = {"pk": self.pk}
import_kwargs = {"data_source": self.data_source, "source_id": self.source_id}
action_reverse = {
"display": ("routes:route", route_kwargs),
"edit": ("routes:edit", route_kwargs),
"u... | |
ff47aba161fb7dacd96b | def move(self):
if self.direction == UP:
self.position['y'] -= 2
elif self.direction == DOWN:
self.position['y'] += 2
elif self.direction == LEFT:
self.position['x'] -= 2
elif self.direction == RIGHT:
self.position['x'] += 2 | |
ff47b394f6a9cd2b741c | def get_summary_data(filtered_data):
df = filtered_data
if len(df) == 0:
return {
'timeseries': {},
'taxa': {}
}
# Get year columns
years = [col for col in df.columns if col.isdigit()]
# Get only years that have data
m = df[years].max()
years = list(m.index[(m.fillna(method='bfill') + m.fillna(meth... | |
ff47c4a14df636b54d68 | def test_process_single_ipv4_udp_packet(self):
self.assertFalse(self.ae.process_packet(self.int_pkt_ipv4_udp)) | |
ff47f563758266e7dda6 | def unwsgify(func, catch_exc_info=True):
def start_response(status, headers, exc_info=None, captured=[], output=[]):
if exc_info is not None and not catch_exc_info:
raise exc_info[0], exc_info[1], exc_info[2]
captured[:] = [status, headers, exc_info]
return output.append
@fu... | |
ff48440924ed2de3eebc | def clear(self):
self.scores = []
self.ids = []
self.summary = {} | |
ff48917f058b93b883ff | def get_channels(self):
if self.channel_urls is None:
self.channel_urls = self.connector.fetch_all_channel_stream_urls()
return self.channel_urls | |
ff48a67d5f011b1759a8 | def _rsquared(self):
rsquared = 1.0-self._rss()/self._tss()
return rsquared | |
ff48c7f3d71f19614185 | def encode(self, obj):
self._validate_object_type(obj)
buffer = io.BytesIO()
fastavro.schemaless_writer(buffer, self._schema, obj)
return buffer.getvalue() | |
ff48e7c86d1e5c2a4faf | def get(self, name):
return Config.__conf[name] | |
ff48edc1a2f489b04deb | def draw_interpolation_positions(levels):
x = levels
fig, ax = plt.subplots(figsize=(12, 8), nrows=1, ncols=1, subplot_kw=dict(projection='polar'))
ip = AHA17Parameters()
r = np.linspace(0.2, 1, 4)
theta = np.linspace(0, 2 * np.pi, ip.resolution[0])
linewidth = 2
# Create the radial bounds... | |
ff491b8eafc87aff9e81 | def MoveWindow(self, x, y, width, height, repaint = 1):
hWnd = self.Handle
if hWnd:
return Win32API.MoveWindow(hWnd, x, y, width, height, repaint) | |
ff4928d996691dfe3f11 | def home(request):
instancias = Directorio.objects.all().order_by("id")
query = request.GET.get("q")
if query:
instancias = instancias.filter(Q(profesion__icontains = query)|
Q(nombre__icontains = query) |
Q(cargo__icon... | |
ff49563b08e262100a7a | def test_password_equality(self):
assert self.user.check_password_against_hash('testPassword') | |
ff495fe22b88736ba8c9 | def vae_custom_loss(z, beta_fn, free_bits=0, kl_weight=1, run=None):
# for implementation of free_nats, see https://github.com/tensorflow/magenta/blob/master/magenta/models/music_vae/base_model.py
free_nats = free_bits * tf.math.log(2.0)
# for implementation of weighting kl loss according to epoch,... | |
ff4961e0a6e306396e8e | def sub(self, other):
return self._arithmetic_binop_impl(other, '-') | |
ff4961f27a3e2a49752c | def literal(identifier): | |
ff49697fb4bb8414359b | def start_parser(self):
# starting symbol
stack = ["A"]
# non_terminal list representing user input
self.string = lex.t
self.string.reverse()
while len(self.string) > 0:
print stack
# getting input and stack top elements
token = self.st... | |
ff4976cbbd439c02d6fd | def nodes():
pass | |
ff497e76f2fac9fdf30d | def test_as_generator_function():
def func():
return
assert not inspect.isgeneratorfunction(func)
newfunc = qthreading.as_generator_function(func)
assert inspect.isgeneratorfunction(newfunc)
assert list(newfunc()) == [None] | |
ff499ab57902fb18893e | def bonding(self):
connect_pts = [cp for bu in self.building_units for
cp in bu.connect_points]
bond_combos = itertools.combinations(connect_pts, 2)
for cp1, cp2 in bond_combos:
ibu1 = cp1.bu_order
bu1 = self.building_units[ibu1]
ibu2 ... | |
ff49ae392f401914cf0c | def _handle_imports(cls):
pass | |
ff49b3a065219344e803 | def test_category(self):
self.assertEqual(self.sample.category, "academic", msg="Error, Kindly confirm selection and try again")
self.assertEqual(self.sample1.category, "comical", msg="Error, Kindly confirm selection and try again")
self.assertEqual(self.sample2.category, "newspaper", msg="Error... | |
ff4a01834163e16615a8 | def _generate_cbasois_description(cbasois, images):
images_str = "items for %d images" % (len(cbasois),)
nb_items_lst = [len(cbasoi.items) for cbasoi in cbasois]
nb_items_lst = nb_items_lst if len(cbasois) > 0 else [-1]
nb_items = sum(nb_items_lst)
items_str = (
"fewest items on image: %3d\... | |
ff4a09e45b84ee2c90f1 | def set_data(self, svg):
self.attrs.data = svg
self.data_array = Path.parse_path_data(svg) | |
ff4a24da61e662d4008a | def writeRaw8(device, handle, value):
value = value & 0xFF
device.i2c_write_byte(handle, value) | |
ff4a2ec45810d61b12dc | def init_UI(self) -> None:
QtCore.QCoreApplication.setOrganizationName("King Inc")
QtCore.QCoreApplication.setApplicationName("King's Editor")
QtCore.QCoreApplication.setApplicationVersion("0.1.1")
self.window_title = "untitled[*] - King's Editor"
icon = QtGui.QIcon("./svgs/drag... | |
ff4a491c32d795b31b31 | def test57():
assert isinstance(p, Pod)
diffs = p.diff(p.metadata)
assert len(diffs) == 1
assert "Incompatible" in diffs[0].report | |
ff4a53a09df293a2fe8f | def __getNumWords(self, words):
return len(words) | |
ff4aeb965d614c998cac | def remove_all(self):
for iso in self.conf['download'].keys():
self.remove(iso) | |
ff4b02582c741db2841f | def _get_clip():
# which platform - OSX or iOS ?
try:
import clipboard
var_ios = True
except ImportError:
import subprocess
var_ios = False
# read the clipboard ...
if var_ios:
str_src = clipboard.get()
else:
proc = subprocess.Popen(['pbpaste'], s... | |
ff4b214864b6e6d35122 | def tsGrid(center=None, ny=None, nz=None,
width=None, height=None, dy=None, dz=None,
nt=None, time_sec=None, time_min=None, dt=None, time_sec_out=None,
findClose_nt_lowPrimeFactors=True, prime_max=31,
clockwise=True):
out = gridObj()
if center is None:
raise T... | |
ff4b280cb51af4bbfc37 | def gumbel_softmax_sample(logits, temperature, device):
y = logits + sample_gumbel(logits.shape, device)
return F.softmax(y / temperature, dim=-1) | |
ff4b5ca4b52f08a89054 | def load(self, configuration):
pass | |
ff4b9406cd6d41e7315f | def forward(self, t_local, y, backwards = False):
grad = self.get_ode_gradient_nn(t_local, y)
if backwards:
grad = -grad
return grad | |
ff4bba19640388ff3abf | def getreads_regex(filen,pattern):
regex = re.compile(pattern)
for read in getreads(filen):
if regex.search(''.join(read)):
yield read | |
ff4bc05063e94c317106 | def rho(self) -> float:
return self._params[4] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.