ngram
listlengths
0
67.8k
[ "= np.array(data) data[data == ''] = np.nan data = data.astype(float) dataDict = {}", "correction_spectrum = Spectrum.CLSpectrum(spectrum_interp, wavelengths) return correction_spectrum class WavelengthCorrectionFactor(object): def __init__(self, grating, center_wavelength): self.grating", "0], d[:, 1]) correct...
[ "False # Token was successfully validated return True def generate_token(email=None): \"\"\" Returns a", "the registered email address.\\n Keyword Arguments: token -- Token passed in the user's", "not isinstance(email, str) or len(email) == 0: print(\"Error: Invalid Email address passed\") return", "def valid...
[ "/) \"\"\" html = super(MarkdownEngine, self).convert(text) soup = BeautifulSoup(html, 'html.parser') # Add classes", "for the evennia_wiki. This pre-loads some common extensions and allows some inner processing.", ". We assume an absolute # URL (/) means a wiki page. for", "MarkdownEngine(Markdown): \"\"\"A ...
[ "# '''data is a list of pairs (lemma, form) # ''' # terms", "== '__main__': # if len(sys.argv) != 2: # print('Usage: python generate_cannonical.py <csv file>')", "== 'A' and msd[3] == 'm': form = lem_adj('m', el.text.lower()) canon.append(form) elif msd[0]", "= lem.lemmatize(head2.text.lower()) return head_fo...
[ "props: print(f\"No properties for shift abbrevation: {abbr}\") continue except KeyError: print(f\"Shift abbrevation not", "= Event() e.name = shift.properties.name e.begin = shift.beginning e.duration = shift.properties.duration c.events.add(e) return", "from_dict( cls, input: dict[str, str], mapper: Optional[...
[ "-- BEGIN as_it_is = content3.split('==References==', 1) as_it_is = as_it_is[1] as_it_is = as_it_is.replace('</p>', '\\n')", "i = 3 while i != 100000: ArtName = raw_input('\\n\\ntype the name of", "'') art = art.replace('<span class=\"mw-headline\"', '\\n==<') art = re.sub('\\<.*?\\>','', art) art = re.sub('\\o...
[ "/ (1.0 + 10 ** ((rating1 - rating2) / 400)) def ComputeDeltaRating(ratingPlayer1: float,", "pow(10, ((ratingPlayer1 - ratingPlayer2) / 400)))) P2 = (1.0 / (1.0 + pow(10,", "((ratingPlayer2 - ratingPlayer1) / 400)))) #return (isWinPlayer1 - P2), (1 - isWinPlayer1 -", "-> float: P1 = (1.0 / (1.0 + pow(10, ((ra...
[ ", before.channel.name, \"から\" , member.name , \"#\" , member.discriminator , \"さんが抜けました\") data[\"Flag\"] =", "= datetime.strftime(filetime,'%Y') month_filename = '{0}{1}'.format(m_year, m_month) mv_filename = CSetting.baseLogFolder + CSetting.JSONPATH_row + month_filename", "+\"月の音声チャンネルログイン生データ\" await Sendt...
[ "docstring \"\"\" import json from fastapi import APIRouter from app.routers.files import get_document_path from", "document_file: document_data = json.load(document_file) return document_data @router.post(\"/{document_name}\") async def save_document_content( workspace_name: str, document_name:", "@router.post...
[ "ans = chr(carry % 2 + ord('0')) + ans carry //= 2 return", "str) -> str: carry, ans = 0 , '' for i in range(max(len(a),", "= \"Bannings\" class Solution: def addBinary(self, a: str, b: str) -> str: carry,", "- ord('0') if i < len(b) else 0 ans = chr(carry % 2", "b: str) -> str: carry, ans = 0 , '' for i in...
[]
[ "of cards currently in the dealer's hand. If the dealer currently has a", "return round_complete def settle_bet(self, player_hand, player_obj): \"\"\" Method settles any bets at the", "round_complete else: round_complete = True bet_amount = player_hand.get_bet() if self.is_natural() and not player_hand.is_natur...
[ "to be used as cut-off for removing rare words to be specifiied here.", "contain all images stored in h5py format and captions stored in json files.", "stored in h5py format and captions stored in json files. Minimum word frequencies", "import create_input_files \"\"\" To create files that contain all images ...
[ "def __init__(self,table_file): self.master_table=pd.read_csv(table_file).sort_values(\"Info\",ascending=False) def get_filtered_table(self,low_freq,high_freq,delta_freq,target): low_freq=float(low_freq) high_freq=float(high_freq) delta_freq=float(delta_freq) table=self.master_table[self.master_table[\"Target\"]==t...
[ "= [] for value in range(1, 11): squares1.append(value**2) print(squares1) # With list comprehension", "for value in range(1, 11): squares1.append(value**2) print(squares1) # With list comprehension squares2 =", "value in range(1, 11): squares1.append(value**2) print(squares1) # With list comprehension squares2...
[ "new_state_dict[name] = v return new_state_dict if __name__ == '__main__': net = CRAFT() net.load_state_dict(copyStateDict(torch.load(\"/Volumes/storage/resources/models/paddle-ocr-models/craft_mlt_25k.pth\",", "def copyStateDict(state_dict): if list(state_dict.keys())[0].startswith(\"module\"): start_idx = 1 els...
[ "Comment(\" \"), Sequence(\"Y\", Choice(0, Comment(\" \"), \"~u\"),)), \")\" )) add(\"EGFR.EGFR\", Diagram(\"EGFR(\", Choice(0, Comment(\"", "\"), \"~B\"),)), \")\",\"EGFR(\", Choice(0, Comment(\" \"), \"ecd\",), Choice(0, Comment(\" \"), Sequence(\"Y1\", Choice(0, Comment(\"", "Comment(\" \"), \"~u\", \"~p\"),...
[ "\"-\", label=\"m_x\") ax.plot(zs, m_zs[:, 2], \"-\", label=\"m_z\") ax.set_xlabel(\"z (nm)\") ax.legend(loc=\"upper left\") plt.savefig(os.path.join(MODULE_DIR, \"profile.png\"))", "strength J/m Km = 0.5 * mu0 * Ms**2 # magnetostatic energy density", "zs = np.linspace(0, Lz, points) axis_zs = np.zeros((points,...
[ "user = models.OneToOneField( UserModel, on_delete=models.CASCADE, primary_key=True ) subscribers = models.ManyToManyField( UserModel, related_name='subscribers', blank=True,", "validate_image UserModel = get_user_model() class Profile(models.Model): username = models.CharField( max_length=30 ) profile_picture ="...
[ "in gene_list: seq = str(fa_dict[D[gene][0]][D[gene][1]:D[gene][2]].seq) wl = '>%s\\n%s\\n' % (gene, seq) outfile.write(wl) outfile.close()", "'\\n': continue fl_list = fl.split() gene = fl_list[c-1] if g == 'T': gene", "prog='SeqGeter', usage='PROG [options]') parser.add_argument('-i', help='file contains gene...
[ "settings.THE_BLUE_ALLIANCE_KEY api_instance = tbaapiv3client.TeamApi(tbaapiv3client.ApiClient(configuration)) try: api_response = api_instance.get_team_events(\"frc\" + str(teamkey)) info = api_response", "api_response return info except ApiException as e: return None def get_team_events(teamkey): configuration ...
[ "dates = [np.datetime64(x) for x in dates] if mytype=='xda': dates = xr.DataArray(np.array(dates)) elif", "from .test_common import all_mds_datadirs, get_test_ds @pytest.mark.parametrize(\"mytype\",['xda','nparr','list','single']) def test_extract_dates(mytype): dints = [[1991,8,9,13,10,15],[1992,10,20,8,30,5]] d...
[ "import PromptToolkitSession, PromptToolkitSSHServer # __all__ = [ # \"PromptToolkitSession\", # \"PromptToolkitSSHServer\", # ]", ".server import PromptToolkitSession, PromptToolkitSSHServer # __all__ = [ # \"PromptToolkitSession\", # \"PromptToolkitSSHServer\", #", "# from .server import PromptToolkitSession,...
[ "'C9300 48P DNA Advantage':{ 'entitlement':'C9300-48 DNA Advantage', 'count':'2', 'status':'AUTHORIZED' }, 'C9300 48P Network", "DNA Advantage':{ 'entitlement':'C9300-48 DNA Advantage', 'count':'2', 'status':'AUTHORIZED' }, 'C9300 48P Network Adv...':{ 'entitlement':'C9300-48", "'license_usage':{ 'C9300 48P DNA...
[ "osp import policy_generator as pg import matplotlib import matplotlib.pyplot as plt matplotlib.use(\"pgf\") matplotlib.rcParams.update({", "model = UserModel.UserModel() return model def get_policy(example_path): Generate_policy = module_from_file(\"Generate_policy\", osp.join(example_path,'Generate_policy.py'))...
[ ":type length: int :return: \"\"\" self.send_message(\"setState,%s,%d\" % (name, length)) self.get_message(code=\"setState\") def remove_state(self, name):", "something on the message stack :param code: :return: str \"\"\" if len(self.message_stack) >", "# pylint: disable=too-many-arguments def create_item(self...
[ "--------------------\") print(\"a - Apply the Custom Harris Corner Detector to an image\") print(\"b", "Gaussian Filter Sigma Effect\") print(\"g - Use Bilateral Filter\") print(\"h - Visualize Bilateral", "3x3 Kernel and Apply Threshold\") print(\"e - Use Prewitt Filter\") print(\"f - Use", "if _opt == \"a\...
[ "in range(len(row)): if i != 0: output += \" \" + str(row[i]) output", "1: row[4] = 2 else: row[4] = 1 if max(csvArray[row[1]][9], csvArray[row[1]][12]) == 0:", "in pedArray: output = str(row[0]) for i in range(len(row)): if i != 0:", "1: row[5] = 2 else: row[5] = -9 file = open(sys.argv[3], 'a') output", "...
[ "\\ urllib.parse.quote(current_time) + '-yellowgreen)' + '\\n\\n' complete_text = header + all_articles with open('README.md',", "%H:%M:%S %Z' RSS_FEEDS = ['https://jimit105.medium.com/feed', 'https://jimit105.github.io/pytricks/rss.xml', 'https://scitech105.blogspot.com/rss.xml', 'https://jimit105.github.io/medi...
[ "django.db import models class Book(models.Model): title = models.CharField(max_length=36, unique=True) description = models.TextField(max_length=256, default=None)", "<reponame>Munduruca/django from django.db import models class Book(models.Model): title = models.CharField(max_length=36, unique=True) description...
[ "async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: \"\"\"Unload a config entry.\"\"\" if", "from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady from homeassistant.helpers.aiohttp_client import async_get_clientsession from .const import DEFAULT_POLL_INTERVAL...
[ "= int(input()) cards = list(input().split()) deck = [] if len(cards) % 2 ==", "range(mid): deck.append(cards[i]) deck.append(cards[i + mid]) else: mid = len(cards) // 2 for i", "test_cases + 1): n = int(input()) cards = list(input().split()) deck = [] if", "// 2 for i in range(mid): deck.append(cards[i]) dec...
[ "# Copyright 2017 <NAME> # # Licensed under the MIT License. If the", "If the LICENSE file is missing, you # can find the MIT license", "attach routes and custom error pages here # from .main import main as", "create_app(config_name): app = Flask(__name__) app.config.from_object(config[config_name]) config[co...
[ ">= 0.75).any()) class RewardSpec(NamedTuple): reward_min: float reward_max: float zero_sum: bool only_once: bool #", "reward_max=1. / GAME_CONSTANTS[\"PARAMETERS\"][\"MAX_DAYS\"], zero_sum=False, only_once=False ) def __init__( self, positive_weight: float = 1.,", "self.n class CollectNUranium(Subtask): def __...
[ "def Jacobian(v): J = np.zeros(shape=(2, 2)) J[0][0] = -1/R - (Isa / Vt)", "teh current voltage values eff = F(Vnew) # calculate the value of the", "val[2] ans = val[3] print(\"------------------------------------\") print(ans[7]) # Plot the 10log_10 of dV x_val", "if __name__ == \"__main__\": error = 10e-15 ...
[ "License. * You may obtain a copy of the License at http://opensource.org/licenses/MIT *", "# -*- coding: utf-8 -*- \"\"\" * TencentBlueKing is pleased to support the", "specific language governing permissions and limitations under the License. \"\"\" import tempfile as", "the License. \"\"\" import tempfile ...
[ "path from hackerhub import views app_name = 'hackerhub' urlpatterns = [ # path('hackathons/',", "import views app_name = 'hackerhub' urlpatterns = [ # path('hackathons/', views.hackathonList, name='hackathonList'), ]", "from django.urls import path from hackerhub import views app_name = 'hackerhub' urlpatterns...
[ "uniform grid (with L = 1) variable. Assumes that the field is split", "returns div X = x_dx + y_dy + z_dz \"\"\" return MPIderiv2(comm,X[0],0) +", "left slice of local proc as right slab to follow proc rightSlice =", "= None leftSlice = comm.sendrecv(sendobj=var[:,-1:,:],dest=next_proc,source=prev_proc) # se...
[ "1. Print row 1 (remember, indexing starts at zero) of A. print(A[0,:]) #", "Then, reshape B to make it look like A again. C = B.reshape((4,4))", "you do B = np.ravel(A). B = np.ravel(A) print(B) # 2. Look of", "# Create vector b b = np.array([1.1, 2.3, 3.3, 3.9]) # 1. Print", "# Practice 1 # Generate array...
[ "not len(f.read())<2: for l in f.read(): sessions.append(l) f = open('.sessions', 'w') r='' for", "f.read(): sessions.append(l) f = open('.sessions', 'w') r='' for s in sessions:r+=s f.write(r) f.close()", "display_name, conn): self.display_name = display_name self.conn = conn self.id = conn.id def load_session...
[ "blender_async.open_file_dialog() print(file_name) await sleep(1) results = await blender_async.open_dialog(TestDialog) print(results) await sleep(1) loop =", "= bpy.props.BoolProperty(name=\"Toggle Option\") my_string = bpy.props.StringProperty(name=\"String Value\") async def example(): await sleep(1) file_name...
[ "#col = list(banks.columns) bank_mode.loc[0,:] banks.isnull().sum() #for x in banks.columns.values: # banks[x]=banks[x].fillna(value=bank_mode[x].loc[0]) ##banks =", "# Import packages import numpy as np import pandas as pd from scipy.stats", "Code starts here banks[['Gender','Married', 'Self_Employed','LoanAmo...
[ "for loop to go from 1 -10 random_number = random.randint(1, 6) # ranint", "pick between 1 and 6 print(random_number) # print the # that was saved", "random_number = random.randint(1, 6) # ranint pick between 1 and 6 print(random_number) #", "6) # ranint pick between 1 and 6 print(random_number) # print the #...
[ "out return inner def _init_project(self, config_path): if not Path(config_path).is_file(): raise Exception(\"invalid config path:", "!= None: print(\"Atempting to process {} from raw text\".format(name)) try: P = centroid_protein.CentroidProtein(name,", "as config_file: config = json.load(config_file) self.dis...
[ "KIND, either express or implied. # See the License for the specific language", "Unless required by applicable law or agreed to in writing, software # distributed", "client): \"\"\"Echo machine can be staeted and stopped\"\"\" resp_create = client.post('/v1/tasks', json=self.ECHO_MACHINE) task_created", "400 ...
[ "match.group('number'), match.group('description').strip(), Directive(match.group('directive'))) def _parse_version(self, match): version = int(match.group('version')) if version < self.TAP_MINIMUM_DECLARED_VERSION:", "a matching plan line.\"\"\" expected_tests = int(match.group('expected')) directive = Directive...
[ "for i in range(len(domains)): counter[\".\".join(domains[i:])] += int(count) return [\" \".join((str(v), k)) for k,", "i in range(len(domains)): counter[\".\".join(domains[i:])] += int(count) return [\" \".join((str(v), k)) for k, v", "<filename>solutions/python3/811.py<gh_stars>10-100 class Solution: def subd...
[ "data_analizar=data_completo data_analizar=data_analizar[data_analizar['PERIODO']<=2018] data_clustering = pd.read_excel(\"../../Andres/cluster/clustering.xlsx\") data_clustering=data_clustering[['BARRIO','cluster']] data_clustering = data_clustering.apply(lambda x: x.str.strip() if(x.dtype ==", "unidecode import...
[ "self.wiser_hub_ip = '192.168.1.171' self.base_url = url = \"http://{}/data/domain/\".format(self.wiser_hub_ip) self.token = \"<PASSWORD>\" self.source_data_file =", "filename = os.path.dirname(__file__) with open(os.path.join(filename, 'data/%s' % json_file), 'r') as f: return f.read()", "os import unittest im...
[ "str(html); pattern1 = '<div id=\"plist\".+? <div class=\"page clearfix\">'; rst1 = re.compile(pattern1).findall(html); rst1 =", "1; for imageurl in imagelist: imagename = \"Desktop/jd/\"+str(page)+\"-\"+str(x)+\".jpg\"; pattern3 = '//.+?\\.jpg'; imageurl =", "#!/usr/local/bin/python3 #encoding:utf8 ''' 作用:爬取京东...
[ "= [ path(\"\", views.home, name=\"home\"), #path(\"<name>\", views.mainPage, name=\"main\"), path(\"about/\", views.about, name=\"about\"), #path(\"contact/\", views.contact,", "views.about, name=\"about\"), #path(\"contact/\", views.contact, name=\"contact\"), path(\"home/\", views.home, name=\"main\"), path(\"...
[ "find_owner_c_details_2_0(): return render_template('user-find-owner/property-details-2.1-c.html', next_page=\"/find-owner/c/verify\") # Sub flow - GOV.UK Verification --------------------- # GOV.UK", "flow - card payment --------------------- # GOV.UK pages, accept cost to view register", "render_template('spr...
[ "keys,values in param.items(): print(keys) print(values) print \"Rejection rate: %.3f +- %.3f (%d /", "test time: %.5f sec\" % average_time os.chdir('..') #Minor: need to change the above", "counter, numTrials) print \"Average test time: %.5f sec\" % average_time os.chdir('..') #Minor: need", "\"results.bin\"...
[ "name='order', field=models.PositiveIntegerField(default=1000), ), migrations.AddField( model_name='articlecategory', name='order', field=models.PositiveIntegerField(default=1000), ), migrations.AlterField( model_name='article', name='categories', field=models.ManyToManyField(blank=True, through='help.ArticleCatego...
[ "in Fahrenheit): \") faren = float(faren) # The calculation on the right gets", "cel = 5./9. * (faren - 32.) print \"The temperature in Celcius is", "float(faren) # The calculation on the right gets saved to the variable on", "the temperature in Fahrenheit): \") faren = float(faren) # The calculation on the",...
[ "path from .views import Run, CheckRunStatus, CallbackRunNow, \\ CallbackSubmission urlpatterns = [ path('run',", "CallbackSubmission urlpatterns = [ path('run', Run.as_view()), path('run/<int:id>', CheckRunStatus.as_view()), path('callback/run/<int:sub_id>', CallbackRunNow.as_view()), path('callback/submit/<int:...
[ "django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations =", "설명')), ('charge', models.BooleanField(default=False, help_text='유료 보드인지를 나타냅니다. MVP 단계에서 사용되지 않습니다.', verbose_name='유료보드 설정 여부')),", "on ...
[ "return part_func def max_likelihood_bruteforce(model): \"\"\"Evaluates most likely state in a very inefficient way.\"\"\"", "the model. :param domain: Default domain of each variable. \"\"\" self.num_variables = num_variables", "get_factors(self) -> Iterable[Factor]: \"\"\"Returns all factors.\"\"\" def get_sy...
[ "// 2 image.anchor_y = image.height // 2 player_image = pyglet.resource.image(\"ship.png\") bullet_image = pyglet.resource.image(\"player.png\")", "points\"\"\" return math.sqrt((point_1[0] - point_2[0]) ** 2 + (point_1[1] - point_2[1]) ** 2)", "import math from pyglet.window import key score = 0 game_window = ...
[ "If previous entries exist, replace the ones displayed # (up to 4 latest)", "= tk.Label( top_window, text=\"Let me know when:\", font=FONT) amount_label.grid(sticky=\"nw\", padx=5, pady=5) label =", "for active or sold shares. After viewing or editing you can save changes", "= manage_db.fetch_alarm(prof) choi...
[ "negatives def is_valid_IP(str): nums = str.split('.') return (len(nums) == 4) and all(is_valid_octet(n) for", "nums = str.split('.') return (len(nums) == 4) and all(is_valid_octet(n) for n in nums)", "<reponame>SelvorWhim/competitive<gh_stars>0 def is_valid_octet(n_str): return n_str.isdigit() and (n_str[0] !=...
[ "int): return ''.join(random.choices(string.ascii_uppercase + string.ascii_lowercase + string.digits, k=count)) def rreplace(s, old, new, occurrence=-1):", "key, value in data.items(): if isinstance(value, dict): value = pythonify(value) elif isinstance(value, list):", "k=count)) def rreplace(s, old, new, occur...
[ "= [] for xtype in edge_types: df = getattr(inp, xtype, None) if df", "create_using=None): \"\"\"Create new nx.Graph-like object from a SWMM5.1 inp file Parameters ---------- inp", "target='outlet_node', edge_attr=True, create_using=create_using, ) df_node_attrs = pandas_node_attrs_from_swmm_inp(inp=inp).to_dic...
[ "with open(filename, 'rb') as rom: self.bytes = bytearray(rom.read()) def get_bytes(self, from_index: int, to_index:", "in the HexEditorInstance? return self.bytes[from_index:to_index] def get_byte(self, index: int) -> int: return self.bytes[index]", "import RomVariant from tlh import settings class Rom: def __...
[ "or else it throws deprecation warnings \"\"\" pass class PreferencesForm(forms.Form): general_contact = forms.BooleanField(label='Yes,", "activity in Houses that I am a member of.', required=False) promo_contact = forms.BooleanField(label='Yes,", "about events, new features, and other promotional information.'...
[ "t = TemplateResponse(request, 'security/fail2ban_blocklist_ajax.html', {'d': d, 'number': number}) t.render() rs[\"aaData\"].append(re.findall(re_str, t.content, re.DOTALL)) number", "fail2ban_whitelist_ajax(request): data = request.GET order_column = data.get('order[0][column]', '') order_dir = data.get('order[...
[ "{thisAPI}:\\n\") \\ .info() \\ .append(thisAPI.get_printable_output(data)) \\ .warning() \\ .append(\"Do you want to try:", "(str): manpage description for most relevant manpage w.r.t. forum Returns: confidence (float): confidence", "in src_sequence.split()]) tgt_tokens = set([x.lower().strip() for x in tgt_se...
[ "path: Path to last valid command. children_names: Names of valid commands found at", "# Matching command that expects a subcommand, let's advance to # next level", "commands, e.g. ['orchestrate', 'images'] loader: Object that can load the module containing the", "KIND, either express or implied. # See the Li...
[ "\"\"\" def get(self, keyword,start=0): \"\"\"获取百度搜索结果 >>> get(keyword) \"\"\" mb = MagicBaidu() li=[] for", "= text # self.salary = salary # Employee.empCount += 1 # \"\"\" 你的", "print('kaishi') # self.text = text # self.salary = salary # Employee.empCount += 1", "百度搜索结果抓取 使用https://github.com/napoler/MagicB...
[ "Camera, CameraControl, getCameraDevices from .camlabel import CamLabel from PyQt5.QtCore import pyqtSlot from PyQt5.QtGui", "w.setLayout(vbox) hbox = QHBoxLayout() hbox.addWidget(QLabel(\"Camera:\")) self.cameraComboBox.currentIndexChanged.connect(self.cameraChangedSlot) hbox.addWidget(self.cameraComboBox) hbox....
[]
[ "# Do basic addition with tensors o1 = pa + pb o2 =", "arguments for targeting the IPU cfg = IPUConfig() cfg.auto_select_ipus = 1 cfg.configure_ipu_system() with", "= sess.run(result, feed_dict={ pa: [1., 1.], pb: [0., 1.], pc: [1., 5.] })", "pc) with tf.Session() as sess: # Run the graph through the session ...
[ "new_pt(*values): return np.array(values or (0, 0, 0), dtype=float) def vec_mag(vec: np.array): return np.sqrt(vec.dot(vec))", "'assets', name) def new_pt(*values): return np.array(values or (0, 0, 0), dtype=float) def vec_mag(vec:", "= getattr(sys, '_MEIPASS', '.') def get_sfx(name): return join(assets_root, '...
[ "(str): Brand owner for the food require_all_words (bool): When True, the search will", "d.pop(FoodDataType.FOUNDATION, False), FoodDataType.SURVEY.value: d.pop(FoodDataType.SURVEY, False), FoodDataType.BRANDED.value: d.pop(FoodDataType.BRANDED, False), FoodDataType.LEGACY.value: d.pop(FoodDataType.LEGACY, False)...
[ "cirq.Circuit() H1 = cirq.H(qubits[0]) H2 = cirq.H(qubits[1]) H3 = cirq.H(qubits[2]) H4 = cirq.H(qubits[3])", "H2 = cirq.H(qubits[1]) H3 = cirq.H(qubits[2]) H4 = cirq.H(qubits[3]) H5 = cirq.H(qubits[4]) C1", "= cirq.Moment([X5]) #circuit circuit = cirq.Circuit((moment1, moment2, moment3, moment4, moment5 ,momen...
[ "\"\") # print('result_dic44444', result_dic) return result_dic # generate result_dic def params_to_dic(dsl_params, def_key=\"selector\"): \"\"\"", "(val, param_name) in args: if val is not None: items.append(val) elif hasattr(context, param_name):", "match_obj_group_1.group(2) ] = match_obj_group_1.group(3) el...
[ "if x != y: e = e + 1 result.append((u,v)) union(G, x, y)", "if i > len(sortedges) - 1: return [] u,v = sortedges[i] i =", "e = e + 1 result.append((u,v)) union(G, x, y) # Else discard the", "List.remove(temp) MST.remove(tuple(temp.graph['MST'])) Partition(temp, List, MST) for edges in output: P = nx.Graph() ...
[ "ang_sep = self.abs_sys.coord.separation(self.galaxy.coord).to('arcmin') kpc_amin = cosmo.kpc_comoving_per_arcmin( self.galaxy.z ) # kpc per arcmin self.rho", "\"\"\" #;+ #; NAME: #; cgm.core #; Version 1.0 #; #; PURPOSE: #;", "None: from astropy.cosmology import WMAP9 as cosmo if verbose is True: print('cgm.co...
[ "send_mail import time def send_student_email_from_template(template_id, student_id, override_email=None): time.sleep(1) #Make an e-mail take at", "{count:} people: \\n\\n{addresses:}\".format(count=len(addresses), addresses=\"\\n\".join(addresses)) send_mail(\"Message confirmation\", body, \"<EMAIL>\", to_addres...
[ "assert (<Foo value='c' />.value) == 'c' with pytest.raises(InvalidPropChoiceError): <Foo value='c' /> def test_boolean_is_not_validated_in_non_dev_mode():", "finally: PropTypes.__dev_mode__ = True # force restore the normal state def test_choices_are_not_checked_in_non_dev_mode(): class", "not PropTypes.__in_d...
[ "class Solution: # @param matrix, a list of lists of integers # RETURN", "else: y = 0 rows = [1]*x cols = [1]*y for i in", "= len(matrix[0]) else: y = 0 rows = [1]*x cols = [1]*y for", "for i in range(x): for j in range(y): if matrix[i][j] == 0: rows[i]", "in range(x): for j in range(y): if matrix[i][j] == ...
[ "inline=False, ) Embed.set_footer(icon_url=author.avatar_url, text=str(author)) return Embed async def create_plotrating_help_embed(author): \"\"\" Displays an embed", "double quotes.', inline=False, ) Embed.set_footer(icon_url=author.avatar_url, text=str(author)) return Embed async def create_upcoming_help_embed...
[ "True io = m.IO(I0=m.In(m.Bit), O0=m.Out(m.Bit), O1=m.Out(m.Bit)) io += m.ClockIO() io.O1 @= io.I0 class", "check_files_equal def test_ignore_unused_undriven_basic(): class Main(m.Circuit): _ignore_undriven_ = True io = m.IO(I=m.In(m.Bit), O=m.Out(m.Bit)) temp", "io.I1 io.O0 @= foo.O0 m.compile(\"build/test_ign...
[ "headers)) # type: ignore html_rows = table.find_all(\"tr\") data: Dict[str, DataTuple] = {} for", "import Optional, List, NamedTuple, Dict, Any import requests import bs4 GENO_REGEX = re.compile(r\"\\(.;.\\)\")", "data_str = \"\".join(c for c in data_str if c not in [\"(\", \";\",", ") class SNP: def __init_...
[ "n = len(rank) mate = np.zeros(n, dtype=np.int16) mate[::2] = half_tournemant(rank, cdist) mate[1::2] =", "- len(index))] index.extend([last[i] for i in delta_n]) return pop_dec[index,:], pop_obj[index,:], pop_cstr[index], [pop_data[i] for", "if needed. cost_fun() is defined for multi-objective multi-constraint...
[ "generateFermi(self): for i in range(0,self.nParticles): self.below_fermi.append(i) for j in range(self.nParticles, self.nSpStates): self.above_fermi.append(j) def", "= statesIn self.nParticles = particlesIn self.below_fermi = [] self.above_fermi = [] self.states =", "self.nSpStates = statesIn self.nParticles =...
[ "100: speed = 100 if speed < -72: speed = -72 kit.servo[esc_pin].angle =", "throttle_full_reverse = 0 steering_pin = 15 esc_pin = 14 frontdiff_pin = 11 reardiff_pin", "if output == None: return default else: return float(output) rear_diff_locked = int(rget_and_float('rear_diff_locked', 1))", "rget_and_float('...
[ "rho, wrho = correlations(points, weights) x.append(im_de.name) y1.append(rho) y2.append(wrho) ax.xaxis.set_major_formatter(dts.DateFormatter('%b')) # %d ax.yaxis.set_major_locator(tckr.MultipleLocator(0.1)) ax.plot(x,", "len(z)-1+0.1)) ax_leg.set_ylim((0, 1)) # variable thickness line (BEGIN) lwidths = [1*np.log...
[ "from utilities.models import BaseDateTime class Contact(BaseDateTime): title = models.CharField( _('TITLE_LABEL'), max_length=255 ) name", "from django.utils.translation import ugettext_lazy as _ from utilities.models import BaseDateTime class Contact(BaseDateTime): title", "from django.db import models from d...
[ "verbose: `True` to increase verbosity \"\"\" def __init__(self, cache_dir: str = DEFAULT_CACHE_DIR): self.dataset_name", "coherence. It contains user-generated texts from Reddit and Wikipedia. Annotation labels are: *", "download_dataset, _unzip_process_func, DATASETS class DDisco: \"\"\" Class for loading the...
[ "me.set_up((1,2,3,4,5,6,7,8,9),TREASURE_MAP) print(len(me.inp)) for c1, f1, d1 in update_order('MOVE N'): print(\"c1 {} f1 {}", "StalkAndTorpedo(me) print(len(me.inp)) def _small_read_and_update(self): me = StalkAndTorpedo(None) me.set_up((1,2,3,4,5,6,7,8,9),TREASURE_MAP) print(len(me.inp)) for c1, f1, d1", "{}...
[ "[ BiT_S_R50x1, # Bad weights # BiT_S_R50x3, BiT_S_R101x1, BiT_S_R101x3, BiT_S_R152x4 ] MODEL_LIST_M =", "x = image.img_to_array(img) return np.expand_dims(x, axis=0) def _assert_shape_equal(shape1, shape2): if len(shape1) != len(shape2):", "preprocess_input(x) # preds = model.predict(x) # label = np.argmax(pre...
[ "validate(folder, gt_folder): patient_ids = subfiles(folder, suffix=\".nii.gz\", join=False) pred_gt_tuples = [] for p in", "num_threads=3) if __name__ == \"__main__\": import argparse parser = argparse.ArgumentParser(description=\"Computes metrics scores for", "subfiles(folder, suffix=\".nii.gz\", join=False) ...
[ "step_size = 1 while True: pwm.set_pwm(0, 0, pulse) if pulse < servo_max and", "pulse = servo_min increasing = True step_size = 1 while True: pwm.set_pwm(0, 0,", "+= step_size increasing = True elif pulse > servo_min: pulse -= step_size increasing", "step_size increasing = True time.sleep(0.01) print(pulse) w...
[ "# noqa from .drones import * # noqa from .medications import * #", "from .deliveries import * # noqa from .drones import * # noqa from", "* # noqa from .drones import * # noqa from .medications import *", "import * # noqa from .drones import * # noqa from .medications import", ".deliveries import * # noqa ...
[ "\"\")) def test_sockets_unsafe_allocate_udp_socket_empty_host(self): self.assertFalse(unsafe_allocate_udp_socket(\"\", 8080)) def test_sockets_unsafe_allocate_udp_socket_empty_port(self): self.assertFalse(unsafe_allocate_udp_socket(\"127.0.0.1\", \"\")) def test_sockets_unsafe_allocate_udp_socket_hostname_1(self):...
[ "Keras Image Preprocessing from keras.preprocessing.image import ImageDataGenerator train_datagen = ImageDataGenerator(rescale=1./255) #test_datagen = ImageDataGenerator(rescale=1./255)", "Convolution classifier.add(Conv2D(16, kernel_size=3, activation='relu', input_shape=(110, 110, 1))) # Step 2 - Max Pooling", ...
[ "<gh_stars>1-10 # THE OLD MONK for _ in range(int(input())): N = int(input()) A", "= [int(a) for a in input().split()] res = 0 mx = 0 for", "in input().split()] B = [int(a) for a in input().split()] res = 0 mx", "[int(a) for a in input().split()] B = [int(a) for a in input().split()] res", "int(input()) A =...
[ "body assert \"message\" not in body assert body[\"ok\"] == False # Cleanup requests.post(payment_3p_api_url+\"/cancelPayment\",", "Cleanup requests.post(payment_3p_api_url+\"/cancelPayment\", json={ \"paymentToken\": payment_token }) def test_backend_validate_no_iam(payment_3p_api_url, payment_api_url): \"\"\" T...
[ "test_get_choices(self): cells = self.model.get_question_preset(self.multiplechoice) assert len(get_choices(cells[0])) == 0 cells[0].metadata.extended_cell.choice = [1, 2, 3]", "import create_temp_course class TestExtraCells(unittest.TestCase): def setUp(self): tmp_dir, coursedir = create_temp_course() self.tmp_d...