index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
989,000
e5700bccf6f4a316fa61c3234f1324a5abbe07a9
import pandas as pd import numpy as np from scipy.stats.mstats import gmean def softmax(X, theta=1.0, axis=None): """ Compute the softmax of each element along an axis of X. Parameters ---------- X: ND-Array. Probably should be floats. theta (optional): float parameter, used as a multiplier ...
989,001
d5e89ee77e3a9291b3e4937254b1525f605c3813
from django.conf.urls import url,include from django.contrib import admin from django.conf import settings from django.conf.urls.static import static urlpatterns = [ url(r'^',include('home.urls',namespace='home',app_name='home')), url(r'^admin/', admin.site.urls), url(r'^blog/',include('blog.urls',namesp...
989,002
77df14d4737c9fb208d00da2655a35f8fb768239
# Generated by Django 2.1.2 on 2018-11-20 16:48 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('bugtracker', '0005_auto_20181113_1253'), ] operations = [ migrations.AlterField( model_name='ticket', name='bugs', ...
989,003
21914319cc46825445a0936fa537d9e0283303cd
#!/usr/bin/env python # -*- coding: utf-8; mode: Python; py-indent-offset: 4 -*- import os import sys include = ["base_project"] exclude = [] incstr = " ".join(include) excstr = ",".join(exclude) print("Checking PEP8 ...") if os.system("pycodestyle --show-source --show-pep8 --max-line-length=79 --filename=*py " +...
989,004
38e88485c32b5690d46c593cd36865f5e48afcbc
#!/usr/bin/env python import RPi.GPIO as GPIO import time #pins = [11,12,13,15,16,18,22,7] pins = [7,22,18,16,15,13,12,11] dats = {"0":0x3f, "1":0x06, "2":0x5b, "3":0x4f, "4":0x66, "5":0x6d, "6":0x7d, "7":0x07, "8":0x7f, "9":0x6f, "A":0x77, "b":0x7c, "C":0x39, "d":0x5e, "E":0x79, "F":0x71, ".":0x80} ...
989,005
bc45fa681424e629000bb03f534375fe3ae9692a
import struct from Utils.output_code import OutputType from ICMP.ICMP_packet import ICMP class ICMPHandler: def __init__(self, sequence, data): self._pack_header = self._unpack_packet_header(data[20:28]) self._type = self._pack_header[0] self._sequence = sequence self._data = data ...
989,006
124494a36cab9853f2ac0c332f8bb9ae4a2a5d02
""" Given a path prefix PREFIX of directories containing files config.json dev/{summary.json,average_activations.npy,average_norms.npy} train/summary.json,average_activations.npy,average_norms.npy} In the directory associated with the prefix, outputs the following files dev_loss.pdf train_loss.pdf dev_train_gap.pdf ...
989,007
0d489c71aa5f829725094efe1262327025e1b910
from flask import render_template, redirect, url_for, flash, request,session from models.department_model import DepartmentModel class Department: @staticmethod def create_department(): """"create""" if session: username = session['username'] if request.method == 'POS...
989,008
5f586c98421d20214ee030a72e7b8efb36e871c3
ANYONE = None NOONE = -1 BLACK = 0 WHITE = 1 TURN_CHNL = 2 INVD_CHNL = 3 PASS_CHNL = 4 DONE_CHNL = 5 NUM_CHNLS = 6 class Group: def __init__(self): self.locations = set() self.liberties = set() def copy(self): groupcopy = Group() groupcopy.locations = self.locations.copy() ...
989,009
0464bc549938722385c4e7cca1df6db4bec0b412
import logging import numpy as np from scipy.linalg import pinv, solve from scipy.spatial import cKDTree from uncoverml import mpiops log = logging.getLogger(__name__) def impute_with_mean(x, mean): # No missing data if np.ma.count_masked(x) == 0: return x for i, m in enumerate(mean): ...
989,010
f0d252e082c88dd6d9446bcfa0b4050748f798b5
import osmium import shapely.wkb as wkblib import numpy as np import pandas as pd import geopandas as gpd from rtree import index from shapely.geometry import Point, Polygon # TODO: class to extract ANY desired information from OSM, not only ways. How to do it? class OsmRouteAnnotator(osmium.SimpleHandler): def ...
989,011
4653a0fa91e2e81cfd37d7d75a9cc233a18e1bb5
"""Seamless high-level API. Has a two-fold function: 1. Maintain a workflow graph containing nodes (cells, transformers etc.), checksums, and connections. This workflow graph is pure data that can be serialized any time to JSON (.seamless file). 2. Maintain a translation of the workflow graph to a low-level represen...
989,012
b6d11baa39e79289692a9d73f11046d1f2c16dd1
from dazer_methods import Dazer from pandas import read_csv from uncertainties import ufloat from numpy import array, median, searchsorted, max, where, ones, mean from astropy.io import fits from DZ_observation_reduction import spectra_reduction def Emission_Threshold(LineLoc, TotalWavelen, TotalInten, BoxSize = 70):...
989,013
04b09513d658cd3315b43ce536f3684fc7cc0868
# Generated by Django 3.1.13 on 2021-08-19 01:24 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] op...
989,014
58e44e2bf6909a103aeb585f46eb42c014f815a8
from library.PowerType import PowerType from library.Action import Action import numpy as np import random class ActionFactory: """This helps to create common actions and keep them consistent. Not thread-safe""" def __init__(self): self.actions = {} # name: powerType self.randomActionLastId ...
989,015
c55dd08f3ae69d6c24baff1113c0fee8db1dc069
# Generated by Django 2.1.5 on 2019-10-31 19:40 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('lotlinfoarchive', '0016_auto_20191030_0007'), ] operations = [ migrations.AlterField( model_name='musician', name='r...
989,016
fd3cac22c0c0a8c419a16ddbb0986d7fa055bb08
import os import glob import pandas as pd import numpy as np from BasicIO.filenameString import getFilenamePair def checkExistanceOfFiles(imageFilename, maskFilename): """Check if there is the image and its corresponding mask. Parameters ---------- imageFilename : str Full path to the image. ...
989,017
4e8129dd3dd4f396630c0dfffca3925dbb7e0ab1
# -*- coding: utf-8 -*- # @Time : 2021/02/01 17:18 # @Author : Lim Yoona # @Site : # @File : 04_is_or_equal.py # @Software: PyCharm """ 这里是关于==、is的辨析问题 """ import copy a = [11,22,33] b = a print(a == b) print(a is b) c = copy.deepcopy(a) print(a == c) print(a is c) """ ==:表示的是两个比较对象的值是否相等 is:表示的是两个比较...
989,018
431e2b295d06dfa1e7c99ebdbe99817564d01850
from odoo import models, fields class ItiSkills(models.Model): _name = 'iti.skill' name = fields.Char()
989,019
651b4bb6fb64b8cc5a31cb09cfd0dd12590a2497
def checkStatement(number): assert number > 10 , "The number is less than 10 can't be taken" print("Yep, Number is greater than 10 :-)") numb = int(input("Enter Number : ")) try: checkStatement(numb) except AssertionError as e: print(e)
989,020
3099ffdb332e37c9249a9561349cb4cfaadae173
def multiples_no(limit): i=1 sum=0 while i<=num: if i%3==0 or i%5==0: print(i) sum=sum+i i=i+1 print("sum:-",sum) num=int(input("enter the number:")) multiples_no(num)
989,021
2d41f1309b6d60537726426b72d881b86a428419
from flask import Flask from flask import render_template from flask import g from flask import request import json from lockdown import Cell import lockdown app = Flask(__name__, static_folder="static") DATABASE = 'demodb.sqlite' def get_db(): db = getattr(g, '_database', None) if db is None: db = ...
989,022
025bba291dd2b890a57f9ab9628ed69149946234
from locust import HttpLocust, TaskSet, task username = 'admin' password = '123456' class MyTaskSet(TaskSet): def on_start(self): csrftoken = self.client.get('accounts/login').cookies['csrftoken'] self.client.post("accounts/login/", {"id_username":username, ...
989,023
6cdafd264f58e37b6bab6f042913cd478504da53
import math import itertools from collections import deque from PIL import Image, ImageDraw class Scheduler: def __init__(self): self.jobs = [] def addJob(self, job): self.jobs.append(job) def loadAvailJobs(self): return [x for x in self.jobs if not(x.finished) an...
989,024
c792834fe969c1813900cc808db889a877fb41f6
# Crie um programa que tenha a função leiaInt(), que vai funcionar de forma semelhante 'a função input() do Python, # só que fazendo a validação para aceitar apenas um valor numérico. # Ex: n = leiaInt('Digite um n: ') def leiaInt(msg): ok = False #Declara o ok como Falso para validação no break do Loop While quan...
989,025
39c7afe000f084a5cb1498bffadeb4f1e94bba7a
########################### ## _ANchangeeDirName.py ## ## 2019.10.28 ########################### import sys import os dir_lst = sys.argv[1:] # the first argument is the script itself for d in dir_lst: if os.path.isdir(d): file_lst = os.listdir(d) else : print (p+"is not directory") [lind...
989,026
27cf233df0585e9c3f88b64f50e8b8cb8d8be922
N1, N2, N3, N4 = input().split(' ') N1, N2, N3, N4 = float(N1), float(N2), float(N3), float(N4) MEDIA = (N1*0.2)+(N2*0.3)+(N3*0.4)+(N4*0.1) if MEDIA >= 7: print('Media: {:.1f}' .format(MEDIA)) print('Aluno aprovado.') elif MEDIA < 5: print('Media:', int(10 * (N1*.2 + N2*.3 + N3*.4 + N4*.1)) / 10) pri...
989,027
9832d6078942af396ff185280c42b064f6fb6fe8
# Set Postgres configurations as a dictionary(key value pair) PGSQL_CONFIG = { 'host': 'host_name', 'db_name': 'Database_Name', 'user': 'Username', 'password': 'user_password', 'port': 3306 }
989,028
cd9472ea7cf8e337a318991aec1f92e513cb92f9
#!/usr/bin/env python3 -B import unittest import os import os.path import hashlib import json import uuid import pprint import inspect from itertools import groupby from pathlib import Path import warnings from tests import TestSalesPipelineOutput from cromulent import vocab vocab.add_attribute_assignment_check() cl...
989,029
a5071bb80e1bd6536484c5cb042acae4a41e9f19
# !/usr/bin/env python # Copyright 2014 Vodkasoft # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agre...
989,030
95536566ffae5a577c153afa3ad67f6d6f2d7715
/home/oseiasbeu/anaconda3/lib/python3.7/fnmatch.py
989,031
84c65ee36f21346ce4fd2d70af4375e0c9427344
# -*- coding: utf-8 -*- r""" Tamari Interval-posets This module implements Tamari interval-posets: combinatorial objects which represent intervals of the Tamari order. They have been introduced in [PCh2013]_ and allow for many combinatorial operations on Tamari intervals. In particular, they are linked to :class:`Dyck...
989,032
a7c8d15e32fde66bf2e3ae7aee7ccc2f750d0a0c
from django.conf import settings from rest_framework import status from rest_framework.response import Response from rest_framework.generics import GenericAPIView from ..permissions import IsAuthenticated from ..app_settings import ( MoveSecretLinkSerializer, DeleteSecretLinkSerializer, ) from ..models import...
989,033
1ea64046556aa1a2acfbb85fa5188eb292c1236c
""" tldr: modifies the squad data to fit the requirements of my experiment 2 (topic contexts) author: @rohitmusti """ import ujson as json from tqdm import tqdm from toolkit import fancyprint, save, quick_clean import config from data_clean_exp2 import exp2_transformer from data_clean_exp3 import exp3_transformer def...
989,034
4c507cbf3be3ec87d50a0dcda6f5a2ffc90b695c
import click from acgt import Acgt @click.group() def cli(): """Example script.""" pass @click.command() @click.argument('project_name') @click.option('--js',default=False, help="generate js file") @click.option('--flask',default=False, help="generate flask file") def init(project_name, js, flask): project ...
989,035
5f8ed03e94b139527ac44011e02d2ad0d467aa8a
#Multiple Linear Regression - multiple features, one label #General Equation is that of a straight line with multiple features: y = b0 + b1x1 + b2x2 + ... + bnxn #sourced from superdatascience.com #-------------------------------- Preprocessing ----------------------- #import the libraries import numpy as np import p...
989,036
c56729b0c3260903d49b4c09fcf3e138f77dc38f
from django.db import models from util.fields import CurrencyField from categoria.models import Categoria class Product(models.Model): name = models.CharField(max_length=255, verbose_name=('Nombre')) slug = models.SlugField(verbose_name=('Slug'), unique=True) active = models.BooleanField(default=False, ver...
989,037
f3d7b5319cdd919f8671be5747e33bf59a1e89b3
# -*- coding: utf-8 -*- """setup.py: setuptools control.""" import re from setuptools import find_packages, setup version = re.search(r"^__version__\s*=\s*'(.*)'", open('src/tav/cmd.py').read(), re.M).group(1) setup( name='tav', version=version, description='TBD', long_descriptio...
989,038
65be7d13d864c9785968ab7967205f7ad498e814
from typing import List class Solution: def closedIsland(self, grid: List[List[int]]) -> int: row, col = len(grid), len(grid[0]) if row == 1 or col == 1: return 0 def neibor(i, j): connect = [ (i+1, j), (i-1, j), (i, j-1), (i, j+1) ...
989,039
2c6c324c068105b1538f90745ed8439adfd2060d
import sys sys.path.append('../pytorch-CycleGAN-and-pix2pix/') import importlib from models import networks class UnetNormalized(networks.UnetGenerator): """ Subclass of UnetGenerator from pix2pix that also normalizes the output (since I was getting weird results) """ def __init__(self): super...
989,040
09126e5a9bed34a175600c4acd63eb325ac25e8b
import json #import pprint #only for fun printing from TwitterModule import * #names = ['@IngrahamAngle','@davidhogg111','@sleepnumber','@ATT','@Allstate','@esurance','@Bayer','@RocketMortgage','@LibertyMutual','@Arbys','@TripAdvisor','@Nestle','@hulu','@Wayfair','@FoxNews','#BoycottIngramAdverts','#boycottLauraIngrah...
989,041
9a77bcbfc04208a833c3b021170bd5b7120770ff
""" Implementation of the logic to solve the nonogram. """ import copy from nonogram.rules import r1 from nonogram.rules import r2 from nonogram.rules import r3 from nonogram.solution import Solution RULE_FUNCS = (*r1.RULES, *r2.RULES, *r3.RULES) def solve(raster): """Does a rule based elimination on the raste...
989,042
e2555f2b73bbad1eee96d61aa46482ad997f1b7d
import six import sys import os if sys.version_info[0] >= 3.3: from types import SimpleNamespace as Dataset else: from argparse import Namespace as Dataset def associate_by_ext_suffix(datasets): has_ext = [] has_no_ext = [] for dataset in datasets: out_list = has_ext if "_ext" in dataset....
989,043
e951c02bbd65136f89a41e8d7f53f9315864b8f0
import numpy as np import torch import torch.nn as nn import torch.optim as optim from torch.optim import lr_scheduler from torch.utils.data import Dataset from torch.utils.tensorboard import SummaryWriter import os from before_ex import vnet_wr import time #import matplotlib.pyplot as plt import cv2 def np_select...
989,044
909ae044570b66e8512150beb9de74a5b79e4f41
import random class Monster: def __init__(self, name, attackType, health, attack, defense, drop): self.name = name self.attackType = attackType self.health = health self.maxhealth = health self.attack = attack self.defense = defense self.dropls = drop def...
989,045
ae15d98540cf970688b89d0abee54b6e7fb19a1c
from microbit import * ledOff = 0 #Interpret as bit off ledOn = 9 #Interpret as bit on LongPress = 500 #No magic numbers! ShortPress = 100 INPUTTING = 3 #Needed for switching between screens CONVERTING = 4 screen = INPUTTING leds = ["0" for i in range(32)] #Initialize 32 bit array to ascii 0s bit = 0 #leds array ind...
989,046
a75ce0ff0b7a440156896eaa13ab641445d435af
from glass.command import command @command def samplex_random_seed(env, s): env.model_gen_options['rngseed'] = s @command def samplex_add_noise(env, n=1e-6): assert 0, 'samplex_add_noise: DEPRECATED FUNCTION' @command def samplex_stride(env, s=1): assert 0, 'samplex_stride: DEPRECATED FUNCTION' @command...
989,047
5dea135da674dd1122c3c1db6861f55e0949e5e4
dict = { "name": "Arun", "lastname" : "Suryan" } print(dict.get("name"))
989,048
1239fd380d0affd4f804ecbd9f275c60860f4cb8
from django.test import TestCase from django.http import HttpRequest from webp_converter.context_processors import webp_support class TestContextProcessors(TestCase): def test_webp_support_true(self): request = HttpRequest() request.META["HTTP_ACCEPT"] = ( "text/html,application/xhtml+...
989,049
d20c26293b86b18f35765e41b6ddc7d8300c2b9e
class car(object): def __init__(self, name, type): self.name = name self.type = type def getName(self): return self.name def gettype(self): return self.type def __str__(self): return "%s is a %s" % (self.name, self.type) def __init__(self): self...
989,050
4c1ec677a7f9b1a55585c40e1f6b48fb6b056d8f
from flask import Flask, render_template, redirect, url_for, request, jsonify from subprocess import Popen, PIPE import requests, json, socket, sys from publish import Publish from subscribe import Subscribe app = Flask(__name__) hostname=socket.gethostname() @app.route('/') def index(): return render_template(...
989,051
4db2430b3b9596809acbde28eb4162b11babc9a6
import tensorflow as tf import tensorflow_hub as hub import sentencepiece as spm import matplotlib.pyplot as plt import numpy as np import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' import pandas as pd import re import seaborn as sns # data = pd.read_csv('atec_nlp_sim_train_add.csv', header=None, delimiter="\n") def ...
989,052
4b7123db1bbab9320747279bd7d6fcf32d41f973
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Sep 28 22:15:53 2020 @author: Cheerag Even Fibonacci Numbers Given a number N find the sum of all the even valued terms in the fibonacci sequence less than or equal to N. Try generating only even fibonacci numbers instead of iterating over all Fib...
989,053
421e4f1d09acccef17b898ac710171e26787f618
# # # main() will be run when you invoke this action # # @param Cloud Functions actions accept a single parameter, which must be a JSON object. # # @return The output of this action, which must be a JSON object. # # from datetime import datetime import sys import requests import pystache import config def callAPI(url,...
989,054
0fbb36136254c7899f22b13e91c5e937791a60e9
nums = [] for _ in range(9): nums.append(int(input())) # sort를 안쓰는게 편할것같다는 생각을 했음. # 최댓값이랑 index를 저장 max = nums[0] count = 1 for i in range(9): if max < nums[i]: max = nums[i] count = i+1 print(max) print(count)
989,055
5f338ce787b102d9c694c300d1a32b899c8dcfea
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Nov 8 11:59:50 2018 @author: spalazzo """ """ 2048 GUI """ # import modules import os import pygame # pygame specific locals/constants from pygame.locals import * # some resource related warnings if not pygame.font: print('Warning, fonts disabled')...
989,056
004eba63115a11de6a3aab599e88a9878cf5474c
import sys; sys.path.append("/Users/Shared/cs8"); import cTurtle t = cTurtle.Turtle() def f(x): if x%2 == 0: y = x//2 else: y = 3*x+1 return y def draw(xs): x=xs while x>1: for i in range(3): t.forward(x) t.right(120) for i in range(3): ...
989,057
66fc239cf35f3f44e9fb2d5fef501e754d6a4a88
/home/rosan/anaconda3/envs/Jarvis/lib/python3.6/copyreg.py
989,058
595291b4ea15a9d6de69f8a47a966bdbd9f98e58
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys if __name__ == '__main__': N = int(input("Количество сданных экзаменов = ")) if N > 20: print("Ошибка", file=sys.stderr) exit(1) if N == 1: a = " экзамен" elif N <= 4: a = " экзамена" else: ...
989,059
7bea9d1682bd57b6f9c60eedb6ba0934b11889b9
# Considerando a existência de notas (cédulas) nos valores R$ 100, R$ 50, R$ 20, R$ 10, R$ 5, R$ 2 e # R$ 1, escreva um programa que capture um valor inteiro em reais (R$) e determine o menor # número de notas para se obter o montante fornecido. O programa deve exibir o número de notas # para cada um dos valores de not...
989,060
d620b004070838f01d63e43f34a205105991249d
from lexer import * from tree import * # from tabletext import * error_table = {"Wrong delimiter": -1, "Wrong key_word": -2, "No such identifier": -3, "Wrong integer": -4, "Must be empty": -5, "Missing lexema \'unsigned-integer\'": -6, "Semantical error: label is already declareted": -7} temp = lexer(...
989,061
05332314dd23f6561a63449afa24a8209074e329
def foo(n): return 2 * n def square(x): return x ** 2 def cubic(x): return x ** 3 print(square(cubic(2))) print(cubic(square(2)))
989,062
21d0ee13e2e9d256f457a0b5795c878b8b86bf36
# Generated by Django 3.2.4 on 2021-06-22 06:02 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('main', '0008_desc_type1'), ] operations = [ migrations.AlterField( model_name='expense', name='balance', ...
989,063
b9355f7cf9fa59c900b0008c586d38bc1022f22b
import xlrd import pymysql import time #打开数据所在的工作簿,以及选择存有数据的工作表 book = xlrd.open_workbook(r"F:\python自动化测试\day07_mysql工具类与excel读取\2020年每个月的销售情况.xlsx") sheet = book.sheet_by_index(0) #建立一个MySQL连接 conn = pymysql.connect( host='localhost', user='root', passwd='', db='fuzhuang', port...
989,064
ab4facf89bca436ab87c69212771f233a7612f2e
import nltk import string from nltk.tokenize import sent_tokenize from nltk.tokenize import word_tokenize import csv def getnegCount(sentence,words_negscore): text = nltk.word_tokenize(sentence) count=0 for word in text: if word in words_negscore: count+=1 return count def negativity_count(name): words...
989,065
45adaa848328b4d54242eef2781cca66a3c66e13
from threading import Timer import time def debounce(wait): """Postpone a functions execution until after some time has elapsed :type wait: int :param wait: The amount of Seconds to wait before the next call can execute. """ def decorator(fun): def debounced(*args, **kwargs): ...
989,066
0d0e50906566e11f0a751405ba96ea1cc5690085
class product: def __init__(self): self.name='SAMSUNG GALAXY E7' self.description='GOOD' self.price=21000 p1=product() print(p1.name) print(p1.description) print(p1.price)
989,067
f34b8d817fd9e52f6f6d8c06331fd85b2293a315
from gensim.models.word2vec import Word2Vec import matplotlib.pyplot as plt from sklearn.manifold import TSNE import numpy as np model = Word2Vec.load('Failure_workaround.model') #keywords = [u'clock',u'flash',u'dma',u'sdram',u'cache',u'parity',u'state',u'set',u'register',u'interrupt',u'interrupts',u'mode',u'reset',...
989,068
88c724a0aa42d55642231b506ad0dcead26e9b40
# ipcalc/api/pingy/models.py # Flask Imports from flask_restplus import fields # Local Imports from . import api pingy_model = api.model('Pingy', { 'ip_address': fields.String(required=True, description='IP Address'), }) pingy_multi_model = api.model('Multi Pingy', { 'subnet': fields.String(required=True, d...
989,069
5c73314d3b554cab0ddac4809ac1fc2302718887
print('*****BIENVENIDO AL EJERCICIO 002*****') lado = int(input('porfavor ingrese el lado del cuadrado: \n' )) perimetro = lado * 4 area = lado * lado print(f'El perímetro es {perimetro} y el área es {area}')
989,070
2a5ef5636ec5dd8a961133be925dec882fd1a889
# Generated by Django 2.0.1 on 2018-04-16 21:20 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('board', '0004_auto_20180416_1238'), ] operations = [ migrations.RenameModel( old_name='Response', new_name='Comment', ...
989,071
1134987dd10a8073744643a5b83053e37ae2095e
"""template.py This is a template""" def toStrConj(List): assert List != [] clauseStr = '(' for lit in List: clauseStr += lit clauseStr += ' and ' clauseStr += ' (TRUE or -TRUE))' return clauseStr def toStrDisj(List): assert List != [] clauseStr = '(' for lit in List: ...
989,072
5a71b312590457e3b73228992144478d6ed917ab
# importing required modules import threading , socket , os from Code import * import ast class Client: # Creating Socket user = None sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM) def sendmess(self): # Sending Message while True: msg = input("You : ") data = {"msg":self.user.send(bytes(msg,"utf-...
989,073
fad79dd788f9fe557ce2559213af34146362507f
# coding=utf-8 ''' Created on 2013-12-5 @author: lidm1 ''' import ldap class Ldap(object): """ Ldap for lenovo domain """ def __init__(self): None def connect(self,user_name,password): try: SERVER = "ldap://lenovo.com:389" DN = u...
989,074
e84ad5298649533c91207a99b2cc56ac16857fd4
from subprocess import check_output check_output("dir C:")
989,075
9dc4e706a63f81f27bdfa15f9e9d3be4b7ab23a1
#!/usr/bin/python # -*- codding: utf-8 -*- import os import sys sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__)))) from common.execute_command import write_parameter # url : https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/describe-instances.html if __name__ == '__main__...
989,076
387c0250c3cb39bbb4f9b2ed5ffae83a54abbdf4
#!/usr/bin/env python3.1 # # Copyright (c) 2010, Philipp Stephani <st_philipp@yahoo.de> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the...
989,077
5edd111470a6a18adaef20fc6c1ecaa8ae819d70
# -*- coding: utf-8 -*- """ Created on Sat Jan 16 22:20:53 2021 @author: subrat """ ##OOP python class and instances class member: def __init__(self, first,second,session): self.first=first self.second=second self.session=session self.email=first + second + "@gmail.com" ...
989,078
0f7b136851a8d1225034f308c89a5e1ec5f37d09
# Creates a graph. import tensorflow as tf #from tensorflow.compat import v1 as tf #sess = tf.InteractiveSession() @tf.function def d(a,b): return tf.matmul(a, b) a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a') b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b') #c = ...
989,079
6d2eb1861601cebda4916ef0a41145ce996f9c05
import random as r zobrist_keys = [[r.randint(1, 2**64 - 1) for _ in range(12)] for _ in range(64)] def hash_board(board): # chess.Boars key = 0 for i in range(64): if board.color_at(i) is not None: ind = board.piece_type_at(i) + 6 * board.color_at(i) - 1 #abuse of type coercion ...
989,080
f07ad77aea20f8457250ccd969d7919ef8e56d85
from flask import Flask, request, redirect, render_template, make_response, Response from flask_login import LoginManager, login_user, login_required, logout_user from flask_wtf import FlaskForm from wtforms import StringField, TextAreaField from wtforms.validators import DataRequired from flask_wtf.csrf import CSRFPro...
989,081
7b7f7b32cd0582ecef923a13a87c57158ca49042
'''Problem In DNA strings, symbols 'A' and 'T' are complements of each other, as are 'C' and 'G'. The reverse complement of a DNA string s is the string sc formed by reversing the symbols of s, then taking the complement of each symbol (e.g., the reverse complement of "GTCA" is "TGAC"). Given: A DNA string s of lengt...
989,082
870c9a030eaa424ef7afbdc5385ba287bb716c18
from flask_wtf import FlaskForm from wtforms import SubmitField, StringField, DecimalField, FileField from wtforms.validators import DataRequired class ProductForm(FlaskForm): title = StringField('Название товара', validators=[DataRequired()]) picture = FileField('Изображение') description = StringField('...
989,083
a3bd91948f464dbf1cbe8e5aa11a4ee9bf356201
import filetalk D = filetalk.arg() S = [] for cmd in D["EXPR"]: if cmd == "+": S.append(S.pop()+S.pop()) else: S.append(cmd) filetalk.write(D["WRITE_RESULT"], S.pop())
989,084
ec560ac4c13231219f72946a51846e808364f5b5
from __future__ import print_function from __future__ import division import tensorflow as tf def average_pooling(emb, seq_len): mask = tf.sequence_mask(seq_len, tf.shape(emb)[-2], dtype=tf.float32) # [B, T] / [B, T, max_cate_len] mask = tf.expand_dims(mask, -1) # [B, T, 1] / [B, T, max_cate_len, 1] emb...
989,085
70e9ee92be7c98ae7efb747ab72078fd525c9b24
#-*- coding: utf-8 -*- import serial import kivy from kivy.app import App from kivy.uix.boxlayout import BoxLayout from kivy.uix.button import Button from kivy.uix.label import Label class ChatApp(App): def build(self): #reconnaissance de la carte Arduino: self.Arduino = serial.Serial('COM13', ...
989,086
56929c580b855ac8267373073725472ededc02ba
import os import pkg_resources from setuptools import setup, find_packages setup( name="human-eval", py_modules=["human-eval"], version="1.0", description="", author="OpenAI", packages=find_packages(), install_requires=[ str(r) for r in pkg_resources.parse_requirements( ...
989,087
6e4c582ce3aa3e0828407730395a8eb2f770663d
from app import db from datetime import datetime class Data(db.Model): __tablename__ = "data" id = db.Column(db.Integer,primary_key=True) temperature = db.Column(db.Float) humidity = db.Column(db.Float) timestamp = db.Column(db.DateTime,default=datetime.now) def to_json(self): json_da...
989,088
b81b8fc9f9f6d4e2bad2f7af9de7c24e8d2c47ad
# Copyright 2011 Isotoma Limited # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
989,089
dec65803691e02b448bdc4e246475e59c9780864
N, A, B = map(int, input().split()) print(B * N if N <= 5 else B * 5 + A * (N - 5))
989,090
3d688e304339b1669733b2f5526f9fac5fc086e0
from collections import namedtuple from models.supersenses import vocabs, embeddings from models.supersenses.features.feature import Feature, FeatureType, MountPoint, Features from models.supersenses.features.features_utils import get_parent, get_grandparent, get_child_of_type, get_children, \ is_capitalized, get_...
989,091
58c2c9fc4138c8844ad73bfa4ba68061601c5508
import numpy as np from Box2D import b2BodyDef, b2_staticBody, b2World from Setup.MazeFunctions import BoxIt from scipy.spatial import cKDTree from pandas import read_excel size_per_shape = {'ant': {'H': ['XS', 'S', 'M', 'L', 'SL', 'XL'], 'I': ['XS', 'S', 'M', 'L', 'SL', 'XL'], ...
989,092
6220d514d19e43489222500c170ab546170ab3d0
from django.core.exceptions import ObjectDoesNotExist from django.shortcuts import render from django.http import HttpResponse from django.views.decorators.csrf import csrf_exempt from django.views.decorators.http import require_http_methods from django.http import JsonResponse from rest_framework.decorators impo...
989,093
37645d785e400cac770dc19861956fd12337fa5b
# from the jupyter notebook provided by the class import torch import torch.nn as nn import numpy as np from torch.utils.data import DataLoader, Dataset, TensorDataset import torchvision.datasets as ds import pylab as plt def load_mnist(datadir='./data_cache'): train_ds = ds.MNIST(root=datadir, train=True, ...
989,094
938469b07cb2d441712be70a42dbbffc141a9ba7
import re from django.contrib.auth.models import User from django.test import TestCase from django.core.urlresolvers import reverse from devilry.apps.core.testhelper import TestHelper from devilry_qualifiesforexam.models import Status from devilry_qualifiesforexam.views import StatusPrintView from devilry_qualifiesfor...
989,095
2578a29cb4e521bf8461942f33d45fe4a483f6ff
import torch import torch.nn as nn from torch.autograd import Variable import torch.nn.functional as F from torch.utils.data import DataLoader,Dataset import torchvision from torchvision import transforms, datasets import os import argparse import shutil from PIL import Image import math import time import numpy as np...
989,096
3badbc835fbad26a001092d745d6c89a520f5b22
import turtle t = turtle.Turtle() sc = turtle.Screen() sc.bgcolor("gray") t.pencolor("red") a = 0 b = 0 t.speed(0) t.penup() t.goto(0,200) t.pendown() while(True): t.forward(a) t.right(b) a+=3 b+=1 if b == 210: break t.hideturtle() turtle.done()
989,097
c6d611644cdd8a529f15fc4e4ba19c4debf887f7
# # @lc app=leetcode.cn id=832 lang=python3 # # [832] 翻转图像 # # @lc code=start class Solution: def flipAndInvertImage(self, A: List[List[int]]) -> List[List[int]]: l_r = len(A) l_c = len(A[0]) for r in range(l_r): for c in range((l_c+1)//2): A[r][c], A[r][l_c-1-c]...
989,098
36b6c2c5a6da44b688a5ba92e751abbdf26a158a
import numpy as np from scipy.spatial.transform import Rotation as R class ObsGen: def reset (self): pass class TeacherObsGenerator (ObsGen): def __init__ (self, state): self.state = state self.sub_gen_class = {"real_obs": RealisticObsGenerator, "sim_obs": SimObsGenerator, "vf_obs": VfGenerato...
989,099
553b6ad342d1f566bc3bd1dd59ee0dd4df103eac
#用Python进行SQLite数据库操作 import sqlite3 #创建数据库 con=sqlite3.connect('templates/flaskr.db') #游标对象是用来执行select查询数据库的,db连接对象才是用来做增删改操作的 cur=con.cursor() #创建表格 try: cur.execute('create table region(id interger primary key,name varchar(10))') except sqlite3.OperationalError as e: print('表格region已存在') #插入一条数据 try: c...