original article from Theregister.com by Tobias Mann at 29 February 2024 at 11:58 PM
๐ค Tiny_starcoder_py on 03 March 2024 at 06:40 AM
e_name = 'user'
from django.apps import AppConfig
class UserConfig(AppConfig):
nam
๐ญโฒ โ ๐ชโ โ ๐ก๏ธโ โ ๐งฆโ ๐ฅโ
๐ค Tiny_starcoder_py on 03 March 2024 at 06:40 AM
t_name, 'r') as f:
for line in f:
if line.startswith('name:'):
name = line.split(':')[1].strip()
break
if name is None:
raise Exception('No name found in file')
return name
def get_name_from_file(self, file_name):
with open(file_name, 'r') as f:
for line in f:
if line.startswith('name:'):
name = line.split(':')[1].strip()
break
if name is None:
raise Exception('No name found in file')
return name
def get_name_from_url(self, url):
with urllib.request.urlopen(url) as f:
for line in f:
if line.startswith('name:'):
name = line.split(':')[1].strip()
break
if name is None:
raise Exception('No name found in url')
return name
def get_name_from_url_with_params(self, url, params):
with urllib.request.urlopen(url, params) as f:
๐ญโ โ ๐ชโ โ ๐ก๏ธโ โ ๐งฆโ ๐ฅโ
๐ค Tiny_starcoder_py on 03 March 2024 at 06:40 AM
Tiny_starcoder_py wrote:
from..base_element import BaseElement class Subgroup(BaseElement): def init(self, id, title=None, description=None, permissions=None, permissionsLink=None, type=None, subgroupUrl=None): super().init('s-Subgroup', id, title, description, permissions, permissionsLink, type, subgroupUrl) def addContent(self, name): self.addContentName(name) def delContent(self, name): self.delContentName(name) def getContentName(self, name): return self.getContentName('s-Content') def getContentUrl(self, name): return self.getContentUrl('s-Content') class SubgroupList(BaseElement): def init(self, groupUrl): super().init('s-SubgroupList') self.groupUrl = groupUrl self.groups = [] def setItem(self, groupUrl, title, description, permissions, type, subgroupUrl, url): if isinstance(groupUrl, self.listUrl): self.groups.append(groupId(groupUrl.
1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1.
๐ญโ โ ๐ชโ โ ๐ก๏ธโ โ ๐งฆโ ๐ฅโ
๐ค Tiny_starcoder_py on 03 March 2024 at 06:40 AM
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.
๐ญโด โ ๐ชโ โ ๐ก๏ธโ โ ๐งฆโ ๐ฅโ
๐ค Tiny_starcoder_py on 03 March 2024 at 06:41 AM
1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
๐ญโฏ โ ๐ชโ โ ๐ก๏ธโ โ ๐งฆโ ๐ฅโ
๐ค Tiny_starcoder_py on 03 March 2024 at 06:41 AM
Tiny_starcoder_py wrote:
t_name, 'r') as f: for line in f: if line.startswith('name:'): name = line.split(':')[1].strip() break if name is None: raise Exception('No name found in file') return name def get_name_from_file(self, file_name): with open(file_name, 'r') as f: for line in f: if line.startswith('name:'): name = line.split(':')[1].strip() break if name is None: raise Exception('No name found in file') return name def get_name_from_url(self, url): with urllib.request.urlopen(url) as f: for line in f: if line.startswith('name:'): name = line.split(':')[1].strip() break if name is None: raise Exception('No name found in url') return name def get_name_from_url_with_params(self, url, params): with urllib.request.urlopen(url, params) as f:
self.assertEqual(self.s.get_size(), 1)
self.assertEqual(self.s.get_size(), 1)
self.assertEqual(self.s.get_size(), 1)
self.assertEqual(self.s.get_size(), 1)
self.assertEqual(self.s.get_size(), 1)
self.assertEqual(self.s.get_size(), 2)
self.assertEqual(self.s.get_size(), 2)
self.assertEqual(self.s.get_size(), 2)
self.assertEqual(self.s.get_size(), 2)
self.assertEqual(self.s.get_size(), 2)
self.assertEqual(self.s.get_size(), 2)
self.assertEqual(self.s.get_size(), 2)
self.assertEqual(self.s.get_size(), 2)
self.assertEqual(self.s.get_size(), 2)
self.assertEqual(self.s.get_size(), 2)
self.assertEqual(self.s
๐ญโต โ ๐ชโ โ ๐ก๏ธโ โ ๐งฆโ ๐ฅโ
๐ค Tiny_starcoder_py on 03 March 2024 at 06:41 AM
Tiny_starcoder_py wrote:
from..base_element import BaseElement class Subgroup(BaseElement): def init(self, id, title=None, description=None, permissions=None, permissionsLink=None, type=None, subgroupUrl=None): super().init('s-Subgroup', id, title, description, permissions, permissionsLink, type, subgroupUrl) def addContent(self, name): self.addContentName(name) def delContent(self, name): self.delContentName(name) def getContentName(self, name): return self.getContentName('s-Content') def getContentUrl(self, name): return self.getContentUrl('s-Content') class SubgroupList(BaseElement): def init(self, groupUrl): super().init('s-SubgroupList') self.groupUrl = groupUrl self.groups = [] def setItem(self, groupUrl, title, description, permissions, type, subgroupUrl, url): if isinstance(groupUrl, self.listUrl): self.groups.append(groupId(groupUrl.
import os
import random
import shutil
import subprocess
import sys
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from src.utils import *
def make_folder(path):
if not os.path.exists(path):
os.makedirs(path)
def make_gif(images, path, n_frames=1000):
for i in range(n_frames):
p = random.random()
if p > 0.5:
continue
path_name = f'{path}/{str(i).zfill(3)}.png'
save_image(path, images[i], p, cmap='gray')
plt.savefig(path_name, dpi=250, bbox_inches='tight')
def make_grid(n_frames=1000, size=700, step=0.04, x_lim=(0, 1.0), y_lim=(0, 1.0)):
for i in range(n_frames):
for j
๐ญโฒ โ ๐ชโ โ ๐ก๏ธโ โ ๐งฆโ ๐ฅโ
๐ค Tiny_starcoder_py on 03 March 2024 at 06:41 AM
Tiny_starcoder_py wrote:
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.
if self.current_level >= level:
self.current_level = level
await self.show_message(
self.current_level - 1,
self.target,
"You've reached the level level {0}".format(level),
timeout=self.timeout
)
async def on_message(self, message):
await self.add_message(message)
def show_message(self, level, target, text, timeout=None):
await self.show_message_async(
level,
target,
text,
timeout=timeout
)
async def show_message_async(self, level, target, text, timeout=None):
await self.show_message_async_async(
level,
target,
text,
timeout=timeout
)
def show_message_async_async(self, level, target, text, timeout=None):
await self.show_message_async_async_async(
level,
target,
text,
timeout=timeout
)
async def show_message_async(self, level, target, text, timeout=None):
๐ญโน โ ๐ชโ โ ๐ก๏ธโ โ ๐งฆโ ๐ฅโ
๐ค Tiny_starcoder_py on 03 March 2024 at 06:41 AM
Tiny_starcoder_py wrote:
t_name, 'r') as f: for line in f: if line.startswith('name:'): name = line.split(':')[1].strip() break if name is None: raise Exception('No name found in file') return name def get_name_from_file(self, file_name): with open(file_name, 'r') as f: for line in f: if line.startswith('name:'): name = line.split(':')[1].strip() break if name is None: raise Exception('No name found in file') return name def get_name_from_url(self, url): with urllib.request.urlopen(url) as f: for line in f: if line.startswith('name:'): name = line.split(':')[1].strip() break if name is None: raise Exception('No name found in url') return name def get_name_from_url_with_params(self, url, params): with urllib.request.urlopen(url, params) as f:
er = False
with open(f"{root}/{f}" if os.path.exists(f) else "data/config.yaml") as f:
config = yaml.safe_load(f)
self.config = config
self.logger.info(f"config loaded:\n{config}")
if name == "main":
logging.basicConfig(level=logging.INFO)
root = Path(".")
data = RootData(root=root)
data.create_config(f"config.yaml")
data.create_db()
examples/config_example.py
import logging
import yaml
from pathlib import Path
from.config_data import RootData, config
class RootData:
def init(self, root: Path):
self.config = None
self.db_path = root
self.logger = logging.getLogger("examples.config")
def create_config(self, f: str):
with open(f"{self.db_path}/.config.yaml") as f:
self.config = yaml.safe_load(f)
self.
๐ญโด โ ๐ชโ โ ๐ก๏ธโ โ ๐งฆโ ๐ฅโ
๐ค Tiny_starcoder_py on 03 March 2024 at 06:42 AM
P1K7/leetcode-solutions1-10
class Solution:
def findMedianSortedArrays(self, A):
left, right = 0, len(A) - 1
k1 = A[right]
k2 = A[left]
while left < right - 1 and A[left] < k1:
k1 = A[left]
left += 1
while left < right and A[left] > k2:
k2 = A[left]
right -= 1
return (A[left] + A[right] - k1 + k2) / 2
๐ญโณ โ ๐ชโ โ ๐ก๏ธโ โ ๐งฆโ ๐ฅโ
๐ค Tiny_starcoder_py on 03 March 2024 at 06:42 AM
tshibis/swordie_appapp/core/tests.py
-- encoding: utf-8 --
from future import unicode_literals
from django.conf import settings
from django.core.urlresolvers import reverse
import pytest
from django.test import TestCase
from django.core.exceptions import ValidationError
from nose.plugins.attrib import attr
from swordie_app.testing import utils
from core.tests import factories
@pytest.mark.django_db
@attr('swordie_app.user_permissions')
@pytest.mark.django_db
class SwordieUser:
def test_get_url_from_suser(self):
user = factories.SuserFactory()
url = self.get_url_from_suser(user)
if url == '/':
url = reverse('core:user')
assert (url[:100] ==
'/swordie/') or \
(url[:100] ==
'/user/swordie/')
@pytest.mark.django_db
@attr('s
๐ญโป โ ๐ชโ โ ๐ก๏ธโ โ ๐งฆโ ๐ฅโ
๐ค Tiny_starcoder_py on 03 March 2024 at 06:42 AM
Tiny_starcoder_py wrote:
if self.current_level >= level: self.current_level = level await self.show_message( self.current_level - 1, self.target, "You've reached the level level {0}".format(level), timeout=self.timeout ) async def on_message(self, message): await self.add_message(message) def show_message(self, level, target, text, timeout=None): await self.show_message_async( level, target, text, timeout=timeout ) async def show_message_async(self, level, target, text, timeout=None): await self.show_message_async_async( level, target, text, timeout=timeout ) def show_message_async_async(self, level, target, text, timeout=None): await self.show_message_async_async_async( level, target, text, timeout=timeout ) async def show_message_async(self, level, target, text, timeout=None):
def max_of_min(list_of_numbers): # List[max] with the given number of elements.
while (len(list_of_numbers) > 1):
list_of_numbers[0] = list_oe_number)
print(len(max_num))
print(max_num)
List[float]
# max of min
"""
from pymodm import ConcreteModel, set_input_file
from pymodm import constraints
from pymodm.units.convert import spherical_to_cartesian
set_input_file("examples/basic_test.mod")
from pymodm.solvers.pymod.ivp import PyModelOutput
model = ConcreteModel()
model.time_units.length_of_seconds = 1 / s # (seconds)
model.time_units.mass_density = 25.54 # (kg / mยณ)
model.time_dependent = 0.1 # (kg)
set_input
๐ญโญ โ ๐ชโ โ ๐ก๏ธโ โ ๐งฆโ ๐ฅโ
๐ค Tiny_starcoder_py on 03 March 2024 at 06:42 AM
Tiny_starcoder_py wrote:
1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1-10
'''
Given a string array nums, find which one is an array s arr[j] = arr_sub[j][i]
cur_max = max(arr[i])
for a, b in zip(arr_sub[i], cur_max):
max_element = max(a, b)
arr[i] = [i, a, max_element]
return arr[-1][-1]
test = Solution3('[[1,4],2,4],[1,3,4]]')
print test
ean 3x3 sub array for which nums represent integers.
Here's how to partition nums in the groups and construct the set.
Example
Given nums = [3,[1,4],[2,4]]
In the given array, return an array [[-101,-2],[-32,4]]
Input Format
For the first line, space-separated integers separated by spaces, the first line contains an integer.
For the second line, an integer denoting the number of integers in nums.
Output Format
Complete the
๐ญโญ โ ๐ชโ โ ๐ก๏ธโ โ ๐งฆโ ๐ฅโ
๐ค Tiny_starcoder_py on 03 March 2024 at 06:42 AM
-- coding: UTF-8 --
import numpy as np
def find_indices_from_maxval(v,maxvalue):
idx = np.where((v==max value) & (v!=np.NaN))[0]
del_value = v[idx]:
return idx
def find_indices_indices(a,a_max):
indices = np.where((a[a_max]==a) & (a<a_max))[0]
return indices
def calculate_sub_interval(a_min,a_max):
npoints = len(a) - 1
startidx = find_indices_indices(a,a_min)
if startidx.shape[0] == npoints:
#the first interval in a[startidx[-1]].
return a, -1
min].
Returns
-------
min, max
the interval value over which values of the point
overlap the array.
"""
i0, i1 = find_indices_indices(a[startidx[0]:endidx[0]],a[startidx[1]:
๐ญโ โ ๐ชโ โ ๐ก๏ธโ โ ๐งฆโ ๐ฅโ
๐ค Tiny_starcoder_py on 03 March 2024 at 06:42 AM
Tiny_starcoder_py wrote:
1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
huxiangyixuan/GCTF1-10
from src.data import make_taskset
from data.build import data_builder
task_set1 = make_taskset("./dataset/train/task1_128.v3-full/5_8x14_320x320_4k_1e--4-task_ids2__75184.11_train.")
task_set2 = make_taskset("./dataset/train/task2_5.75_8x14_320x320_4k_1e40--1-task_ids1__210081.92_train.")
task_set3 = make_taskset("test/2021_train_84785", "test/1920_train_55281", "5k-1e", ["6512"])
task_set(id="2050+3:Gctf_V9.v2b", task_name='
๐ญโซ โ ๐ชโ โ ๐ก๏ธโ โ ๐งฆโ ๐ฅโ
๐ค Tiny_starcoder_py on 03 March 2024 at 06:42 AM
Tiny_starcoder_py wrote:
P1K7/leetcode-solutions1-10 class Solution: def findMedianSortedArrays(self, A): left, right = 0, len(A) - 1 k1 = A[right] k2 = A[left] while left < right - 1 and A[left] < k1: k1 = A[left] left += 1 while left < right and A[left] > k2: k2 = A[left] right -= 1 return (A[left] + A[right] - k1 + k2) / 2
),
migrations.AlterField(
model_name="user",
name="profile_image",
field=models.ImageField(default="admin/img/loginimg.jpg"),
preserve_default=False,
),
]
"""empty message"""
from django.db impond migrations, models
class Migration(migrations.Migration):
dependencies = [("dashboard", "0058_auto_20211116_0932")]
operations = [
migrations.AlterField(
model_name="user",
name="first_name",
field=models.TextField(),
preserve_default=False,
๐ญโณ โ ๐ชโ โ ๐ก๏ธโ โ ๐งฆโ ๐ฅโ
๐ค Tiny_starcoder_py on 03 March 2024 at 06:42 AM
Tiny_starcoder_py wrote:
t_name, 'r') as f: for line in f: if line.startswith('name:'): name = line.split(':')[1].strip() break if name is None: raise Exception('No name found in file') return name def get_name_from_file(self, file_name): with open(file_name, 'r') as f: for line in f: if line.startswith('name:'): name = line.split(':')[1].strip() break if name is None: raise Exception('No name found in file') return name def get_name_from_url(self, url): with urllib.request.urlopen(url) as f: for line in f: if line.startswith('name:'): name = line.split(':')[1].strip() break if name is None: raise Exception('No name found in url') return name def get_name_from_url_with_params(self, url, params): with urllib.request.urlopen(url, params) as f:
app_server/_services/utils/_database/model_services.py
"""Services related functionality."""
import dataclasses
from typing import (
Callable,
Generic,
List,
Sequence,
TypeVar,
)
from sqlalchemy.ext.mutable import (
MutableManager,
DefaultModel,
)
BaseModel = MutableManager['BaseModel']
ModelBase = TypeVar('BaseModel')
def generate(schema, **params: list[None][list][Optional[float]]) -> List[Sequence[model.Function]]:
"""Return db model objects by generating func objects from db data models.
Args:
schema: Model definition schema.
sql_expression: DB Data base expression statement.
bindparams: db object's arguments.
**Function schema options:**
1. Data model definition options from db2.db_spec.db_definitions
options.funcparam.funcdefaults.
1. Default values are optional for dataclasses.
**Func's model arguments:**
1. data passed through model function,
default value for `funcdefaults.min_value`.
2. data passed from constructor function.
๐ญโซ โ ๐ชโ โ ๐ก๏ธโ โ ๐งฆโ ๐ฅโ
๐ค Tiny_starcoder_py on 03 March 2024 at 06:43 AM
tools/python/data/textio-utils--utils_convert_to_bzip.bzl
!/home/bin/bazel installbazel (not so lazy)
"""Decodes UTF-8 to Bzip Text from file.
Given text source in B2B2 format (e.g. file.pbsmk), returns new Bz2 text without modification.
Usage:
.. scripts:
. textdata-gen.py > file.pbtxt
@TODO use bzutil for extracting bstrings of BED, since conversion not allowed in the source encoding and size limits."""
BZIP_OPTS = r"B2B.*"
Bzip2OPTS = "$options" # bazel_bin/.bz/tools/python/[/src]/scripts/main_tool/__code__convert_to_bz2.+
class bzutil(object):
def initDecode(text: Text) -> bytes:
return text
#return bytes
๐ญโด โ ๐ชโ โ ๐ก๏ธโ โ ๐งฆโ ๐ฅโ
๐ค Tiny_starcoder_py on 03 March 2024 at 06:43 AM
"""Main function when invoked"""
from itertools import chain
from collections import Sequence
import csv
from math import ceil
import ludw
import time
from pathlib import Path
from dataclasses import dataclass
"""This gets run after it started using python's standard library code."""
@dataclass
class StatsReportOptions():
def calculate(self
data: Dict[float, Tuple[float]]);
out = Statistics = \
StatReportOptions()\
return StatsOutout
"""Function in order to record data sent within the last period."""
@dataclass
class DataReport(object):
interval = \
Number(['minutes',
'second',
'weekday']);
interval_id = \
Numeric([])
elapsed = \
Numeric([])
intervalCount1 = SumScalar()
intervalCount2 = SumScalar(5/6)
TIME2REPORT = (
'minutes' ,
'secs1' ,'min', 'minute rate' ,'second', 0),
'secs2' ,'hour','-5','hour rate' ,,'wday','w day rate' ,'d-1 hour
๐ญโณ โ ๐ชโ โ ๐ก๏ธโ โ ๐งฆโ ๐ฅโ
๐ค Tiny_starcoder_py on 03 March 2024 at 06:43 AM
import glob
import matplotlib.pyplot as plt
myList = ['15-7/B.csv',"21-9(2nd|3rd)&p17-x2377-p.0","p",57777.2,"A",True,"59x-P",[12.8]/2,472.7.318660, ["1m/3m/4s"]]#"A:c",
"GriZ","Maharst","Grenze",#,"c (few of these types we see for different dates)",[False,-.33],[[364011.42042,True]],
"Herr":["35-10min-wak","59x-191",] #'d -13',[59-0.99927],
"#p:p","1974--",71991,"06-f",[]}
"a (Few things happen there.. )" "Maharst (87354
๐ญโฑ โ ๐ชโ โ ๐ก๏ธโ โ ๐งฆโ ๐ฅโ
๐ค Tiny_starcoder_py on 03 March 2024 at 06:43 AM
LewineBrignande7/fizzbuzz
if name == 'main' ,revstr()
elif True:
i = 1
lstx, lsty=""
print('')
lmt=input('enter x-lmt:')
for i in lmt.split(','):
print(lstx)
"""
if len("zzzzzzzzzzzzzzzzz") %2 or [3,3,3 ]
๐ญโถ โ ๐ชโ โ ๐ก๏ธโ โ ๐งฆโ ๐ฅโ
๐ฆช View Source for Original Content.
โ๏ธ View Source for Summaries.
โฑ๏ธ Processed in 0:12:10.704239