ngram
listlengths
0
67.8k
[ "Maximize) in str(e.value) obj = LpObjective(name='', expression=None, constant=0) with pytest.raises(ValueError) as e: obj.sense", "with pytest.raises(ValueError) as e: LpObjective(name='', expression=None, constant=0, sense='') assert \"Sense must be one", "= LpObjective(name='', expression=None, constant=0) ...
[ "\"Pending\", \"coaching_score\": \"\", \"user\": \"<EMAIL>\", \"context\": \"phishing\", \"message\": \"Coaching Sent\" } } RESPONSE_JSON", "def test_module_command(requests_mock): \"\"\"Unit test for test-module command Args: requests_mock ([type]): [description] \"\"\" mock_reponse", "CONTEXT_JSON = { \"Secu...
[ "# select only first 10 comments co['total_upvotes'] = groupby['upvotes'].transform('sum') co['total_comments'] = groupby['upvotes'].transform('count') co", "logger = logging.getLogger(__name__) def process_tokenized_text(): logger.info('Reading original comments data') comments = pd.read_csv(PATH_ORIG_COMMENTS, ...
[ "''' 21cm 전파를 보내는 행성상성운과 우리 은하 사이 상대적 속도를 계산합니다. 21cm 전파의", "- lamda_0/lambda_0)*c ''' from astropy import constants as const import math lambda_obsereved =", "lamda_0/lambda_0)*c ''' from astropy import constants as const import math lambda_obsereved = float(input(\"Enter", "def func_radial_velocity(lambda_o...
[ "Engineer & Software developer <EMAIL> Created on 27 December, 2017 @ 12:40 AM.", "December, 2017 @ 12:40 AM. Copyright © 2017. Victor. All rights reserved. \"\"\"", "12:40 AM. Copyright © 2017. Victor. All rights reserved. \"\"\" import os APP_NAME", "\"\"\" import os APP_NAME = 'folktales' PROJECT_DIR = os....
[ "= 'data/raw' PROCESSED_DATA_PATH = 'data/processed' OUTPUT_DATA_PATH = 'data/output' MODELS_PATH = 'models' REPORTS_PATH =", "'data/raw' PROCESSED_DATA_PATH = 'data/processed' OUTPUT_DATA_PATH = 'data/output' MODELS_PATH = 'models' REPORTS_PATH = 'reports'", "RAW_DATA_PATH = 'data/raw' PROCESSED_DATA_PATH = 'd...
[ "PodcastCategory() first_podcast_category.title = 'PodCastCategory1' first_podcast_category.save() second_podcast_category = PodcastCategory() second_podcast_category.title = 'PodCastCategory2' second_podcast_category.save() saved_podcast_category", "= PodcastCategory() second_podcast_category.title = 'PodCastCat...
[]
[ "1 mid = (start + end) // 2 while mid != start: if", "if __name__ == '__main__': arr = [2, 4, 6, 8, 10, 12, 14,", "or arr[end] == value: return True return False if __name__ == '__main__': arr", "+ end) // 2 while mid != start: if arr[mid] == value: return", "arr[end] == value: return True return False if _...
[ "\"SS12 0AU\", \"SS15 5GX\", \"CM11 2ER\", \"SS13 2EA\", \"CM11 2JX\", \"CM11 2AD\", \"CM12", "LONDON ROAD, BASILDON \"100091212751\", # PROBATION OFFICE, 1 FELMORES, BASILDON \"10013352273\", # 17", "ROAD, BULPHAN, UPMINSTER \"10090682049\", # FERNDALE, TYE COMMON ROAD, BILLERICAY \"100090239089\", # FLAT", ...
[ "= (self.cursor[position] + 1) % self.dataset_size return sequence def next(self): '''Generate next batch", "dict(zip(range(len(words)), words)) def convert_words_to_wordids(self): self.wordids = [self.words2id[word] for word in self.words] def convert_wordids_to_words(self,", "+ '.' + dataset_type + '.txt') se...
[ "test_neal_funnel(config=Config()): test_neal_funnel = MCMCTest( name='neal_funnel', model_file='good/neal_funnel.stan', config=config ) return test_neal_funnel.run() if __name__ ==", "<filename>test/integration/dppl/inference/test_neal_funnel.py from .harness import MCMCTest, Config from pprint import pprint def...
[ "# # Licensed under the Apache License, Version 2.0 (the \"License\"); # you", "writing, software # distributed under the License is distributed on an \"AS IS\"", "KIND, either express or implied. # See the License for the specific language", "Unless required by applicable law or agreed to in writing, softwar...
[ "from sklearn.model_selection import GridSearchCV from sklearn.neural_network import MLPRegressor from sklearn.model_selection import train_test_split from", "Accuracy : ',mlp_clf_grid.best_estimator_.score(train_X,train_y)) print('Test Accuracy : ',mlp_clf_grid.best_estimator_.score(test_X, test_y)) print('Grid ...
[ "batch in tqdm(dataloader): batch = batch.to('cpu') wavs, lens = batch.sig wavs_aug_tot = []", "KIND, either express or implied. # See the License for the specific language", "Unless required by applicable law or agreed to in writing, software # distributed", "permissions and # limitations under the License. ...
[ "geodataframe geometries in reference to a bounding box e.g. of an image chip.", "geometry, needs to be in the same crs as the input geodataframe. explode_mp_:", "continue # Drop small geometries chip_df = chip_df[chip_df.geometry.area * (10 * 10) >", "polygons due to line overlap effects. poly = poly.buffer(...
[ "SimpleProduct: def solution(self, value1, value2): return \"PROD = \" + str(value1 * value2)", "class SimpleProduct: def solution(self, value1, value2): return \"PROD = \" + str(value1 *" ]
[ "given nodes joined one after another. Parameters ---------- *nodes : hashable Items to", "SetItemObserver(notify=True, optional=True), ), ] actual = expr._as_graphs() self.assertEqual(actual, expected) def test_set_items_method_notify(self): # Test", "self.assertEqual(actual, expected) def test_set_items_metho...
[ "# # Licensed under the Apache License, Version 2.0 (the \"License\"); # you", "writing, software # distributed under the License is distributed on an \"AS IS\"", "MockAdapter([mock_response]) authed_session = google.auth.transport.requests.AuthorizedSession( mock_credentials) authed_session.mount(self.TEST_URL...
[ "= list(reader) images_per_language = {'dutch': set(), 'german': set(), 'english': set()} for entry in", "images_per_language['english']], ['Dutch','German','English']) for patch in diagram.patches: patch.set_facecolor('white') patch.set_linewidth(1) patch.set_edgecolor('black') patch.set_alpha(1.0) for label in"...
[ "disable it by not passing a REQUIREMENTS_FILE variable when building # the docker", ".logging import * DEBUG = True SERVER_EMAIL = \"Wikilink Local <<EMAIL>>\" DEFAULT_FROM_EMAIL =", "* DEBUG = True SERVER_EMAIL = \"Wikilink Local <<EMAIL>>\" DEFAULT_FROM_EMAIL = SERVER_EMAIL #", "by not passing a REQUIREMEN...
[ "x1:0, y1:0, x2:1, y2:0, stop:0.0170455 rgba(226, 0, 185, 255), stop:1 rgba(21, 25, 255,", "self.tableWidget.horizontalHeaderItem(5) item.setText(_translate(\"MainWindow\", \"Reviews\")) item = self.tableWidget.horizontalHeaderItem(6) item.setText(_translate(\"MainWindow\", \"Rate\")) item = self.tableWidget.hori...
[ "bl_idname = \"poselib.mixcurrpose\" bl_label = \"Mix current pose\" bl_options = {'REGISTER', 'UNDO'} influence", "elif rotway in ['XYZ','XZY','YXZ','YZX','ZYX','ZXY']: rotname = \"rotation_euler\" elif rotway in ['AXIS_ANGLE']: rotname =", "Foundation; either version 2 # of the License, or (at your option) an...
[ "score(self, ctx): # Get message content = ctx.message.content.split()[1:] # Error if format is", "winner content[0] != content[1] # Imps are not the same ] if not", "\"Game Results Canceled!\" color = Color.red() if all_reactions[0].count == self.required_checks+1: title = \"Game", "of embed will be based on...
[ "__name__ == \"__main__\": default_file = \"test\" fname = askString(\"Kernelcache symbol file\",\"Symbol file: \",default_file)", "\"__main__\": default_file = \"test\" fname = askString(\"Kernelcache symbol file\",\"Symbol file: \",default_file) f =", "jtool2 #@author simo #@category iOS.kernel from utils.met...
[ "writing, software # distributed under the License is distributed on an \"AS IS\"", "KIND, either express or implied. # See the License for the specific language", "Unless required by applicable law or agreed to in writing, software # distributed", "some types randomly assert Type.BOOL.value == 0 assert Layou...
[ "db.query(db.Sources).\\ filter(db.Sources.c.source.notin_(sources_with_photometry)).\\ pandas() # Get the BDNYC source_id values for our SIMPLE sources", "foreign_key='source_id', column_type_overrides={'spectra.spectrum': types.TEXT(), 'spectra.local_spectrum': types.TEXT()}) # SIMPLE connection_string = 'sqlit...
[ "import User from .drink_dto import Drinks from .dessert_dto import Dessert from .role_dto import", "User from .drink_dto import Drinks from .dessert_dto import Dessert from .role_dto import Roles", "from .user_dto import User from .drink_dto import Drinks from .dessert_dto import Dessert from", ".user_dto im...
[ "遇到多个重复字符的时候 # aba: 遇到左右字符重复的时候 # 第一步,找到中心轴 # 第二步,向左向右探 strLen = len(str) left =", "else 1 while right < strLen: if str[left] == str[right]: # aa... while", "max = (right - left + 1) if (right - left + 1)", "max if max >= (strLen - right - 1): return max # 当后面的字符串数量少于最大回文个数时,提前跳出循环", "JohnnyB0Y. All rights ...
[ "input_bits carry += number bits_count += input_bits while bits_count >= output_bits: number =", "value in data: acc = ((acc << frombits) | value) & max_acc bits", "8, output_bits = 5): \"\"\" Convert an array of N-bits integer into an", "max_acc bits += frombits while bits >= tobits: bits -= tobits ret.appen...
[ "terms = json.load(json_file) terms = terms[\"search\"] for term in terms: self.tag = term", "date[14:-11].replace(\" \", \"\") date = datetime.strptime(date, \"%B%d,%Y\").strftime(\"%Y-%b-%d\") print(date) mpdf = make_pdf( str(self.name), str(indian_express_link),", "IndianExpressSpider(scrapy.Spider): name = ...
[]
[ "msg.type is aiohttp.WSMsgType.TEXT: await self.event_catch(msg) elif msg.type is aiohttp.WSMsgType.ERROR: raise msg.data async def", "self.ws = ws self.token = client.token self.client = client self.closed = self.ws.closed @classmethod", "client.token self.client = client self.closed = self.ws.closed @classmet...
[ "import authenticate, login, logout from django.views.generic import View, ListView, DetailView,TemplateView from django.urls import", "res = {'code': 1, 'errmsg': '添加用户失败'} else: # 获取自定义的表单错误的两种常用方式 # print(_userForm.errors) print(_userForm.errors.as_json()) #", "class UserDetailView(LoginRequiredMixin, Detail...
[ "urlpatterns = [ url(r'(?P<id>\\d+)/post_edit/$', views.post_edit, name=\"post_edit\"), url(r'(?P<reqid>\\d+)/(?P<proid>\\d+)/(?P<posid>\\d+)/(?P<comid>\\d+)/report/$', views.report, name=\"report\"), url(r'(?P<id>\\d+)/post_delete/$', views.post_delete, name=\"post_delete\"), url(r'(?P<id>\\d+)/cmnt_delete/$',", ...
[ "# right, # respectively, making the sample size for this comparison quite large.", "Figure( (methods.width + density.width) * 0.9, (methods.height) * 0.9, methods_panel, density_panel, ) fig.save(FIG_PATH", "A2) ax = axs[0, 1] ax.text( 0.4, 0.2, r\"$p = \\frac{\\# \\ edges}{\\#", "pkg.plot import SmartSVG, n...
[ "ibvhs = bvh1.intersect(bvh2) # for ibvh1, ibvh2, ip in ibvhs: # print ip", "for the given polints. # # Usage: # ``` # bvh1 = BVH(points1)", "self.isLeaf(): ip = self._line.intersect(bvh._line) if ip is not None: ilt = self._line.closestParam(ip) t_min,", "ilt = self._line.closestParam(ip) t_min, t_max = self...
[ "self.regiao = RegiaoFactory.create(id=1) def test_perform_create(self): data = { 'nome': 'Gotham', 'regiao': self.regiao.id }", "data = { 'nome': 'Gotham', 'regiao': self.regiao.id } response = self.unath_client.post(reverse('cidade-list'), data=data) self.assertEqual(response.status_code,", "APITestCase, APIC...
[ "si[i][0]-big(si[i][1],si[i][2])-small(si[i][1],si[i][2]) if(flag => 0): kaburi_hoten_3 = 0 else: kaburi_hoten_3 = print(zentai) print(kaburi_zentai) print(kaburi_hoten_1)", "else: kaburi_hoten_3 = print(zentai) print(kaburi_zentai) print(kaburi_hoten_1) print(kaburi_hoten_2) print((si[i][0]-big(si[i][1],si[i][2]...
[ "utf-8 -*- # Generated by Django 1.10.3 on 2016-12-05 14:24 from __future__ import", "__future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('imageledger',", "# Generated by Django 1.10.3 on 2016-12-05 14:24 from __future__ import unicode_lit...
[ "'rhl': ['return', 'air', 'high', 'limit'], 'retrb': ['return', 'reset', 'band'], 'swovdif': ['economizer', 'switchover', 'differential'],", "\"fan\"], \"sup\": [\"supply\"], \"dis\": [\"discharge\"], \"ex\": [\"exhaust\"], \"ret\": [\"return\"], \"hw\": [\"hot\", \"water\"], \"chw\":", "[\"outside\", \"fan\"],...
[ "docs_counter = 0 terms_counter = 0 entries_counter = 0 for line in open(vw_file_name,", "cnt except BaseException: bow[wid] = cnt for key, value in sorted(bow.items()): temp_docword_file.write(\"%d %d", "if self.cur_doc_id % 1000 == 0: self.log(str(self.cur_doc_id)) word, modality = self.vocab[int(parsed[1])] ...
[ ": status[\"pb\"], \"vol_a\" : self.baseVol, \"vol_b\" : self.baseVol*status[\"pa\"]*para[\"beta\"]/status[\"pb\"] }) if para[\"beta\"] < 0:", "self.pairTradeStatus[pairKey][\"pb\"] = pa, pb value = self.getPairValue(pa, pb, pairPara) #发送参数信号 self.sendMessage((2, (pairKey, data[\"dateTime\"],pa,", "status[\"pb\...
[ "if userResponse.decode('utf-8')[:2] == 'OK': with open(Nom_Fichier, 'rb') as f: bytesToSend = f.read(1024) sendedData", "acceder au repertoir transmis par le client ( cd Nom_Fichier) # os.chdir renvoie", "de la commande Type_Commande=int(Arguments[0]) Nom_Fichier=Arguments[1] if(Type_Commande==0):# commande de...
[ "qrcode.image.svg.SvgImage img = qrcode.make(data, image_factory=factory) io = BytesIO() img.save(io) return io.getvalue().decode(\"utf-8\") def get_timetable(idxes,", "\".join([lesson['building'], lesson.get('auditorium', '')]))) return ev def tt_to_ical(tts): cal = Calendar() for tt in", "'GET': return render...
[ "= self.get_response(request) return response def process_view(self, request, view_func, view_args, view_kwargs): path = request.path_info.lstrip('/')", "flag1 and flag2: return redirect('main:dashboard') elif flag1 or flag2: return None return redirect(settings.LOGIN_URL)", "None flag1 = True try: email = requ...
[ "file_entry(): def __init__(self,route_response_label,route_destiny_label): self.route_response_label=route_response_label self.route_destiny_label=route_destiny_label self.dwc_terms=self.dict_loader() #Diccionario def dict_loader(self): #Apertura del dict dict_path=r\"documents\\dwc_terms\\dwc_fieldName_dict.pkl\"...
[ "Color.UNKNOWN: \"Unknown\", Color.RED: \"RED\", Color.GREEN: \"GREEN\", Color.BLUE: \"BLUE\", Color.BLACK: \"BLACK\", Color.YELLOW: \"YELLOW\" }", "Color.YELLOW return Color.UNKNOWN # コマンドコード定義 class CommandCode(): Specific = 0x01 All = 0x02", "= 0 RED = 1 GREEN = 2 BLUE = 3 BLACK =", "hsv[0] and hsv[0] <= 3...
[ "self.model = Model(input=inputs, output=final) self.model.load_weights(\"{0}_weights.hdf5\".format(self.root)) def validation_generator(self): f_images = h5py.File('/net/duna/scratch1/aasensio/deepLearning/opticalFlow/database/database_images_validation.h5', 'r') images =", "f_velocity = h5py.File('/net/duna/scr...
[ "= config.getboolean('options', 'wait_for_results') if not self.sandbox_url: raise StoqPluginException(\"Falcon Sandbox URL was not provided\")", "KIND, either express or implied. # See the License for the specific language", "Unless required by applicable law or agreed to in writing, software # distributed", ...
[ "results2[i] = 1 else: results2[i] = int(results2[i])+1 programFun2(arry_list) # 写在白纸上,完成之后拍照 # 2题 #", "str == ele: nums+=1 results[str] = nums def programFun2(arry_list): results2 = {} count", "{} count = 1 for i in arry_list: if i not in results2.keys:", "[a,a,c,b,d,c,c,c,d,d] # {c:4,d:3,a:2,b:1} # 2. 常用的Li...
[ "index.html\") write_index_html(latest_release) print(\"Write versions.json\") write_versions_json(versions_data, outfile='versions.json') print(\"DONE post-processing\") if __name__ == \"__main__\": main()", "latest_release = versions_data['latest_release'] if latest_release is None: latest_release = 'master' pr...
[ "<reponame>baldingwizard/thermostatpi<gh_stars>1-10 from subprocess import call import time image=100000 while True: call([\"cp\", \"ramdisk/ui.png\", \"ramdisk/ui_\"+str(image)+\".png\"])", "subprocess import call import time image=100000 while True: call([\"cp\", \"ramdisk/ui.png\", \"ramdisk/ui_\"+str(image)+\...
[ "for k1 in [278]: #[0]: for k2 in xrange(8, 240, 30): #[0]: f_list", "(Hz)') plt.title('Running average of the firing rate, N_r = %d' % (N_r)) plt.show()", "np.zeros(gids.size) f_rate = data[:, 1] f_rate_mean = f_rate_mean + f_rate plt.plot(gids, f_rate) f_rate_mean", "f_rate_mean = np.array([]) for f_name in...
[]
[ "<filename>fancy_todo_list/application/entities/__init__.py from .base import RefId from .user import Username, User # from .task", "import RefId from .user import Username, User # from .task import Title, Task", "from .base import RefId from .user import Username, User # from .task import", ".base import Ref...
[ "= Sheep(position=Position(-10, -10)) for i in range(0,10): print('-- Iteration {0} --'.format(i)) grass.move() print(grass)", "Sheep(position=Position(-10, -10)) for i in range(0,10): print('-- Iteration {0} --'.format(i)) grass.move() print(grass) sheep.move()", "'__main__': grass = Grass(position=Position(10...
[ "1: # instance = qs.first() # else: # raise Http404(\"Product doesn't exist.\") instance", "= cart_obj return context # def get_object(self, *args, **kwargs): # request = self.request", "context = super(ProductListView, self).get_context_data(*args, **kwargs) cart_obj , new_obj = Cart.objects.new_or_get(self.re...
[ "file_ref_spec.basedOn.identifier; else: language = file_ref_spec.contents['GccDialectName']; found_dialect = True; else: break; if found_dialect ==", "= file.name.split('.')[0]; args = (); # add base (compiler) args += self.properties['baseargs']; sdk_name", "if result != None and len(result) > 0: args += (res...
[ "\\end{tabular}} \\caption{\"\"\" +table_name+\"\"\"} \\end{minipage} \\end{table*} \"\"\" with open(\"./report/attachments/ml_results_{}.tex\".format(idx), 'w') as file: file.write(table_per) with", "Abdeckung in \\%\\\\\\\\ \\midrule\"\"\" table_stat += \"\"\"\\\\begin{minipage}{.3\\\\textwidth} \\centering \\\...
[ "assert(generalize_names(\"Eto'o, Samuel\", output_sep=', ') == 'etoo, s') assert(generalize_names(\"Eto'o, Samuel\", output_sep=', ') == 'etoo,", "assert(generalize_names('<NAME>', firstname_output_letters=2) == 'pozo jo') assert(generalize_names(\"<NAME>\", firstname_output_letters=2) == 'etoo sa') assert(gener...
[ "= uefi_firmware.AutoParser(file_content[fvh_index - 40 :]) if parser.type() is \"unknown\": return self._unsupported() firmware =", "continue print(f\"Current module: {module_name}\") dst = os.path.join(self.pe_dir, module_name) shutil.copy(module_path, dst) def dump_all(self) ->", "display in uefi_firmware mo...
[ "x_ci=None, fit_reg=False, color=\"red\", scatter_kws={\"s\": 1}, ax=ax) yticks = [10**i for i in range(10)", "is a summary file generated by albacore.\", nargs='+', metavar=\"files\", required=True) target.add_argument(\"--bam\", help=\"Data as", "+ 1), x_ci=None, fit_reg=False, color=\"red\", scatter_kws={\"s...
[ ".clinic import Clinic from .region_simplifier import RegionSimplifier from .decompiler import Decompiler from .decompilation_options", "from .region_identifier import RegionIdentifier from .structurer import Structurer from .structured_codegen import StructuredCodeGenerator from", "StructuredCodeGenerator from...
[ "wait_c + ((eom & 4) == 4) * 10) time.sleep(wait) if wait_a >", "psgplayer): self.psgplayer = psgplayer # play sound by MML string # @param chA_MML", "import time class Sequencer: # initialize. # @param psgplayer ymz294.PSGPlayer instance def __init__(self,", "channel A # @param chB_MML a MML string for PSG c...
[ "LICENSE). \"\"\"Jupyter support for Pants projects and PEX files.\"\"\" # N.B.: Flit uses", "# N.B.: Flit uses this as our distribution version. from IPython import InteractiveShell", "License, Version 2.0 (see LICENSE). \"\"\"Jupyter support for Pants projects and PEX files.\"\"\"", "and PEX files.\"\"\" # ...
[ "= MOVEMENT_SPEED # # def on_key_release(self, key, modifiers): # \"\"\"Called when the user", "* self.actual_fps + 1 / delta_time) / 100 food_per_100_turns = self.colony.food_per_turn() * 100", "a key. \"\"\" # # if key == arcade.key.UP or key == arcade.key.DOWN:", "ant.draw_hit_box((255,0,0)) # def on_key_p...
[ "that handles everything related to getting and setting up the training and test", "up the training and test datasets ... Methods ------- download_data() Downloads the data", "getting and setting up the training and test datasets ... Methods ------- download_data()", "quiet=False) #with zipfile.ZipFile(path_t...
[ "tkinter import messagebox from tkinter import Button window = tkinter.Tk() HEIGHT = window.winfo_height()", "command=click_button ) # placing a button to center of the window button_widget.place( relx=0.5,", "Button window = tkinter.Tk() HEIGHT = window.winfo_height() WIDTH = window.winfo_width() print(f'Heigh...
[ "as F import torch.optim as optim import glob import os from skimage.io import", "folders=['mean','max','std'] for folder in folders: for k in range(3): tmp=imread(file_name + '_' +", "pd.ExcelFile(self.path + os.sep+'ListOfData.xlsx') data = pd.read_excel(xl_file,header=None) folders=data.loc[:,0].tolist() nam...
[ "core.monorepo_stack import MonorepoStack from core.pipelines_stack import PipelineStack app = cdk.App() core = MonorepoStack(app,", "import (core as cdk) from core.monorepo_stack import MonorepoStack from core.pipelines_stack import PipelineStack app", "(core as cdk) from core.monorepo_stack import MonorepoSta...
[ "Pesos / v_Dolar Dolares = str(Dolares) print(\"Tienes $\" + Dolares + \" Dolares\")", "Pesos = float(Pesos) v_Dolar = 4033 Dolares = Pesos / v_Dolar Dolares =", "\") Pesos = float(Pesos) v_Dolar = 4033 Dolares = Pesos / v_Dolar Dolares", "Colombianos tiene?: \") Pesos = float(Pesos) v_Dolar = 4033 Dolares = ...
[]
[ "nxt = now * k if nxt not in s: heapq.heappush(h, nxt) s.add(nxt)", "= [1] s = set([1]) while n > 1: now = heapq.heappop(h) for", "now = heapq.heappop(h) for k in (2, 3, 5): nxt = now *", "int :rtype: int \"\"\" h = [1] s = set([1]) while n >", "(2, 3, 5): nxt = now * k if nxt not in s:", "* k if nxt not ...
[ "'#fff') draw = ImageDraw.Draw(img) for _ in range(config['count']): # Select colour if config['color']['random']", "or config['shape'] == 'rectangle': rgb = random.randint(128,255), random.randint(0,255), random.randint(80,255) else: rgb = config['color']['fixed']", "img.size[0]), random.randint(0, img.size[1]...
[ "QtGui, QtCore # (the example applies equally well to PySide) import sys import", "widget to hold everything w = QtGui.QWidget() w.move(400,100) #w.showFullScreen() # change background color", "import pyqtgraph as pg import numpy as np ## Always start by initializing", "grid layout to manage the widgets size ...
[ "= Dataset.load_from_df(traindf[['用户编码', '当月网购类应用使用次数', '信用分']], reader) algo = NormalPredictor() # perf = cross_validate(algo, data,", "\"\"\" from surprise import NormalPredictor from surprise import Dataset, Reader from surprise.model_selection import", "Dataset, Reader from surprise.model_selection import c...
[ "( (\"draft\", \"Draft\"), (\"published\", \"Published\"), ) id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) question_text =", "timezone from django.utils.translation import ugettext_lazy as _ from taggit.managers import TaggableManager from taggit.models", "models.UUIDField(primary_...
[ "sum of each round of errors. The difference of first and second will", "solve(first_errors, second_errors, third_errors): first_sum = sum(first_errors) second_sum = sum(second_errors) third_sum = sum(third_errors) print", "'<NAME>' ''' https://codeforces.com/problemset/problem/519/B Solution: Calculate the sum...
[ "import urllib2 # 设置代理 # authproxy_handler = urllib2.ProxyHandler({\"http\": \"mr_mao_hacker:sffqry9r@172.16.31.10:16816\"}) authproxy_handler = urllib2.ProxyHandler({\"http\": \"192.168.3.11:9000\"})", "= urllib2.build_opener(authproxy_handler) # 构建了一个全局的opener,之后所有的请求都可以用urlopen()方式去发送,也附带Handler的功能 urllib2.ins...
[]
[ "string using itertools. # # https://www.hackerrank.com/challenges/itertools-combinations/problem # from itertools import combinations s, n", "Itertools > itertools.combinations() # Print all the combinations of a string using itertools.", "> Itertools > itertools.combinations() # Print all the combinations of ...
[ "md5 import os import sys # The following 4 lines are necessary until", "'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.76 Safari/537.36'} def fingerprint_line(line):", "= [ \"name\", \"country_registered\", \"country_owner\", \"owner_operator\", \"users\", \"purpos...
[ "设置Cookie,使用租户id }) access_token = json.loads(response.text)['access_token'] # 从响应中获取access_token taskdata = { # 构造要计算的数据 'type':", "'quantity': 99 }], 'packingContainers': [{ # 容器数据 'name': \"20ft\", 'InnerX': 2.35, 'InnerY': 2.38,", "2.38, 'InnerZ': 5.89, 'Maxload': 21000 }], 'interimContainers': [], 'loading...
[ "GPIO.output(self.pin_id, state) self.state = state def get(self): return self.state @classmethod def cleanup(cls): GPIO.cleanup()", "def sense(self): GPIO.setup(self.pin_id, GPIO.IN) output = GPIO.input(self.pin_id) self.state = output return output def", "return output def set(self, state): GPIO.setup(self.pi...
[ "collection_data[\"wishlist_comment\"] if \"players\" in collection_data: self.previous_players = list(set(collection_data[\"players\"])) self.expansions = expansions self.accessories =", "count if total_votes > 0: suggested_age = round(sum / total_votes, 2) return suggested_age", "self.weightRating = float(gam...
[]
[ "# 如果两颗牙的分割结果重合面积大于其中一颗牙的40%,则认为这颗牙分割错误在了其它牙齿上,去掉这颗牙的分割结果 def judge_overlap(id, output_all): ids = [11, 12, 13, 14, 15, 16,", "多个文件中要用到的函数之类的统一写在这里 from skimage.measure import label import numpy as np import copy # 如果最大连通域面积小于2000,直接认为分割错误,返回无分割结果,反之保留面积最大连通域,如果面积第二大连通域和最大差不多,则两个都保留", "top = output.max() area_l...
[ "class Spam(Structure): pass if __name__ == \"__main__\": spam_0 = Spam(price=0.618, name=\"wexort\") print(spam_0.name, spam_0.price)", "Spam(Structure): pass if __name__ == \"__main__\": spam_0 = Spam(price=0.618, name=\"wexort\") print(spam_0.name, spam_0.price) spam_1", "signature import Structure, add_sign...
[ "hash_filters import * from list_filters import * from version_filters import * from string_filters", "import * from dict_filters import * from hash_filters import * from list_filters import", "from list_filters import * from version_filters import * from string_filters import * from", "bool_filters import * ...
[ "+ date[4:] first = arrow.get(date0) quan = quan_name.split(\"m_\")[0] m = -1 * int(quan)", "range of the used months\"\"\" start = start[:4] + '-' + start[4:] startdate", "os.makedirs(trainDataDir) trainFile = quantile + '/' + get_train(Date, quantileName) shutil.copy(trainFile, trainDataDir) print(quantile, '...
[ "bool value: new value of site configuration \"\"\" # ConfigParser stores bool in", "configuration :returns: value of site configuration :rtype: bool \"\"\" return _get_parser().getboolean('siteconfig', name) def", "\"\"\" return _get_parser().getboolean('siteconfig', name) def set_config(name, value): \"\"\" S...
[ "popular in the Western Hemisphere. (The Fourth of July didn't see regular celebration", "hours and min def test_dates_3(self): self.assert_extract(' 2018-06-21 15:54', library.dates_newiso8601, '2018-06-21 15:54') # Checks", "find four of them. def test_integers(self): self.assert_extract(NUM_CORPUS, library.i...
[ "DataToken, ) -> None: with self._db_adapter: self._registrar.copy_table(source_data_token, target_data_token) def move_group( self: Database, source_data_token:", "[str(col_id) for col_id in col_ids] def table_dtypes(self, data_token: DataToken) -> dict[str, DataType]: with", "target_data_token) def move_group...
[]
[ "tmp_str inside, and removes the file after all. \"\"\" tmp_file_name = None try:", "END OF HEADER ''' @contextmanager def mktmp(tmp_str): \"\"\"Returns the name of the file", "/ AGENCY 4733K06635 TRIMBLE NETR5 4.85 REC # / TYPE / VERS 30517456", "(4121967.5664, 2652172.1378, 4069036.5926) std_lbh = (32.75819...
[ "detected boxes to ROS type and publish ros_boxes = self.bridge.to_ros_boxes(bboxes) if self.fall_publisher is", "KIND, either express or implied. # See the License for the specific language", "Unless required by applicable law or agreed to in writing, software # distributed", "None: message = self.bridge.to_...
[ "'count', 'piechart', 'classes'], help='REQUIRED, Calculate \"correlations\"; ' '\"count\" hittables for further analysis. Ideal", "default=False) options = parser.parse_args() ## Creating HittableClass object data = ghc.HittableClass(gtf=gtm.getGTF(options.gtf_file), whole_name=options.whole_name, n_rpM=options....
[ "10)] for i in range(3)] self.test = self.get_indexed_qa(raw_test) def set_mode(self, mode): self.mode =", "<filename>data_gen.py import re from glob import glob import numpy as np from torch.utils.data", "self.mode == 'train': return len(self.train[0]) elif self.mode == 'valid': return len(self.valid[0]) elif ...
[ "('python3', '3.6.4'), ]) def test_container_version(host, name, version): pkg = host.package(name) assert pkg.is_installed assert", "pkg = host.package(name) assert pkg.is_installed assert pkg.version.startswith(version) @pytest.mark.parametrize('name,version', [ ('Flask', '1.0.2'), ]) def", "def test_sshd_dis...