index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
995,800
daad6ab053c50a7b5eb6d893468626f78fcbae5b
""" """ import re from MotifAtlasBaseClass import MotifAtlasBaseClass from models import session, MotifAnnotation for loop in session.query(MotifAnnotation).all(): if loop.common_name is not None and loop.common_name != '': loop.common_name = re.sub('\s?\[.+?\]\s?', '', loop.common_name) loop....
995,801
3fcaafeac52c788ee8ebbce1d5b28eb4bbafabbb
from libtool import include_sub_folder_in_root_path include_sub_folder_in_root_path(__file__, "approot", "libs")
995,802
a4296789b90e4bb28695f51a7bfe7c24c16599d9
""" Простейшая система проверки орфографии основана на использовании списка известных слов. Каждое слово в проверяемом тексте ищется в этом списке и, если такое слово не найдено, оно помечается, как ошибочное. Напишем подобную систему. Через стандартный ввод подаётся следующая структура: первой строкой — количество ...
995,803
9fa43c8c19e98adb9398cb80407eb8dea853341d
from datetime import date class Game(object): __slots__ = 'redPlayer', 'redScore', 'bluePlayer', 'blueScore', 'time', 'skillChangeToBlue', 'redPosChange', 'redPosAfter', 'bluePosChange', 'bluePosAfter', 'redAchievements', 'blueAchievements', 'deletedBy', 'deletedAt' def __init__(self, redPlayer, redScore, bl...
995,804
5b1387c9d1105b789a0c7f6b1e7a27fd154e6497
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'plugin_window.ui' # # Created by: PyQt5 UI code generator 5.14.1 # # WARNING! All changes made in this file will be lost! import PyQt5.QtGui as QtGui import PyQt5.QtWidgets as QtWidgets import PyQt5.QtCore as QtCore class Ui_PluginWindow(...
995,805
aa2be557ae188b7ce93c3343ab149de290a4f07e
""" Utilties for casting numpy values in various ways Most routines work round some numpy oddities in floating point precision and casting. Others work round numpy casting to and from python ints """ from numbers import Integral from platform import processor, machine import numpy as np from .testing import setup_t...
995,806
caffc9d81b149022e431d6ac1871215e2549b15a
# Jeff Heaton's Kaggle Utilities # Copyright 2019 by Jeff Heaton, Open Source, Released under the Apache License # For more information: https://github.com/jeffheaton/jh-kaggle-util # # Train from a SK-Learn model. from util import * import tensorflow as tf import tensorflow.contrib.learn as learn import scipy.stats ...
995,807
08a74c33db1fb5fb0236fa487313183a612d7588
from flask import Flask, send_from_directory, request, render_template, jsonify from flask_restful import Api, Resource, reqparse from flask_cors import CORS #comment this on deployment from api.HelloApiHandler import HelloApiHandler from flask_mysqldb import MySQL from flask_sqlalchemy import SQLAlchemy import d...
995,808
a430a1ddf11e4eae8af9617b340a374536589973
# Escreva um programa q converta uma temperatura digitando em graus Celsius e converta para graus Fahrenheit. tc = float(input('Informe a temperatura em ºC: ')) tf = (tc / 5) * 9 + 32 print('A temperatura em Fahrenheit é {}ºF.'.format(tf))
995,809
3b3e521aa0cbc162facaceae37c93ab03f218eca
from __future__ import print_function import sys, time class ProgressBar: """ Example: pb = ProgressBar(n) for i in range(n): do_some_action() pb.advance() """ def __init__(self, size, **opt): prompt = opt.get('prompt', 'Progress: ') self.size = si...
995,810
0b759ad46bd5683f95e4df58acb36f450b1f70fe
from ..handlers import action_handler from ..buttonpress import load_state # _______________________________________________________________________________________________________________________________ # Entity is an object that represent a single attempt by the computer to complete Sonic 3 and Knunkles # # Each En...
995,811
d41b111c9495029fd531ada841e4f09faccbf6c8
#!/usr/bin/python3 # -*- coding: UTF-8 -*- import configparser #读写配置文件类 class Config(): def __init__(self, file='config\config.ini'): self.file = file self.config = configparser.ConfigParser() self.config.read(file, encoding="utf-8") # utf-8-sig # 读取 def get(self, section='', key=...
995,812
6fe994ec528290deb7135050b56340c246d8563e
# -*- coding: utf-8 -*- """ Created on Thu May 9 16:00:20 2019 @author: Dinesh Prajapat """ user_input = 2, 4, 7, 8, 9, 12 empty_tuple = tuple(user_input) new_list = list(user_input) print(new_list) print(empty_tuple)
995,813
97735ab99719a1d00736ad63a3a6cb20448b39a3
import argparse import sys import enum import numpy as np from typing import Tuple from PIL import Image, ImageDraw, ImageFont class Color(enum.IntEnum): white = 255 black = 0 def _create_fitting_image(text: str, font: ImageFont.ImageFont, bordersize: int, fill_color: Color = Color.white) -> Image.Image: ...
995,814
3924627d6d08dcbbb5b675debc4528703b77d14e
#!/usr/bin/env python """Aligns reads in FASTQ files to reference genome.""" import argparse import subprocess import sys import glob __author__ = 'Alexis Blanchet-Cohen' __date__ = '2013-01-10' # Parse arguments parser = argparse.ArgumentParser(description='Aligns reads in FASTQ files to reference genome.') parse...
995,815
4f0c56ea84d8fa76b4872151f5bc48905df4aa08
from pymysql import escape_string from app import mysql def lookup_beer(search_term, is_id): """Queries the MySQL database for a specific beer by name or id""" attr = 'id' if is_id is True else 'name' query = """ SELECT `id`, `name`, `styleid`, `abv` FROM `beers` WHERE ...
995,816
0d3cc66d381d0ea4e45f65b6e42ce5ca96087a56
import itertools import os # import matplotlib.pylab as plt import numpy as np import tensorflow as tf import tensorflow_hub as hub print("TF version:", tf.__version__) print("Hub version:", hub.__version__) print("GPU is", "available" if tf.test.is_gpu_available() else "NOT AVAILABLE") module_selection = ("efficie...
995,817
43a4c3e05754ee0951ebc0acdf03fafde4b4cac8
from os import path import sqlite3 import csv import glob fitnotes_db_path = '~/Downloads/unmodified.fitnotes' data_csv = '~/Downloads/withings.csv' # "2015/02/01" def date_format_(input_date): (m, d, y) = input_date.split('/') while len(m) < 2: m = '0' + m while len(d) < 2: d = '0' + d ...
995,818
00f92c618753214f3e1ac3fdd6d0bc18f1e9c22e
from solutions import is_number_palindrome import unittest class TestIsNumberPalindrome(unittest.TestCase): # Test a palindrome with an even number of digits def test_positive_even(self): testnum = 123321 expected = True actual = is_number_palindrome(testnum) self.ass...
995,819
6035decd2dc1320b50c3b598144d881aafb76bb3
import json import pytest from app import app from app.tests.user_test import login_as_head_company from app.api.department.apiview import department_read_by_pk, department_update_by_pk @pytest.fixture def client(): app.config['TESTING'] = True with app.app_context(): with app.test_client() as client:...
995,820
315928f7b2d2330c40318a01b29eda624cb82ea1
#!/usr/bin/python """ This program to take the messages from Kafka and do read repair for Scylla. """ __author__ = "Anshita Saxena" __copyright__ = "(c) Copyright IBM 2020" __contributors__ = "Benu Mohta, Meghnath Saha" __credits__ = ["BAT DMS IBM Team"] __email__ = "anshita333saxena@gmail.com" __status__ = "Productio...
995,821
bfa93c0a4632170846ee10ba43030cd14a9c8d8d
import torch from os import path class L2Loss(torch.nn.Module): def forward(self, output, target): """ L2 Loss @output: torch.Tensor((B,C)) @target: torch.Tensor((B,C)) @return: torch.Tensor((,)) """ return torch.mean((output - target) ** 2) class MLPModel(torch.nn.Module): def __init__(self, in...
995,822
a063c1d7cae5c34f791f976ad2fc5b1be26d92db
# $language = "python" # $interface = "1.0" import os import sys import logging import csv # Add script directory to the PYTHONPATH so we can import our modules (only if run from SecureCRT) if 'crt' in globals(): script_dir, script_name = os.path.split(crt.ScriptFullName) if script_dir not in sys.path: ...
995,823
1ca858d8e28f640fce3a04cf554d3493890d0031
import scrapy import json from datetime import datetime from pymongo import MongoClient from bson.objectid import ObjectId from datetime import datetime from blockchain.spiders.parse_tx import satoshi_to_btc, insert_tx client = MongoClient('mongodb://localhost:27017') db = client.btc class BlockSpider(scrapy.Spider)...
995,824
d6ab7dc33f2ae69c622eb0646a530a092abe9248
from keras.preprocessing import sequence from keras.models import Sequential from keras.layers import Dense, Dropout, Activation from keras.layers import Embedding from keras.layers import LSTM from keras.layers import Conv1D, GlobalMaxPooling1D, BatchNormalization from gensim.models import KeyedVectors from keras.call...
995,825
31fee1a4f67cf9778ff97503263c1ab856e531c7
import pika class Publish(object): def __init__(self,host,msg,queue): self.host = host self.comm = pika.BlockingConnection(pika.ConnectionParameters(host=self.host,heartbeat=30)) self.msg = msg self.queue = queue def send(self): self.channel = self.comm.channel() ...
995,826
660fe2506a679700deb8ae44ecabeed04aede1bf
#Desenvolva um programa que pergunte a distância de uma viagem em Km. Calcule o preço da passagem, cobrando R$0,50 por Km para viagens de até 200Km e R$0,45 parta viagens mais longas. viagem = float(input('Digite a distancia da viagem: ')) if viagem <= 200: passagem = 0.50 * viagem print('Sua viagem curta cus...
995,827
8867551e9e17bbb830e28277d502fa19e4f9e23d
#!/usr/bin/env python # from __future__ import print_function import rospy from sensor_msgs.msg import JointState from markers import * from functions import * import numpy as np # Initialize the node rospy.init_node("testKineControlPosition") print('starting motion ... ') # Publisher: publish to the joint_states to...
995,828
f05b88949c1984783f4bf656ce6e619f5fabe5ed
from django.apps import AppConfig class UpsFrontendConfig(AppConfig): name = 'ups_frontend'
995,829
eca5b52a239d539795a68ddd6eca8c4daa0c85df
""" EXPLICIT STRING CASTING b'foo bar' : results bytes in Python 3 'foo bar' : results str r'foo bar' : results so called raw string, where escaping special characters is not necessary, everything is taken verbatim as you typed """ normal_string = 'pawel \n loves \t coding' print(normal_string) ##pawel ## loves co...
995,830
7d8e030cc81cae524b980e8c20fb9cf14d65fbaa
#!/usr/bin/python ''' (C) 2010-2013 ICM UW. All rights reserved. ''' import shutil import time import re import os import sys ############################################### ######## DEFINITION BLOCK ##################### ############################################### def copyFilesNeeded(propsDir,directory,compilati...
995,831
2a79d3c141eba52295394dfb740774a0351dafa6
# -*- coding: utf-8 -*- # pragma pylint: disable=unused-argument, no-self-use """Function implementation""" import logging from algosec.models import ChangeRequestTrafficLine, ChangeRequestAction from resilient_circuits import function, FunctionResult, StatusMessage from algosec_resilient.components.algosec_base_com...
995,832
0fb94ff1b9cc51b80248564cb6190369ebcfc2eb
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import division, print_function, unicode_literals, absolute_import import os,sys from io import open import re # Python Compatability if sys.version_info[0] >= 3: unicode = str xrange = range from bottle import HTTPError from . import utils from ...
995,833
fd1e33434b79b2f2ad3e7b10f926f737d21397a9
#!/usr/bin/env python # -*- coding: utf-8 -*- import mako import json import os from girder import constants, events from girder.utility.model_importer import ModelImporter from girder.utility.webroot import Webroot from girder.api.rest import Resource, loadmodel, RestException from girder.api.describe import Descri...
995,834
f99baca36e9ace88b3bffd2387e5d584cdee8e2b
from network import shallow_resnet from tensorflow.contrib import layers from tensorflow.contrib.framework.python.ops import arg_scope from tensorflow.contrib.layers.python.layers import layers as layers_lib from tensorflow.contrib.layers.python.layers import regularizers from tensorflow.contrib.layers.python.layers im...
995,835
16a02a7c7f7b517857afa114f64099220a485238
import sys, pprint import maya.standalone maya.standalone.initialize() from pysideuic import compileUi #Print what we're running print "Running " + sys.argv[0] filepath = '' #Check for a passed in filepath or ask for one if(len(sys.argv) < 2): filepath = raw_input("Need a filepath argument:\n...
995,836
209effd35b5791f239a60501f71328022fddbc0c
from .geometry import rmsd, dihedral from .plots import sequential, histogram, ramachandran from .general import trj_data
995,837
5583958217b8cc8ce61821eb09bd38a231c4f715
from github import Github import boto3 import os GITHUB_API_TOKEN = os.getenv('GITHUB_API_TOKEN') github_client = Github(GITHUB_API_TOKEN) codecommit_client = boto3.client('codecommit') class bcolors: HEADER = '\033[95m' OKBLUE = '\033[94m' OKGREEN = '\033[92m' WARNING = '\033[93m' FAIL = '\033[...
995,838
6549df7be885e76d37a10ba2c174316fdad0983c
from .tile_data import TILE_DATA, SPRITE_DATA from .map_data import MAP_DATA from .sound_data import SOUND_DATA from .music_data import MUSIC_DATA
995,839
3ea2d3fcd32fc85c0e3763ad03f4584f39e05263
# Generated by Django 3.1.4 on 2021-01-19 14:03 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('pnr', '0015_remove_pnr_sabre_token'), ] operations = [ migrations.AddField( model_name='pnr', name='sabre_token', ...
995,840
1e3ef80f0ca579872f9e09d9d2a9227633f8ccf9
""" Implement Selection Sort """ def selection_sort(arr): l = len(arr) print (arr) for i in range(l): #print ("******%s=%s*****" % (i, arr[i])) index = i for j in range(i+1, l): #print ("%s, %s" % (arr[j], arr[index])) if arr[j] < arr[index]: index = j #print ("indy %s=%s" % (arr[i], arr[index]))...
995,841
9665395afbe8feda082d5daa83c5dd1aa4e15a45
from collections import namedtuple import torch from torchvision import models from utils.constants import SupportedPretrainedWeights class GoogLeNet(torch.nn.Module): """Only those layers are exposed which have already proven to work nicely.""" def __init__(self, pretrained_weights, requires_grad=False, ...
995,842
d0cc7d0daafe8d42db165f37227245529379b98d
#!/usr/bin/env python ## \file state.py # \brief python package for state # \author T. Lukaczyk, F. Palacios # \version 4.1.2 "Cardinal" # # SU2 Lead Developers: Dr. Francisco Palacios (Francisco.D.Palacios@boeing.com). # Dr. Thomas D. Economon (economon@stanford.edu). # # SU2 Developers: Prof...
995,843
875e2e5534dcca89c1712287d4cbd65b082913a6
total = 0 for i in range(1, 10): total += i print(total) total2 = 0 i1 = 0 while i1 < 5: total2 += i1 i1 += 1 print(total2) my_list = [6, 4, 5, 2, 9, -2, -3, -1, 15] # создаем список # задача: складывать цифры, пока не упремся в отрицательные, отрицательные не складывать print(my_list[0]) # квадрат...
995,844
c30e0164c82974d5ad1116f18b4ed4f18048ce15
# -*- coding: utf-8 -*- # @Author: JinZhang # @Date: 2018-03-22 13:06:51 # @Last Modified by: JinZhang # @Last Modified time: 2018-03-23 13:30:03 global _G; _G = {}; def setG(key,value): try: if id(_G[key]): print("The global var is existed !"); except Exception: _G[key] = value; def getG(key): try: ...
995,845
d4228813febed2572fbab155f0039174cc3f3e8f
import argparse import bz2 import gzip import json import io import os from datetime import datetime, timedelta from typing import Any, Callable, List, Optional, Text from urllib.request import urlopen try: import zstandard except ImportError: zstandard = None from .utils import git from . import log here ...
995,846
55624f8ae37a9503f570837e00e2d3a23743c0df
"""Sample code demonstrating management of Azure web apps. This script expects that the following environment vars are set: AZURE_TENANT_ID: with your Azure Active Directory tenant id or domain AZURE_CLIENT_ID: with your Azure Active Directory Application Client ID AZURE_CLIENT_SECRET: with your Azure Active Director...
995,847
c6b8f712964f2d440d1412f85440d231affb718e
from __future__ import print_function, division import torch import torch.optim as optim from networks.simplenet import SimpleANN from core.simul import DQNSimulator from agents.dqn import DQN from utils.env_wrapper import BasicEnv from utils.memory import ReplayMemory TOTAL_STEPS = 50000 TARGET_UPDATE_STEPS = 300 ...
995,848
b0e2c65f4a7e46790b7a473cee0b6faf809f7438
import numpy as np import pandas as pd import ComputeGrad from sklearn import datasets def softmax(a): C = np.max(a) exp_a = np.exp(a - C) if a.ndim == 1: sum_exp_a = np.sum(exp_a) y = exp_a / sum_exp_a else: sum_exp_a = np.sum(exp_a, 1) sum_exp_a = sum_exp_a.reshape(su...
995,849
a1442af73e484d3952931856c140da779adba2ef
import os from starlette.applications import Starlette from starlette.middleware import Middleware from starlette.middleware.cors import CORSMiddleware from starlette.requests import Request from starlette.responses import JSONResponse from starlette.routing import Mount, Route from starlette.staticfiles impor...
995,850
e3dbf466a6844e9db7192195067a1bb7e2f7e157
import time import pytest from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.ui import WebDriverWait from sqlalchemy import create_engine @pytest.yield_fixture() def driver(): driver = webdriv...
995,851
4af6cb9c7bb537ff2703ef7687f1192daf9d87d3
class Solution(object): def rotate(self, nums, k): length = len(nums) k %= length last = nums[-k:] for i in reversed(range(length - k)): nums[i+k] = nums[i] for i in range(len(last)): nums[i] = last[i]
995,852
fd543a7d33efc6e0942e1b1b1dedf1d8d527c550
import sys from Project import app, db from Project import views def main(): db.create_all() app.run(debug=True) return 0 if __name__=='__main__': sys.exit(main())
995,853
b27e85b86c13c33a7ec3b8b1f895ae62f8a9f825
import random import time class Car: def __init__(self, available, now_region, preferred_region, name): self.available = available self.now_region = now_region self.preferred_region = preferred_region self.name = name self.to_go = -1 def whether_can_go(self,wan...
995,854
16007d237d05d5ecd7f032bb1c13b45b67fd26a9
""" =========== Description =========== The popular video games Fallout 3 and Fallout: New Vegas has a computer hacking mini game This game requires the player to correctly guess a password from a list of same length words. Your challenge is to implement this game yourself. The game works like the classic game of Mas...
995,855
770f20943a5348e1e4b01e91ea579509986227db
def processStream(stream): ignore_garbage = False result = 0 open_data = 0 garbage_count = 0 open_garbage = False for c in stream: if open_garbage: if ignore_garbage: ignore_garbage = False elif c == '>': open_garbage = False ...
995,856
31284d45852fe71ecbacb3ea2d7b1b74f85719af
#!/usr/bin/python # -*- coding: utf-8 -*- import sys import os #Arrancamos el escenario vnx def crear(): print("Creamos el escenario") os.system("sudo vnx -f /home/upm/pfinal/pfinal.xml --create") #Paramos el escenario vnx y borramos todas las configuraciones def borrar(): print("Destruimos el escenario") os.syst...
995,857
fd0b6e7e51685b0e3f342ebefa12d4b1d9572459
class Game: def __init__(self, date, type, time, time_elapsed, host, guest, index1, pankou, index2, gameId): self.date = date self.type = type self.time = time self.time_elapsed = time_elapsed self.host = host self.guest = guest self.index1 = index1 self.pankou = pank...
995,858
65fc1d6b80e6c4fbdf4a09a3ef3c1bbca4697b5e
import os import urlparse from sqlalchemy import create_engine from werkzeug.wrappers import Request, Response from werkzeug.routing import Map, Rule from werkzeug.exceptions import HTTPException, NotFound from werkzeug.wsgi import SharedDataMiddleware from werkzeug.utils import redirect from jinja2 import Environment,...
995,859
2d630137ef3dcd8ba17a372bdc932c459340373a
""" Main flask app """ from flask import Flask, jsonify, request, render_template app = Flask(__name__) STORES = [ { "name": "Nike town San Francisco", "items": [ { "name": "Metcon 3", "price": 130 } ] } ] @app.route("/") def hom...
995,860
ef147863281933f5a9ab5a7a3495c4f942ef4f68
import torch from hem.models.inverse_module import InverseImitation from hem.models import Trainer from hem.models.discrete_logistic import DiscreteMixLogistic import numpy as np import matplotlib.pyplot as plt from hem.datasets.util import MEAN, STD import cv2 if __name__ == '__main__': trainer = Trainer('bc_inv...
995,861
3e13d0a2ed65b0ccc1d44b249b0d0eb911dcbf58
import sys, os, pygame, time from pygame.locals import * from math import * import random pygame.init() ####------Colours------#### BLACK = ( 0, 0, 0) BLUE = ( 0, 0, 255) DARKBLUE = ( 0, 0, 64) DARKGREY = ( 64, 64, 64) DARKRED = ( 64, 0, 0) WHITE = (255, 255, 255) RED = (255,0,0) ...
995,862
186473b852ab78faa9457b43c7cb210e295da999
# -*- coding: utf-8 -*- from django.shortcuts import render from django.http import HttpResponse from django.views.generic.base import TemplateView from django.views.generic.edit import FormView from booki.utils import log from booki.editor import models import os, tempfile from django import forms class Uploa...
995,863
077996763e30f3c4344655e34de8736b42841829
import curses import sys def display(copyright="declaration.md"): copyright_win = curses.newwin(4, 2, 10, 10) copyright_win.border(0) try: with open(copyright) as declaration: for lines in declaration: copyright_win.addstr(3, 3, lines) copyright_win.refre...
995,864
a35d6655de94bee39c3af5f18dba2869ca6043fb
from random import randrange import traceback, sys import json from msilib.schema import Class from flask import Flask from flask import render_template, redirect, url_for from flask import request, jsonify from gensim.models import Word2Vec from pymystem3 import Mystem from gensim.models import KeyedVectors import ge...
995,865
ea1955b37bfbaf1de5767a848d23acd3642431f2
import os import random import spacy from spacy.util import minibatch, compounding import pandas as pd TEST_REVIEW = """ Transcendently beautiful in moments outside the office, it seems almost sitcom-like in those scenes. When Toni Colette walks out and ponders life silently, it's gorgeous.<br /><br />The movie doesn...
995,866
2ba07f7c4dbf00cce06c2dff5079c9b0a37c4632
from modeltranslation.translator import TranslationOptions, translator from .models import MetaTag class MetaTagTranslationOptions(TranslationOptions): fields = ('title', 'keywords', 'description') translator.register(MetaTag, MetaTagTranslationOptions)
995,867
fa110ea5594611b8a70c33167773f8ab264168b0
import marshal import numpy as np import cv2 from collections import namedtuple from pathlib import Path from FPS import FPS import depthai as dai import time from math import gcd from string import Template SCRIPT_DIR = Path(__file__).resolve().parent MOVENET_LIGHTNING_MODEL = SCRIPT_DIR / "models/movenet_singlepose...
995,868
d4753adeca62e5ea00888a0c0e9f3150cb6be192
#!/bin/python3 import math import os import random import re import sys # Complete the balancedSums function below. def balancedSums(arr): l_idx=0 r_idx=len(arr)-1 l_sum=arr[l_idx] r_sum=arr[r_idx] while l_idx!=r_idx: if l_sum<r_sum: l_idx += 1 l_su...
995,869
1a33b75a9770446fe0ee604923b33a19adf4d8cb
def MoreThanHalfNum_Solution(numbers): # write code here res = None cnt = 0 for i in numbers: # 留下数组中出现次数最高的数 if not res: res = i cnt = 1 else: if i == res: cnt += 1 else: cnt -= 1 if cnt == ...
995,870
378118936d76bfaca89a2fcbb18648ed2cc8d1f5
import numpy as np from snc.agents.hedgehog.params import BigStepLayeredPolicyParams, BigStepPenaltyPolicyParams from snc.agents.hedgehog.policies.big_step_layered_policy import BigStepLayeredPolicy from snc.agents.hedgehog.policies.big_step_policy import BigStepPolicy from snc.agents.hedgehog.workload import workload...
995,871
f69a6e76604e6cc2a9c773c23f26203eb96ba6db
#!/usr/bin/env python3 from src import omnibus if __name__ == '__main__': print('WARNING: PARAMETERS ARE SET FOR A LOCAL ENVIRONMENT') omnibus.run(host='127.0.0.1', port = 5001, debug=True)
995,872
12b8761443356aeb81f03541c06c5957fc16d48d
nucleotides = {"A": 0, "C": 0, "G": 0, "T": 0} def count(file): for x in file: if x in nucleotides.keys(): nucleotides[x] += 1 return nucleotides if __name__ == '__main__': file = open('/Users/nadiabey/PycharmProjects/rosalind/rosalind_dna.txt', 'r').readlines()[0] count(file) ...
995,873
869b2bc59722bab5d6538250d191a96ed51b4c67
from abc import ABC, abstractmethod from collections import Counter from typing import Callable, Iterable from checklisting.result import BaseTaskResult from checklisting.result.status import TaskResultStatus class BaseTaskResultStatusValidator(ABC): def of_results(self, results: Iterable[BaseTaskResult]) -> Ta...
995,874
69ca8d38370f31b4a4505e09b10fc76307287094
import pygame import sys from TileMap import TileMap from Ant import Ant import AntBootCamp # Initialize pygame pygame.init() pygame.mixer.init() pygame.font.init() # Query the user as to the number of ants to start with. # Constrain it to 1-100 to prevent ridiculousness. numAnts = -1 while numAnts == -1: try: ...
995,875
ff3cba0535668303a6162970f00be968aa54488c
"""Seed file to make sample data for flask_feedback db.""" from models import User, Feedback, db from app import app # Create all tables db.drop_all() db.create_all()
995,876
10734c9e529ade925c45b2e611af71e1ec817f04
# Generated by Django 3.1.1 on 2020-10-04 13:39 import datetime from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('dash', '0015_auto_20201004_1905'), ] operations = [ migrations.RemoveField( model_name='qna', name='...
995,877
bf8ce3290780280a97b81ac3e1cff12b1a981d34
from types import MappingProxyType from typing import Mapping, Union, Any from django.contrib.auth.hashers import make_password DEFAULT_USER_PARAMS: Mapping[str, Union[Any]] = MappingProxyType( { "email": "member@messages.com", "username": "member", "password": make_password("member_passwo...
995,878
09f62b31cfe8676ca55b264f1b1a63bc41af8aef
from django.conf.urls import url from . import views urlpatterns = [ url(r'^pushgovtnotification/$', views.pushgovtnotification, name='pushgovtnotification'), url(r'^getgovtnotifications/$', views.getgovtnotifications, name='getgovtnotifications'), url(r'raiseinterest/$',views.raiseinterest,name='raiseinte...
995,879
09f3a7ffa72e9d8513f323edcc6fb22ef619c4ba
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Parses a XML file and counts the node types """ import xml.etree.ElementTree as ET import pprint def count_tags(filename): osm_file = open(filename, "r") tags = {} # get an iterable context = ET.iterparse(osm_file, events=("start", "end")) ...
995,880
22b35ac5c6419a940e901a7201a78bacb43280e6
# -*- encoding: UTF-8 -*- #获取一个 1-100 的随机数 目标值 import random goalNum = random.randint(1,100) print('目标值:', goalNum) num = -1 while num != goalNum: num = int(input('请输入1-100内的随机数:')) if num > goalNum: print('大了') elif num < goalNum: print('小了') print('Congratulations!')
995,881
31a356964d66761a0ac889d5539bf9c6476862ce
""" Django settings for ktlweb project. Generated by 'django-admin startproject' using Django 1.9. For more information on this file, see https://docs.djangoproject.com/en/1.9/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.9/ref/settings/ """ # Build paths i...
995,882
51c50b7258dbcc77369174f0f442dbb506d6dabf
# Copyright 2020 Google # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, soft...
995,883
8e3fe72d0804cff95ac47f0a90bc8eaded315f9c
from torchtext.datasets import Multi30k from torchtext.data import Field, BucketIterator, Dataset import spacy import numpy as np import random import math import time import dill as pickle from transformer import Constants def tokenize_de(text): """ Tokenizes German text from a string into a list of string...
995,884
5950f187ba73da3fdbe9ded868609285cb654f7d
# port definitions from course_vocab to vocab from connect import connect def port_definition(cur, course_id, vocab_id): DEFCOM = """SELECT definition FROM course_vocab WHERE course_id=%s AND vocab_id=%s """ cur.execute(DEFCOM, (course_id, vocab_id)) definition = cur.fetchall()[0][0] ...
995,885
c4691bfb93a98281d262f96a301c7df55e5c15ab
# -*- coding: UTF-8 -*- import unittest from eolas.lexer import lex from eolas.parser import parse class LexTest(unittest.TestCase): def test_identifiers(self): idents = ("a", "foo", "___x", "with spaces", "a b c d", "if true") for ident in idents: self.assertEqual(ident, next(lex(ide...
995,886
8325094ebe012a6c6a1599e9dfa2ba45fc0b8ede
import tensorflow as tf # Import TensorFlow Datasets import tensorflow_datasets as tfds tfds.disable_progress_bar() # Helper libraries import math import numpy as np import matplotlib.pyplot as plt import logging logger = tf.get_logger() logger.setLevel(logging.ERROR) dataset, metadata = tfds.load('fashion_mnist', ...
995,887
279af42b0381bb3ef68d1a336f6368f2c10d7466
from .caffael_exception import CaffaelException class MissingInformationError(CaffaelException): pass
995,888
23988794e6c3749687d245bd148674f6132d7e51
"""Tests for the Markdown application create API.""" from django.test import TestCase, override_settings from marsha.core import factories as core_factories from marsha.core.factories import ( OrganizationAccessFactory, PlaylistAccessFactory, PlaylistFactory, ) from marsha.core.models import ADMINISTRATOR ...
995,889
049fb10c68ae49cdd1a5b58a44242643c9d174e1
from django.apps import AppConfig class ProjectsAwardsConfig(AppConfig): name = 'projects_awards'
995,890
be1a1b49cc7a7f9daf0ecbe7c3ce5afc4ccd8813
import tweepy, re, twitterKeys, tag, datetime RE_EMOJI = re.compile( u'(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])') TWEET_COUNT = 2500 PAGE_COUNT = TWEET_COUNT / 100 DIV_BY = 4 auth = tweepy.OAuthHandler(twitterKeys.consumer_key, twitterKeys.consumer_secret...
995,891
5a29113efd0d7f395fc9fc17a8040cdcb71a0b88
from datetime import datetime from asyncpg import UniqueViolationError from aiohttp import web import hashlib from gino import Gino db = Gino() class BaseModel: @classmethod async def get_or_404(cls, id): instance = await cls.get(id) if instance: return instance raise we...
995,892
863210ff5fb3a498ee29f000684a0c6393c55586
import re from typing import Tuple re_class_name = re.compile(r"([A-Z]*[a-z]*)") def convert_class_name(name: str) -> str: """ >>> convert_class_name('ClassName') 'class_name' >>> convert_class_name('ABClassName') 'abclass_name' """ name_tokens = re_class_name.findall(name) return "_"...
995,893
0b6a385e583272d4865dc21fd6751b335e10dd5b
#! /usr/bin/env python3 # f(f(x)) = f(x) def add_ten(num): return num + 10 # non idempotent example print(add_ten(add_ten(10))) print(abs(-10)) # idempotent example print(abs(abs(-10)) == 10)
995,894
4bcaf9ed5db498cd2c5d61744ca2276d87cbf6dd
# Camera communication over the internet # Used to send / receive information about cameras on a network import socket import sys import time import raspcam.database import threading broadcast_message = 'iccom_raspcam_broadcast' class ICCom: def __init__(self, isHub, port): self.isHub = isHub se...
995,895
3d73a83cfb7b3e52d4f7a56f653c4aea0d8956e0
import sys def gcd(a, b): a, b = max(a, b), min(a, b) while a % b > 0: a, b = b, a % b return b def solve(): input = sys.stdin.readline N = int(input()) A = [int(i) for i in input().split()] gcdA = A[0] for a in A: gcdA = gcd(gcdA, a) print(gcdA) return 0 if __name__ ...
995,896
7322c154dd4f48a158856e20b7418c4224607e6d
import shutil shutil.copy("country.txt","data.txt")
995,897
65f62bbf5f5fa5e31621e88b89a97b8537474fb2
from django.apps import AppConfig class MosiauthConfig(AppConfig): name = 'apps.mosiauth'
995,898
d99686bbba3788b8dcc496e8e7e301d1d95e4e10
# coding: utf-8 import os import pandas as pd import torch from torch.autograd import Variable import torch.nn as nn import torch.nn.functional as F import torch.optim as optim # funções para mostrar as imagens import numpy as np import matplotlib.pyplot as plt import torchvision import torchvision.transforms as trans...
995,899
438e462224e8289184983601aecd51c3e62029c3
from _typeshed import NoneType import requests from bs4 import BeautifulSoup import pandas as pd from datetime import date import sqlite3 def data_entry(con,code,name,price,date): command = con.cursor() table_detail = command.execute(""" SELECT * FROM "Product Code Details" """) table_rows...