id stringlengths 20 20 | title stringclasses 1
value | text stringlengths 8 768k |
|---|---|---|
ffe60ea360a01260516c | def calculate_bla(bonds_list):
bla_list = []
# full BLA = (avg double bonds length - avg single bonds length)
avg_double_bond = (bonds_list[0]+bonds_list[2]+bonds_list[4]\
+bonds_list[6]+bonds_list[8]+bonds_list[10])/6
avg_single_bond = (bonds_list[1]+bonds_list[3]+bonds_list[5]\
... | |
ffe63568909abc673dd8 | def output_scores(self):
res = []
for i in range(len(self.players)):
player_points = self.bull_points[i]
player_name = self.players[i].name
res.append((player_name, player_points))
return res | |
ffe6373e73ad7dafacac | def make_the_glob(date_range):
print(''.join(map(chr, [61, 61, 61, 71, 76, 79, 66, 32, 67, 82,
69, 65, 84, 73, 79, 78, 32, 73, 78, 73,
84, 73, 65, 84, 69, 68, 61, 61, 61])))
start, end = date_range
delta = timedelta(minutes=12)
last_image_time = st... | |
ffe63fedc00629e543ca | def bot_join_event(self, channel):
self.plugins.event(self, 'bot_join', (channel)) | |
ffe649cf9a334ccc4bd6 | def check_params(self):
if self.interval:
if int(self.interval) < 5 or int(self.interval) > 32768:
self.module.fail_json(
msg='Error: The value of interval is out of [5 - 32768].')
if self.hold_multiplier:
if int(self.hold_multiplier) < 2 or ... | |
ffe69079330346f9c0e7 | def getFieldsContent(self,layer):
global schema
sql="SELECT column_name FROM information_schema.columns WHERE table_name='%s' and table_schema='%s';" % (layer,schema)
query = self.db.exec_(sql)
fields=[]
while (query.next()):
fields.append(unicode(query.value(0)))
... | |
ffe6bb3077b9a36077bd | def test_context(self):
posts = self.resp.context['posts']
self.assertIsInstance(posts, QuerySet) | |
ffe6eb993f9bd49cdfb0 | def setAttr(attr, *args, **kwargs):
pass | |
ffe71277c4e12c9ecb35 | def is_terminal(self, state):
return state.cachedWin or len(state.blanks) == 0 | |
ffe7239b7a33e4abb03b | def isIrrelevantManualRules(s, cdoc):
if len(s) < 4: return True, cdoc, len(s) #too short
if "Monster" in s[:15]: return True, cdoc, len(s) #Paragraph with monster
if "Newspaper logo is conditionally" in s:
return True, [], sum([0]+[len(s) for s in cdoc]) # reset doc, everything above is not releva... | |
ffe730689d4421b14f15 | def _kcevo_stylewid(self,ax,s_tick,s_lab,_active):
ax.set_ylim(0,110)
ax.set_yticks(np.linspace(0,100,5))
ax.set_yticklabels(wlong_ticks_,size=s_tick)
if not _active:
ax.set_ylabel('Longitudinal Width',color=cm.Reds(0.75),size=s_lab)
ax.tick_params('y',colors=cm.Reds(... | |
ffe73104514739d232a4 | def move(self):
try:
self.an_count += 1
if self.an_count >= len(self.imgs):
self.an_count = 0
x1, y1 = self.path[self.path_pos]
if self.path_pos + 1 >= len(self.path):
x2, y2 = (-10, 10)
else:
x2, y2 = ... | |
ffe77e2d35b5871dd3aa | def next_sibling(self, **kwargs):
assert self.selected()
qs = self.link_set()
count = qs.count()
if not count:
return None
index = self.index()
if index + 1 >= count:
return None
else:
return qs[index+1] | |
ffe7a697bec3c9c711bd | def multithread2(self, max_threads=10):
if not isinstance(max_threads, int):
raise ValueError("max_threads must be an int.")
timer = datetime.now()
self.info = {}
threads = min(max_threads, self.n)
print(
f"🧵 Multithreading [{self.func.__module__}.{sel... | |
ffe7c85bf8b16cd34dac | def make_pointer_to_element_in_array(er_array, er_subscript,
reg_dest, reg_temp):
assert(isinstance(er_array, ExpressionRecord) and
isinstance(er_subscript, ExpressionRecord))
# Put subscript into temp register
CG.load_reg(reg_temp, er_sub... | |
ffe7c9f1b51a6f501675 | def basic_clean(text):
text = text.lower()
text = unicodedata.normalize('NFKD', text).encode('ascii', 'ignore').decode('utf-8', 'ignore')
text = re.sub(r"[^a-z0-9'\s]", '', text)
return text | |
ffe7dccde47c60a0c21d | def setUp(self):
self.game = BowlingGame() | |
ffe8128573fdbca6070e | def step_backwards_degree(self, n_degrees):
GPIO.output(self.dir_pin, False)
self._step_degrees(n_degrees) | |
ffe8183256f30288bb27 | def use_extensions(self) -> bool:
return (self.descriptor is not None) and (len(self.descriptor.extensions) > 0) | |
ffe831829186106a8664 | def save_notebook(self, model, name='', path=''):
path = path.strip('/')
if 'content' not in model:
raise web.HTTPError(400, u'No notebook JSON data provided')
if not path:
raise web.HTTPError(400, u'We require path for saving.')
nb = nbformat.from_dict(model['... | |
ffe833a5ee814720d581 | def apply_symmetry(self, x):
if FLAGS.apply_sym > 0:
x_flip = torch.flip(x, dims=[-1])
x = (x + x_flip) / 2
return x | |
ffe8499d90fec970fa87 | def getLowerLimit(self):
return self.lower_limit | |
ffe85e5260e2a5995623 | def test_diagram_generation_diagrams_ddx_uuxg(self):
myleglist = base_objects.LegList()
myleglist.append(base_objects.Leg({'id':1,
'state':False,
'number': 1}))
myleglist.append(base_objects.Leg({'id':-1,
... | |
ffe86ac141fbb035aaa2 | def batch_size(self):
assert len(self.job_assignment.shape) == 3, "It's not a batch instance."
return self.job_assignment.shape[0] | |
ffe87a48839ddd567887 | def get_cpus(node):
sys_node = '/sys/devices/system/node/node' + str(node)
assert os.path.isdir(sys_node)
node_cpus_path = sys_node + '/cpulist'
return open(node_cpus_path, 'r').readline().strip() | |
ffe882c6ae4ab17bcc25 | def has_access(self, username):
if username in self.users_and_premissions.keys():
return True
return False | |
ffe8c3fe791bee3166d3 | def visit_Import(self, node):
for import_ in node.names:
self.new_module(node.lineno, "import", import_.name)
for alias in node.names:
name = alias.asname or alias.name
self.count_name(name, "import")
self.count("import", name)
self.generic_visit(... | |
ffe8cc7145258c6b8063 | def clean_chr_name_file(in_file, contig_defs, ref_path):
print("Filtering {}...".format(in_file))
# run validate_contig_names first before running chr name clean. if pass, no clean_chr_name is needed
if ref_path is not None:
contig_defs_ready_file = os.path.join(ref_path, 'fasta', 'contig-defs.json... | |
ffe8d653785ebbf306d1 | def camel_to_underscore(name):
s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower() | |
ffe8eaa5fdbf71ff709b | def daily_log_returns(data):
return np.log(1 + daily_returns(data)).dropna(how="all") | |
ffe8f0cc17e5a2c461a9 | def update_V_poisson_gamma(a, b, M, U, Z):
return update_U_poisson_gamma(a=a, b=b, M=M.T, V=U, Z=Z.transpose(1,0,2)) | |
ffe8f32b3a69b067e441 | def write_file(self, filename):
with open(filename) as f:
f.write('tempo: %d\n' % self.tempo)
f.write('time_sig: %d %d\n' % (self.time_sig[0], self.time_sig[1]))
f.write('clef: %s\n' % self.clef)
f.write('nr_channel: %d\n' % self.nr_channel)
f.write(... | |
ffe8fb81eef87659647e | def bdf4_step(self, f, jac, y0, t0, t1, f_params, jac_params):
# compute the step size
h = (t1 - t0)
# use rk5 to compute the starting values
if len(self.past_values['y']) < 4:
y1, t1 = rk5_step(self, f, y0, t0, t1, f_params)
# remember theses values
self.past_value... | |
ffe906c96908ddecb87c | def polygon(points, color, edge_color=None):
if edge_color is None:
edge_color = color
# Invert Y coordinate so up is positive (PyGame uses down as positive)
points[:, 1] = screen_height - points[:, 1]
gfxdraw.filled_polygon(screen, (px*points).round().astype(int), color)
gfxdraw.aapolygon(s... | |
ffe90a8e839ededcf776 | def prime_checker(number):
for nums in range(2, number//2+1):
if number % nums == 0:
print("It's not a prime number.")
return
print("It's a prime number.") | |
ffe92e021af62c21a183 | def plot_slip(self, axes=None):
raise NotImplemented("") | |
ffe9411362ad95492480 | def resynth_data(self):
raise NotImplementedError() | |
ffe94d26249931575bdf | def is_offset(self, ea): | |
ffe97ea9390fddcf4f05 | def get_field_names():
return [x for x in User.__data] | |
ffe9e2de1e822b535a50 | def shutdown(self):
rospy.loginfo("Stopping the robot...")
self.move_base.cancel_goal()
rospy.sleep(0.1)
self.twi_pub.publish(Twist())
rospy.sleep(0.1) | |
ffe9e3f4094d87606086 | def is_estimator(estimator):
return isinstance(estimator, BaseEstimator) | |
ffea0a86dac44329e10b | def get_base_net(
number_resnet_layers, number_hidden_nodes, image_input_batch, roi_input_batch, he_init):
# Resnet network
resnet = reduced_resnet_builder.ReducedResnetBuilder(he_init) \
.build_resnet(image_input_batch, number_resnet_layers)
# Forcing it to use just ONE image in this versi... | |
ffea0ec1df47f3f2cae9 | def _inspect(self, meth, oname, namespaces=None, **kw):
info: OInfo = self._object_find(oname, namespaces)
if self.sphinxify_docstring:
if sphinxify is None:
raise ImportError("Module ``docrepr`` required but missing")
docformat = sphinxify(self.object_inspect(ona... | |
ffea2374fc22cb5c5852 | def robot_factory(robot):
print('Building robot of type %s:'%(robot))
return eval(robot) | |
ffea4d7e128e116e26b3 | def symbol(self) -> str:
return self.value[0] | |
ffea569163feb1d5cb9b | def _verify_inputs(self) -> None:
for op in get_current_items(self.ops):
assert isinstance(op, TensorOp), "unsupported op format, Network ops must be TensorOps"
for op in get_current_items(self.postprocessing):
assert isinstance(op, NumpyOp), "unsupported op format, Network postp... | |
ffea6ac2ea529c43a413 | def train(self, steps: int, **kwargs: Any) -> None: | |
ffea80d39f6f51a63ece | def GetBins(self):
return [int(i) for i in self.arraycsn] | |
ffeab2c4bff8943c9949 | def __call__(self, *args, **kwargs):
self.promise._cache_callback(*args, **kwargs) | |
ffeaeb54f4914b9892b6 | def saveContent(self):
if not os.path.exists(self.contentFile):
with open(self.translation.book_file, 'r') as f:
lines = [line.strip() for line in f.readlines()]
ch_cont = ' '.join(lines[self.firstLine-1:self.lastLine+1])
start = 0
new_... | |
ffeafcfe3fcd3529f1dd | def dump_object(self, value):
t = type(value)
if t is int or t is long:
return str(value)
return '!' + pickle.dumps(value) | |
ffeb088d6dbd3938accc | def generate_experiments(self):
experiments_to_queue = list()
# Generate Experiments
name = ''.join([self.project['name'], 'model{num}'.format(num=self.experiments_counter)])
experiment = dict()
experiment['name'] = name
experiment['project_name'] = self.project['name']... | |
ffeb1613430b9e55cd10 | def mask_extract_lab(self):
L = self.green_image_lab[:, :, 0]
A = self.green_image_lab[:, :, 1]
B = self.green_image_lab[:, :, 2]
# negate A
A = (255 - A)
# multiply negated A by B
nAB = 255 * (A / 255) * (B / 255)
nAB = np.clip((nAB), 0, 255... | |
ffeb2a665a2625d1c509 | def generate_outputs():
idx_1 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
idx_2 = [2, 3, 4, 5, 6, 7, 8, 9]
task = Task(TaskTypesEnum.regression)
generated_target = np.random.sample((len(idx_1), 1))
generated_features = np.random.sample((len(idx_1), 2))
list_with_outputs = []
for idx, data_flo... | |
ffeb3f8c3e89706c6c97 | def search(self, state):
self._best_next_move = None
self._moves = 0
self._positions = 0
for depth in itertools.count():
if self._max_depth and depth > self._max_depth:
return
root = state.copy()
self._best_next_move, value = self._se... | |
ffeb516e76da8ce2f1dc | def display(strip, colorfg, colorbg, backgroundLEDs, foregroundLEDs):
# show fore and background on pannel in respective colors
for u in foregroundLEDs:
strip.setPixelColor(u, colorfg)
for w in backgroundLEDs:
strip.setPixelColor(w, colorbg)
strip.show() | |
ffeb56af8cec35a373a5 | def remaining_moves(self):
# return self.unvisited
if not self._remaining_moves:
self._remaining_moves = list(filter(self.enough_weight_and_time, self.unvisited))
return self._remaining_moves | |
ffeb63c930c032c917e1 | def hw_revision(self):
if self.device is not None:
hw_rev = self.read_register('HW_REVISION')
return hex(hw_rev)
else:
return None | |
ffeb6677dfe134caf621 | def checkAvailable():
return True | |
ffeb7e232e2cee411ae6 | async def guild_voice_region_get_all(self, guild):
guild_id = get_guild_id(guild)
data = await self.http.guild_voice_region_get_all(guild_id)
voice_regions = []
optimals = []
for voice_region_data in data:
region = VoiceRegion.from_data(voice_region_data)
... | |
ffebb2543c2ab1ce5b16 | def _update(self, conn, key, data):
update = key.table.update()
where = key.table.c.id==key.id
results = conn.execute(update.where(where).values(state_data=data))
return results.rowcount | |
ffebc862d9e055f0c341 | def onEnemyDefeated(self):
pass | |
ffebe304bc087b70a168 | def download_file(self, url):
self.called_tools.append('download_file')
pool = urllib3.PoolManager(cert_reqs='CERT_NONE')
try:
with pool.request('GET', url, preload_content=False) as file:
content = file.read()
if content == b'Route not defined.':
... | |
ffebf3d4db0948aa32e5 | def load_plugins(self):
allOK=True
plugdir=self.config.get('main', 'plugindir').strip()
if plugdir!="" and not os.path.isdir(plugdir):
self.logger.warning('Plugin directory %s not found'%plugdir)
if plugdir!="":
self.logger.debug('Searching f... | |
ffec06fbea1316ec4699 | def it_should_create_an_rdf_graph(): | |
ffec3b7a2db27f0b2adc | def getfundamentals(self, results):
self.log("Retrieving fundamental phone information")
self.log("Phone serial number")
results['uniqueserial']=sha.new(self.get_esn()).hexdigest()
self.log("Reading group information")
buf=prototypes.buffer(self.getfilecontents("pim/pbgroup.dat")... | |
ffec56b92635f7b7944b | def get(self, id):
TeamRoster._validate_input_int('ID', id)
session = self._db_session()
existing_team_member = session.query(AbstractTeamMember).filter(AbstractTeamMember.id == id).first()
team_member = ''
if existing_team_member not in [None, '']:
if existing_t... | |
ffec97faf0a3ac9a2a57 | def test_integration_repository_events(self):
repo_root, repo = create(Builder('repository_tree'))
# Local roles Aquisition Blocked-Event
notify(
LocalRolesAcquisitionBlocked(repo, ))
# Check
self.check_annotation(
repo_root,
action_type='Loc... | |
ffec9ee4299c3ea418b9 | def countryCode(self) -> str:
return self.__countryCode | |
ffecf88acb0f15f8aee5 | def is_next_line_blank(self):
try:
return not self.input_lines[self.line_offset + 1].strip()
except IndexError:
return 1 | |
ffed071d2832be10a893 | def process_date(self, textdate):
# no check if empty line or to be forwarded to legal function
if self.deadline.get().strip() == '' or self.legal_fwd.get() == 1:
return None
converted = None
# tries to convert into datetime object
for fmt in ('%d-%m-%Y', '%d-%m-%y'... | |
ffed19b8c8b9f0165ae3 | def execution_details(self):
if not self._uid:
return None
cu_json = self._worker.get_compute_unit_data(self.uid)
return cu_json | |
ffed3858a780b16f0bc3 | def create_db():
con = sqlite3.connect(DB_PATH)
try:
with con:
cur = con.cursor()
cur.executescript("""
CREATE TABLE IF NOT EXISTS advego (
"id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
"filename" TEXT NOT NULL,
... | |
ffed6a3e60e6c4f954bd | def _processSize(self,elem, sessionID):
return str(self.numCategories()) | |
ffed7c7d628ea3fb08ba | def get_pos_y(pos):
return pos[1] | |
ffed7efd94d0787a84c3 | def test_extension_hook_executes_on_custom_module():
manual_seed(0)
N, D_in, D_out = 2, 3, 1
# NOTE Inheriting from Sequential passes
class CustomModule(Module):
"""Custom container that is not skipped by the extension hook."""
def __init__(self):
super().__init__()
... | |
ffed89f04061e02d7e4e | def setup(rank: int, world_size: int):
os.environ['MASTER_ADDR'] = 'localhost'
os.environ['MASTER_PORT'] = '12355'
dist.init_process_group("nccl", rank=rank, world_size=world_size) # initialize the process group
# torch.manual_seed(42) # same initialized model for every process | |
ffed924c6ec589d120ee | def part_2(positions: list[int]) -> int:
destination = best_destination(positions, cost_quadratic)
cost = alignment_cost(positions, destination, cost_quadratic)
print(f"part 2: crabs align at position {destination}, which costs {cost} fuel")
return cost | |
ffed992ed96adebbe65a | def instructions(self):
return self._insts | |
ffeda790ddfbec971094 | def test_local_manager_removes_inheritance(self):
self.portal.acl_users._doAddUser("localmanager", "secret", ["Member"], [])
folder = self.portal[self.portal.invokeFactory("Folder", "folder")]
subfolder = folder[folder.invokeFactory("Folder", "subfolder")]
folder.manage_setLocalRoles("lo... | |
ffeda9736f6a6d6fb1c3 | def _apply_spreading(self, array):
raise NotImplementedError | |
ffedf285d2cefd9f3169 | def D():
return JS(a=1, b=2, c=3) | |
ffee0c5d6443cec58ff2 | def get_full_class_name(c):
return get_package_name(c.package) + "." + get_class_name(c) | |
ffee3f4e03abca5f0b73 | def add_string_field(self, name, validation, required=False):
self.data_definition[name] = fields.String(validate=validation, required=required) | |
ffee5acf1acfa5aa8fed | def test_set_max_trials_from_string(self) -> None:
tuning = Tuning()
tuning.set_max_trials("10")
self.assertIsNotNone(tuning.exit_policy)
self.assertEqual(tuning.exit_policy.max_trials, 10) | |
ffee74ecb82aeeeccf89 | def price(self):
return self.bill.price | |
ffee90b55e95fa0501d4 | def delete_attachment(self, attachment, headers=None):
# need latest rev
self.fetch()
assert_attachment_name(attachment)
attachment_url = '/'.join((self.document_url, attachment))
if headers is None:
headers = {'If-Match': self['_rev']}
else:
heade... | |
ffeefa4f25cdc5449c48 | def from_args(self, **kwargs):
for k, v in kwargs.items():
if v is not None:
if k in self.MUST_BE_LIST and isinstance(v, str):
v = [v]
setattr(self, k, v) | |
ffef04b36672ba4753c7 | def select(self):
warnings.filterwarnings("ignore", category=DeprecationWarning)
# TODO implement model selection based on BIC scores
#raise NotImplementedError
best_n_components = None
best_bic = math.inf
for n in range(self.min_n_components, self.max_... | |
ffef1ebc4037bdb7fa02 | def test_no_weights_cube_provided(self):
coord = "forecast_reference_time"
plugin = WeightedBlendAcrossWholeDimension(coord)
result = plugin.non_percentile_weights(self.cube, None)
blending_coord_length, = self.cube.coord(coord).shape
expected = (np.ones(blending_coord_length) /... | |
ffef244e5ddec4461c27 | def port(self) -> jsii.Number:
return jsii.get(self, "port") | |
ffef2dc739c074aac06a | def getNumberDensity(self, nucName):
return self.getNuclideNumberDensities([nucName])[0] | |
ffef441c09a0d2591096 | def reactivating_dice(self):
self.locked = False
self.set_enabled(True) | |
ffef61c4b1e00422a302 | def __merge(self): | |
ffef621e13d2facb1e7e | def gore_levo(self, tabla):
if self.x == 0 or self.y == 0:
return 0
if tabla[self.x - 1][self.y - 1] == self._crnopolje:
return 1
elif tabla[self.x - 1][self.y - 1]._boja == self._boja:
return 0
else:
return self.proveri_pojedi(-1, -1, tabl... | |
ffef7e786b6c1f2e071c | def split(self,dataset, ratio = 75):
self.train_size = int(len(dataset) * (ratio * .01))
self.test_size = len(dataset) - self.train_size
print(len(self.data))
self.train, self.test = dataset[0:self.train_size,:], dataset[self.train_size:len(dataset),:]
print("train size: {} and test size : {}".... | |
ffefa169cb7d7736bfc4 | def _set_bandwidth(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={'range': ['1..4294967']}), default=Restricte... | |
ffefb77734045bd97728 | def value_2_list(value: Any) -> Sequence:
if (not isinstance(value, (abc.Sequence, np.ndarray)) or isinstance(value, str)):
value = [value]
return value | |
ffefc3b789c076c42acb | def VerificationResult(self) -> _n_7_t_0: | |
ffefe872415d930f0f1f | def __init__(self, book_info, lang, title, content_url):
cpath = Config.value(Config.CONTENT) # book contents
self.book = book_info # identifier of the book
self.book_path = os.path.join(cpath, book_info.bookid, lang) # root path of the book
self.book_file = os.path.join(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.