index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
5,700 | a17c448b068b28881f9d0c89be6037503eca3974 | import tensorflow.keras
from preprocessing_and_training.train import reshape_and_predict
import glob
""" Script for prediction - testing and importing the trained model from train.py """
def make_predictions(file_list, model, is_game=False):
""" Predictions with model that is locally saved
:param file_list:... |
5,701 | b3a2db38e2074b02c8837bfce85d06598a7b194d | #!/usr/bin/env python
import rospy
from op3_utils.op3_utils import *
from vision import *
import cv2
import sys
import rosnode
#Yellow >> Right
#Red >> Left
class States:
INIT = -1
GET_READY = 1
FIND_BAR = 2
WALK_2_BAR = 3
WALK_SIDEWAYS = 4
PICK_BAR = 5
WALK_WITH_BAR = 6
LIFT_BAR = 7
... |
5,702 | b5160a2574dd2c4eec542d7aca8288da0feadaba | # Кицела Каролина ИВТ 3 курс
# Вариант 6
# Найти сумму всех чисел с плавающей точкой
b = ("name", " DeLorean DMC-12", "motor_pos", "rear", "n_of_wheels", 4,
"n_of_passengers", 2, "weight", 1.230, "height", 1.140, "length", 4.216,
"width", 1.857, "max_speed", 177)
print sum(b[9:16:2])
|
5,703 | 32fc0db68c32c2e644f9c1c2318fbeff41a0543d | import pygame
from pygame import Rect, Color
from pymunk import Body, Poly
from config import WIDTH, HEIGHT
class Ground:
def __init__ (self, space):
# size
self.w = WIDTH - 20
self.h = 25
# position
self.x = 10
self.y = HEIGHT - self.h
# pygame... |
5,704 | aa17e22bc13436333b1db4aee41eeced373119a8 | from selenium import webdriver
import math
import time
browser = webdriver.Chrome()
website = 'http://suninjuly.github.io/find_link_text'
link_text = str(math.ceil(math.pow(math.pi, math.e)*10000))
browser.get(website)
find_link = browser.find_element_by_link_text(link_text)
find_link.click()
input_first_name = brow... |
5,705 | 2df679fc3407c15f5d0c006e9da8d1fc74bcf875 | from __future__ import unicode_literals
import json, alice_static
import logging
from random import choice
# Импортируем подмодули Flask для запуска веб-сервиса.
from flask import Flask, request
app = Flask(__name__)
logging.basicConfig(level=logging.DEBUG)
# Хранилище данных о сессиях.
sessionStorage = {}
# Задаем... |
5,706 | fe5050fdf010ce1c4d458b8a52ac92485a7d8cea | '''
Problem Description
Given two numbers n1 and n2
1. Find prime numbers between n1 and n2, then
2. Make all possible unique combinations of numbers from the prime
numbers list you found in step 1.
3. From this new list, again find all prime numbers.
4. Find smallest (a) and largest (b) number from the 2nd gener... |
5,707 | 55e743cb027d27cc6b668424c1584f27a8e8c51a | # Formatters example
#
# Requirements:
# Go to the ../hello_world directory and do: python prepare_data.py
#
# Instructions:
#
# Just run this file:
#
# python table.py
# Output:
# * standard input – text table
# * table.html
# * cross_table.html
#
from cubes import Workspace, create_forma... |
5,708 | 97ca134ffce404f4b2bc7352d4aac73a7bb764bd | # Copyright Materialize, Inc. and contributors. All rights reserved.
#
# Use of this software is governed by the Business Source License
# included in the LICENSE file at the root of this repository.
#
# As of the Change Date specified in that file, in accordance with
# the Business Source License, use of this software... |
5,709 | bfc6f6acef26e3dc4f6bf2b76363daec68c53cd1 | # This file is part of the Adblock Plus web scripts,
# Copyright (C) 2006-present eyeo GmbH
#
# Adblock Plus is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# Adblock Plus is distributed in the hop... |
5,710 | 002b795f61645ba2023cdb359167d2a65535d768 | /home/runner/.cache/pip/pool/f6/0b/37/37d1907955d15568c921a952a47d6e8fcc905cf4f36ab6f99f5fc7315a |
5,711 | 5fe81a6143642d671686c6623a9ecc93e04a82bf | try:
from setuptools import setup, find_packages
except ImportError:
import ez_setup
ez_setup.use_setuptools()
from setuptools import setup, find_packages
setup(
name = "pip-utils",
version = "0.0.1",
url = 'https://github.com/mattpaletta/pip-utils',
packages = find_packages(),
inc... |
5,712 | 46b51f46f6ed73e3b9dc2f759535ba71facd2aae | import pandas as pd
import random
import math
# takes 2 row series and calculates the distances between them
def euclidean_dist(a: pd.Series, b: pd.Series):
diff = a.sub(other=b)
squares = diff ** 2
dist = 0
for feature_distance in squares:
if not math.isnan(feature_distance):
dis... |
5,713 | 6dfd59bbab74a3a657d2200d62964578c296ee54 |
from ..utils import Object
class ChatMembersFilterAdministrators(Object):
"""
Returns the owner and administrators
Attributes:
ID (:obj:`str`): ``ChatMembersFilterAdministrators``
No parameters required.
Returns:
ChatMembersFilter
Raises:
:class:`telegram.Error`
... |
5,714 | e7bec9018f25ba9e3c3ae8a5bbe11f8bc4b54a04 | import logging, os, zc.buildout, sys, shutil
class ZipEggs:
def __init__(self, buildout, name, options):
self.name, self.options = name, options
if options['target'] is None:
raise zc.buildout.UserError('Invalid Target')
if options['source'] is None:
raise zc.buildou... |
5,715 | 0b0ae6101fd80bdbcf37b935268f3e49230599fb | import cv2
print(cv2.__version__)
image = cv2.imread("download.jpeg", 1)
print(image)
print(image.shape)
print(image[0])
print("~~~~~~~~~~~~~~~")
print(image.shape[0])
print("~~~~~~~~~~~~~~~")
print(len(image)) |
5,716 | d957fd5fbcdcf2e549323677185eabb8a50536c6 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from contextlib import suppress
import asyncio
import shutil
from aiohttp import web
from bot import app
from var import var
from logger import update_logging_files
loop = asyncio.get_event_loop()
def import_handlers():
from deezer import handlers, callback_handle... |
5,717 | 8a4269f2094fa8ab8f6a93e653183dafb141232e | import re
from pathlib import Path
RAW_DUMP_XML = Path("raw_data/Wikipedia.xml")
def count_regexp():
"""Counts the occurences of the regular expressions you will write.
"""
# Here's an example regular expression that roughly matches a valid email address.
# The ones you write below should b... |
5,718 | 88dfb422b1c9f9a9a8f497e1dbba5598c2710e9b | import pygame
# import random
# import text_scroll
from os import path
img_dir = path.join(path.dirname(__file__), 'img')
# define screen and refresh rate
WIDTH = 720
HEIGHT = 720
FPS = 30
# define colors
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
BLACK = (0, 0, 0)
YELLOW = (255, 255, 0)
BROWN = (165, ... |
5,719 | ccfcc5b644d592090786ceb35a85124c9d3275ad | # USAGE
# python predict_video.py --model model/activity.model --label-bin model/lb.pickle --input example_clips/lifting.mp4 --output output/lifting_128avg.avi --size 128
# python predict_video.py --model model/road_activity.model --label-bin model/rd.pickle --input example_clips/fire_footage.mp4 --ou
# tput output/fir... |
5,720 | 4015078ee9640c4558a4f29ebbb89f9098a31014 | from collections import Counter
import numpy as np
import random
import torch
import BidModel
from douzero.env.game import GameEnv
env_version = "3.2"
env_url = "http://od.vcccz.com/hechuan/env.py"
Card2Column = {3: 0, 4: 1, 5: 2, 6: 3, 7: 4, 8: 5, 9: 6, 10: 7,
11: 8, 12: 9, 13: 10, 14: 11, 17: 12}
Nu... |
5,721 | de1262da699a18266ad8673597391f625783a44d | # #writing a file
# fout = open('Session14/output.txt', 'w')
# line1 = "How many roads must a man walk down\n"
# fout.write(line1)
# line2 = "Before you call him a man?\n"
# fout.write(line2)
# #when you are done writing, you should close the file.
# fout.close()
# #if you dont close the file, it gets closed for you wh... |
5,722 | a3382c3e6e04ccb87b1d55f072ce959b137f9fdd | # Generated by Django 2.2.7 on 2019-11-22 21:09
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('Product', '0003_productimage'),
]
operations = [
migrations.RemoveField(
model_name='productimage',
name='comm... |
5,723 | c0e349be45cd964e8e398baaed64eae792189dd1 | sentence = "Practice Problems to Drill List Comprehension in Your Head."
sentence = sentence.split()
sentence = [i.replace(".", "") for i in sentence]
[print(i) for i in sentence if len(i)<5] |
5,724 | b94392c9c6547415326d80ff0923cb8ba9251783 | # V0
class Codec:
def encode(self, strs):
s = ""
for i in strs:
s += str(len(i)) + "#" + i
return s
def decode(self, s):
i, str = 0, []
while i < len(s):
sharp = s.find("#", i)
l = int(s[i:sharp])
str.append(s[sharp + 1:sh... |
5,725 | 2e075c3ee6b245b1ffd0bb8c4e205199f794da76 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
__author__ = 'ghou'
from datetime import datetime
bGameValid = True
dAskUserInfo = {}
gAccMode = 0
#============UserSyncResource2.py===================
#============前端资源热更白名单测试功能================
#============去读配置表config.xml==================
#============大于配置标号的热更内容只有... |
5,726 | 5bbaffb35a89558b5cf0b4364f78d68ff2d69a01 | # from django.urls import path,include
from django.conf.urls import include, url
from . import views
urlpatterns = [
url('buy',views.BuyPage,name='BuyPage'),
url('sell',views.SellPage,name='SellPage'),
url('',views.TradePage,name='TradePage'),
]
|
5,727 | 445e91edbeb88a3e300761342b28369fd9833fbb | # Copyright 2015 Google Inc. All rights reserved.
#
# 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 ... |
5,728 | f6b38698dbed6c1a48faa86183b601f855a7f737 | {"filter":false,"title":"settings.py","tooltip":"/mysite/settings.py","undoManager":{"mark":53,"position":53,"stack":[[{"start":{"row":107,"column":13},"end":{"row":107,"column":16},"action":"remove","lines":["UTC"],"id":2},{"start":{"row":107,"column":13},"end":{"row":107,"column":23},"action":"insert","lines":["Asia/... |
5,729 | 0ddac0aac5bd001504ed37d31b74c6442304e350 | # coding: utf-8
"""
Adobe Experience Manager OSGI config (AEM) API
Swagger AEM OSGI is an OpenAPI specification for Adobe Experience Manager (AEM) OSGI Configurations API # noqa: E501
OpenAPI spec version: 1.0.0-pre.0
Contact: opensource@shinesolutions.com
Generated by: https://openapi-generator... |
5,730 | 58c7e81d1b3cf1cff7d91bf40641e5a03b9f19ac | import argparse
import json
import os
import warnings
import numpy as np
import pandas as pd
import src.data_loaders as module_data
import torch
from sklearn.metrics import roc_auc_score
from src.data_loaders import JigsawDataBias, JigsawDataMultilingual, JigsawDataOriginal
from torch.utils.data import DataLoader
from... |
5,731 | 407f549cf68660c8f8535ae0bed373e2f54af877 | from odoo import models, fields, api, _
import odoo.addons.decimal_precision as dp
class netdespatch_config(models.Model):
_name = 'netdespatch.config'
name = fields.Char(String='Name')
url = fields.Char(string='URL')
# Royal Mail
rm_enable = fields.Boolean('Enable Royal Mail')
domestic_name =... |
5,732 | 6d92b944ab8503d3635626c0c23021fc2b40dce3 | import random
def main():
#print('You rolled a die')
return random.randint(1,6)
if __name__== "__main__":
main()
|
5,733 | fbac2d66f4d69a52c3df5d665b622659e4d8dacd | """
All rights reserved to cnvrg.io
http://www.cnvrg.io
cnvrg.io - Projects Example
last update: Nov 07, 2019.
-------------
rnn.py
==============================================================================
"""
import argparse
import numpy as np
import pandas as pd
import tensorflow as tf
from tensorflow i... |
5,734 | 892dd4259950c66669b21c5dbc7b738ddb5aa586 |
___ findmissingnumberusingxor(myarray
print "Given Array:", myarray
#print "Len of the Array:", len(myarray)
arraylen _ l..(myarray)
xorval _ 0
#print "In the First loop"
___ i __ r..(1, arraylen + 2
#print xorval,"^",i,"is",xorval^i
xorval _ xorval ^ i
#print "In t... |
5,735 | 9c9005acb40e4b89ca215345361e21f08f984847 | def h1_wrap(func):
def func_wrapper(param):
return "<h1>"+func(param) + "</h1>"
return func_wrapper
@h1_wrap
def say_hi(name):
return "Hello, " + name.capitalize()
print(say_hi("Stephan"))
|
5,736 | 66c2d73c100f7fc802e66f2762c92664e4b93fcd | from sklearn.model_selection import train_test_split
from azureml.core import Run
from sklearn.ensemble import RandomForestClassifier
import pandas as pd
import argparse
import os
import joblib
import numpy as np
# Get the experiment run context
run = Run.get_context()
# Get arguments
parser = argparse.ArgumentParse... |
5,737 | 21b9844fce10d16a14050a782ce7e15e3f6fb657 | from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from database_setup import Base, Country, TouristPlaces, Users
# Create database and create a shortcut for easier to update database
engine = create_engine('sqlite:///country_catalog.db')
Base.metadata.bind = engine
DBSession = sessionmaker(b... |
5,738 | 2506c5b042f04d1490ba2199a71e38829d4a0adc | from dataclasses import dataclass
from typing import Optional
@dataclass
class Music(object):
url: str
title: Optional[str] = None
|
5,739 | a61132d2d504ed31d4e1e7889bde670853968559 | #!/usr/bin/env python
# -------------------------------------------------------------------------
# Copyright (c) Microsoft, Intel Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------... |
5,740 | 32db21ed7f57f29260d70513d8c34de53adf12d7 | import time,pickle
from CNN_GPU.CNN_C_Wrapper import *
from pathlib import Path
FSIGMOIG = 0
FTANH = 2
FRELU = 4
REQUEST_INPUT = 0
REQUEST_GRAD_INPUT = 1
REQUEST_OUTPUT = 2
REQUEST_WEIGTH = 3
class CNN:
def __init__(self, inputSize, hitLearn=.1, momentum=.9, weigthDecay=.5, multip=1.0):
file = '%s/%s' %... |
5,741 | 0de27101675eb8328d9a2831ed468a969b03e7d3 | import sys
prop = float(sys.argv[1])
def kind(n):
s = str(n)
l = len(s)
i = 0
j = i + 1
decr, bouncy, incr = False, False, False
while j < l:
a = int(s[i])
b = int(s[j])
if s[i] > s[j]:
decr = True
elif s[i] < s[j]:
incr = True
i += 1
j += 1
if decr and incr:
retu... |
5,742 | 92529c4d4c33a7473773f081f730e64bae4d7f54 | # This Python file uses the following encoding: utf-8
import json
import os
import logging
from .utility_helper import (
check_path,
)
from .formats import (
OUTPUT_FORMATS,
FORMATS
)
class OptionsManager(object):
"""
This clas is responsible for storing & retrieving the options.
Args:
... |
5,743 | 464980a2f17aeedfa08548d6c4e247f8c047e2cb | # Generated by Django 3.2.3 on 2021-07-24 12:14
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('profiles', '0018_userprofile_membership_fee_pending'),
]
operations = [
migrations.RenameField(
model_name='userprofile',
ol... |
5,744 | 0b42f458097d11d66160bcb8e706ccb9b5c4682a | def K_Wilson(w, Tr, Pr):
# Inserting necessary libraries
import numpy as np
# Calculating K-value using Wilson correlation
K_value_Output = (1 / Pr) * np.exp(5.37 * (1 + w) * (1 - 1 / Tr))
# Returning output value
return K_value_Output |
5,745 | 76420ec1b37d4b9b85f35764a7f8a0e1f19a15dd | import boring.dialog
import boring.form
FORMSTRING = '''
Project name@string
Width@int|Height@int
Background color@color
Fullscreen@check
'''
class NewProjectWindow(boring.dialog.DefaultDialog):
def __init__(self, master, _dict=None):
self._dict = _dict
self.output = None
boring.dialog.Def... |
5,746 | 2d444c00e4dbdcb143d19752cd1a751169de73d3 | import sys
import os
import csv
import urllib2, socket, time
import gzip, StringIO
import re, random, types
from bs4 import BeautifulSoup
from datetime import datetime
import json
from HTMLParser import HTMLParser
class MLStripper(HTMLParser):
def __init__(self):
self.reset()
self.fed = []
def ... |
5,747 | d5acde6c6139833c6631a2d88a181cd019d3d2da | #Charlie Quinn if.py
#Check < in an 'if' statement
#use a 'while' loop to make testing easier
def income_input(prompt_message):
prompt = prompt_message + ' '
temp = input(prompt)
#get input from user
return float(temp)
do_again = 'y'
while do_again =='y':
income = income_input("\nHow much did ... |
5,748 | 8d8c211895fd43b1e2a38216693b0c00f6f76756 | #Main thread for starting the gui
import cv2
import PIL
from PIL import Image,ImageTk
from tkinter import *
from matplotlib import pyplot as pt
from matplotlib.image import imread
from control.control import Control
control=Control()
#gives the indtruction for saving the current frame
def takePicture():
global s... |
5,749 | 276d7ac493ddcb327dbce279d9f4bc8a74c98245 | __author__ = 'Jager'
from equipment import Equipment
class Weapon (Equipment):
def __init__(self, name, power):
super(Weapon, self).__init__(name)
self.power = power
@staticmethod
def fromJSON(jsonstr):
obj = Equipment.fromJSON(jsonstr)
return Weapon(obj["name"], obj["powe... |
5,750 | c847e7abe36b62c4518bb535789064e22b5f1db7 | import pymel.core as pm
from alShaders import *
class AEalLayerColorTemplate(alShadersTemplate):
controls = {}
params = {}
def setup(self):
self.params.clear()
self.params["layer1"] = Param("layer1", "Layer 1", "The background layer (will be blended over black if its alpha is not 1.", "rgb", presets=None)
sel... |
5,751 | b07d042c61e9e6647822989444e72db2e01c64d0 | # Generated by Django 3.0.3 on 2020-02-09 06:29
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('devices_collect', '0004_auto_20200209_1304'),
]
operations = [
migrations.AlterField(
... |
5,752 | da2b946238b429188fe3fa50286658d4b5cdbf41 | import krait
from ctrl import ws
krait.mvc.set_init_ctrl(ws.WsPageController())
|
5,753 | d6213698423902771011caf6b5206dd4e3b27450 | import numpy as np
a = np.ones((3,4))
b = np.ones((4,1))
# a.shape = (3,4)
# b.shape = (4,1)
c = np.zeros_like(a)
for i in range(3):
for j in range(4):
c[i][j] = a[i][j] + b[j]
print(c)
d = a+b.T
print(d)
|
5,754 | ab343f88c84d45cf90bddd52623362f047c72d3c | # -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-10-18 07:31
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0008_alter_user_username_max_length'),
]
operations = [... |
5,755 | 00c57e7e26a3181ab23697a25257aca479d9ee05 | frase = "todos somos promgramadores"
palabras = frase.split()
for p in palabras:
print(palabras[p])
#if p[-2] == "o":
|
5,756 | 468b5bd8d7b045ca8dd46c76a1829fc499e16950 | import time
import ephem
import serial
import nmea
import orientation
import sys
import threading
from geomag import geomag
#Constants
initial_az = 180
initial_alt = 90
min_elevation = 10.0
sleep_time = 1.0
unwind_threshold = 180
sleep_on_unwind = 45.0
last_lon = '-88.787'
last_lat = '41.355'
last_heading = 0.0
moun... |
5,757 | e82b9aa0f7dc669b3d5622c093b766c7e168221c | import mxnet as mx
import numpy as np
import logging
# Example performance:
# INFO:root:Epoch[34] Train-accuracy=0.601388
# INFO:root:Epoch[34] Validation-accuracy=0.620949
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
# running device
dev = mx.gpu()
# batch size and input shape
batch_size = 64
data_sh... |
5,758 | d1200006b8d7a18b11b01eff4fbf38d9dfd8958e | t = int(input())
while t:
x = list(map(int, input().split()))
x.sort()
if(x[0]+x[1]==x[2]):
print("YES")
else:
print("NO")
t-=1 |
5,759 | f563bb5bb32d3653d8a4115c75eda80b676ae3c6 | import pathlib
from setuptools import setup
# The directory containing this file
HERE = pathlib.Path(__file__).parent
# The text of the README file
README = (HERE / "README.md").read_text()
# Version: major.minor.patch
VERSION = "1.0.1"
REQUIREMENTS = (HERE / "requirements.txt").read_text()
REQUIREMENTS = REQUIREME... |
5,760 | d5d31920f7fd4ed2913c5880dba61c2015181be9 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 17 22:28:30 2019
@author: donsdev
"""
arr = []
sub = []
n = int(input())
while n > 0:
arr.append(n)
n-=1
while len(arr) + len(sub) > 1:
while len(arr) > 1:
arr.pop()
sub.append(arr.pop())
arr = sub[::-1] + arr
su... |
5,761 | b25e9374458ead85535495e77a5c64117a8b1808 | """
You have a number and you need to determine which digit in this number is the biggest.
Input: A positive int.
Output: An Int (0-9).
Example:
max_digit(0) == 0
max_digit(52) == 5
max_digit(634) == 6
max_digit(10000) == 1
"""
def max_digit(number: int) -> int:
return max(int(i) for i in str(number))
print(m... |
5,762 | 7fb568880c40895870a0c541d9a88a8070a79e5b | import datetime
# weightloss script
currentWeight = 73
goalWeight = 67
avgKgPerWeek = 0.45
startDate = datetime.date.today()
endDate = startDate
while currentWeight > goalWeight:
# adding 7 days to simulate a week passing
endDate += datetime.timedelta(days=7)
currentWeight -= avgKgPerWeek
print... |
5,763 | 93b00b5c1bec38d2a4ac109f1533d3c0d9e99044 | n = input("Enter a number: ")
def fact(num):
factorial = 1
if int(num) >= 1:
for i in range (1,int(n)+1):
factorial = factorial * i
return factorial
print(fact(n)) |
5,764 | db9919ab15988828d24b4430a124841f225860cc | from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.asymmetric import padding
import cryptography.hazmat.primitives.ciphers as ciphers
import struct
import secrets
import random
from typing import List
LOCO_PUBLICKEY = serializ... |
5,765 | 81cec5c1f28e92bf8e4adc2e2c632e072ed1f901 | # 1장 말뭉치와 워드넷 - 외부 말뭉치 다운로드, 로드하고 액세스하기
from nltk.corpus import CategorizedPlaintextCorpusReader
from random import randint
# 말뭉치 읽기
reader = CategorizedPlaintextCorpusReader(r'/workspace/NLP_python/tokens', r'.*\.txt', cat_pattern=r'(\w+)/*')
print(reader.categories())
print(reader.fileids())
# 샘플 문서 출력
# pos, neg 카... |
5,766 | fe1c499efe492dbd4f5c9b99bd6339c503c7902b | import os
from conan import ConanFile
from conan.tools.build import check_min_cppstd
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.files import copy, get, replace_in_file, rmdir
from conan.tools.scm import Version
from conan.errors import ConanInvalidConfiguration
requi... |
5,767 | 9f760c0cf2afc746a1fc19ac68d1b2f406c7efe1 | from elasticsearch import Elasticsearch, helpers
from bso.server.main.config import ES_LOGIN_BSO_BACK, ES_PASSWORD_BSO_BACK, ES_URL
from bso.server.main.decorator import exception_handler
from bso.server.main.logger import get_logger
client = None
logger = get_logger(__name__)
@exception_handler
def get_client():
... |
5,768 | ea4a55ed17c5cc2c6f127112af636ca885159c86 | n=int(input("please enter the number : "))
for i in range(11):
print(n," X ",i," = ",n*i) |
5,769 | 86e97e7eaf0d23ccf4154b5ffc853c5aee966326 | import random
from datetime import datetime
from slackbot.bot import respond_to
from .term_model import Term, Response
from ..botmessage import botsend, botwebapi
# すでに存在するコマンドは無視する
RESERVED = (
'drive', 'manual', 'jira', 'wikipedia', 'plusplus',
'translate', '翻訳',
'weather', '天気',
'term',
'shuff... |
5,770 | 43dc69c66d94d85337c11eb4cfed48d7fdef2074 | # Generated by Django 3.0.8 on 2020-08-11 13:43
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('recipe', '0006_recipe_description'),
]
operations = [
migrations.AddField(
model_name='recipe',
name='portions',
... |
5,771 | 1a66e7f59ada43deb8e28b9806dc4fb9be4ae247 | # 同一目录下的引用调用还是随意导入使用的
# 跨包使用就需要使用TwoUsage里面的两种方式。
import Importex
Importex.atest()
|
5,772 | d145f4c061c8f364756012832a07adc305e35e5c | # Generated by Django 3.2.5 on 2021-07-27 17:12
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Category',
fields=[
('id', ... |
5,773 | 4e715ccb4f95e7fe7e495a1181ad5df530f5a53f | from torchtext import data
from torchtext import datasets
import re
import spacy
spacy_de = spacy.load('de')
spacy_en = spacy.load('en')
url = re.compile('(<url>.*</url>)')
def tokenize_de(text):
return [tok.text for tok in spacy_de.tokenizer(url.sub('@URL@', text))]
def tokenize_en(text):
return [tok.te... |
5,774 | 1651865f120ba4fe440549567a8d9903e5455788 | #!/usr/bin/env python
import argparse
import sys
import logging
import vafator
from vafator.power import DEFAULT_FPR, DEFAULT_ERROR_RATE
from vafator.hatchet2bed import run_hatchet2bed
from vafator.ploidies import PloidyManager
from vafator.annotator import Annotator
from vafator.multiallelic_filter import Mul... |
5,775 | 31f302775ef19a07137622ef9d33495cc2a8eed2 | #pymongo and mongo DB search is like by line inside in a document then it moves to the other document
from enum import unique
import pymongo
from pymongo import MongoClient
MyClient = MongoClient() # again this is connecting to deault host and port
db = MyClient.mydatabase #db is a variable to store the database ... |
5,776 | 0bc72a558b9bd3b5f74ce5dfce586dd66c579710 | import sys
import os
import json
from collections import OrderedDict
from config import folder, portfolio_value
from datetime import datetime
import logging
# Logger setup
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)
def valid_date(datestring):
""" Determine if something is a valid... |
5,777 | 23a4ca8eec50e6ab72be3f1b1077c61f676b3cce | """Command 'run' module."""
import click
from loguru import logger
from megalus.main import Megalus
@click.command()
@click.argument("command", nargs=1, required=True)
@click.pass_obj
def run(meg: Megalus, command: str) -> None:
"""Run selected script.
:param meg: Megalus instance
:param command: comma... |
5,778 | 488c111c051796b481794678cb04108fcf11ac39 | import sys
import bisect
t = int(raw_input())
for i in xrange(1, t+1):
n, k = map(int, raw_input().strip().split())
s = [n]
for j in xrange(k):
num = s.pop()
if num % 2 != 0:
ls = num/2
lr = num/2
if ls != 0:
bisect.insort_left(s,ls)
bisect.insort_left(s,lr)
else:
... |
5,779 | 31304c3b0f41b848a36115f1ef098a2104c170ac | import itertools
import math
def score(stack):
syrup = math.pi * max(x[0] for x in stack)**2
for item in stack:
syrup += 2*math.pi*item[0]*item[1]
return syrup
def ring_score(item):
return 2*math.pi*item[0]*item[1]
def solve(pancakes, k):
return max(itertools.combin... |
5,780 | cb9ea8791009a29a24a76bc2b161e7f8599fec1b | """
definition of a sensor
"""
import datetime
import pytz
class tlimit:
def __init__(self, name, text):
self.name = name
self.text = text
time_limit = [
tlimit("All", "All Data"),
tlimit("day", "Current day"),
tlimit("24hours", "Last 24 hours"),
tlimit("3days", "Three last days"... |
5,781 | 720d37e35eb335cc68ff27763cfe5c52f76b98d2 | /home/sbm367/anaconda3/lib/python3.5/types.py |
5,782 | a0284eba1a0e6c498f240068c586e7f8b79cd86c | """Exercise 9c"""
import time
import numpy as np
import matplotlib.pyplot as plt
from plot_results import plot_2d
from run_simulation import run_simulation
from simulation_parameters import SimulationParameters
def exercise_9c(world, timestep, reset):
"""Exercise 9c"""
n_joints = 10
Rhead = 0.44
... |
5,783 | 14b9927435536a4b29b0930791ab4525acd80bc9 | from flask import Flask, render_template, jsonify, request, make_response #BSD License
import requests #Apache 2.0
#StdLibs
import json
from os import path
import csv
###################################################
#Programmato da Alex Prosdocimo e Matteo Mirandola#
###################################... |
5,784 | 06e01dce7e2342be994569099ed51d1fe28eea1c | from django.db import models
# Create your models here.
class Task(models.Model):
level = models.PositiveSmallIntegerField()
topic = models.CharField(max_length=100)
content = models.TextField()
correct_answer = models.CharField(max_length=50)
class Answer(models.Model):
content = models.TextField... |
5,785 | 9340c9055a7e0d74d232d878b43d91a3e6cd32e5 | from tkinter import *
import tkinter.messagebox
import apikey
import tinify
class Setting_GUI(Toplevel):
def __init__(self,parent):
super().__init__()
self.parent = parent
key = "Input your key here"
self.keystringvar = StringVar()
self.wm_title("Settings - TingImage")
... |
5,786 | ea918bdf96572b38461dc1810bd0b8c16efd0f0d | # Generated by Django 3.0.7 on 2020-07-05 07:34
from django.db import migrations, models
import location_field.models.plain
class Migration(migrations.Migration):
dependencies = [
('driver', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='driver',
... |
5,787 | 3acd592594ae4f12b9b694aed1aa0d48ebf485f5 | import glob
import json
import pickle
import gzip
import os
import hashlib
import re
import bs4, lxml
import concurrent.futures
URL = 'http://mangamura.org'
def _map(arg):
key, names = arg
size = len(names)
urls = set()
for index, name in enumerate(names):
html = gzip.decompress(open('htmls/' + name... |
5,788 | 41e981e2192b600cdf9c9b515fe9f397cd1b8826 | import re
def make_slug(string):
print(re.sub(^'\w','',string))
make_slug('#$gejcb#$evnk?.kjb')
|
5,789 | 17b0baef5e366d70ea393259df1965e75b7d12e1 | #!/usr/bin/env python
# made for comparing unfiltered and filtered scorefiles for Rosetta enzdes post analysis
import argparse
import collections
import re
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
def data_from_sc_file(axes, f, uf, true_max):
... |
5,790 | 96778a238d8ed8ae764d0cf8ec184618dc7cfe18 |
if __name__== '__main__':
with open('./input/day6', 'r') as f:
orbit_input = [l.strip().split(")") for l in f.readlines()]
planets = [planet[0] for planet in orbit_input]
planets1 = [planet[1] for planet in orbit_input]
planets = set(planets+planets1)
system = {}
print(orbit_input)
... |
5,791 | 8fecfdf4b3772e5304f0b146317f94cdbd7fbd53 | from otree.api import Currency as c, currency_range
from . import models
from ._builtin import Page, WaitPage
from .models import Constants
class Introduction(Page):
timeout_seconds = 60
class Welcome(Page):
timeout_seconds = 60
class Priming(Page):
form_model = models.Player
form_fields = ['text'... |
5,792 | 59047a113d76c64be48858258441fae5da505790 | from tkinter import ttk
from chapter04a.validated_mixin import ValidatedMixin
class RequiredEntry(ValidatedMixin, ttk.Entry):
def _focusout_validate(self, event):
valid = True
if not self.get():
valid = False
self.error.set('A value is required')
return valid
|
5,793 | 2e60781da004fb86d3a33deae970c1faf2a5037d | class Rectangulo():
def __init__(self, base, altura):
self.base = base
self.altura = altura
def calcular_area(self):
return self.base * self.altura
base = float(input("Ingrese la base del rectangulo: \n"))
altura = float(input("Ingrese la altura del rectangulo: \n"))
#Primera instan... |
5,794 | f0deb8ccaf50ea0abb9e1632eaa4354a4f21dece | # uploadops.py
# CS304-Final Project
# Created by: Megan Shum, Maxine Hood, Mina Hattori
#!/usr/local/bin/python2.7
# This file handles all the SQL calls for the upload page.
import sys
import MySQLdb
import dbconn2
def uploadPost(conn, username, description, location, time_stamp, pathname):
'''Inserts post in Po... |
5,795 | 6f331eedcdaceaded142c3ffe9400aaa817613c1 | # coding=utf-8
from lxml import etree
import frontik.handler
class Page(frontik.handler.PageHandler):
def get_page(self):
self.set_xsl(self.get_argument('template', 'simple.xsl'))
self.doc.put(etree.Element('ok'))
if self.get_argument('raise', 'false') == 'true':
raise front... |
5,796 | 7dd5ac1110f38c40f2fddf9d7175a5ac40303d73 | # Definition for an interval.
# class Interval(object):
# def __init__(self, s=0, e=0):
# self.start = s
# self.end = e
class Solution(object):
def insert(self, intervals, newInterval):
"""
:type intervals: List[Interval]
:type newInterval: Interval
:rtype: List[... |
5,797 | e51ca78ca6751f8238a39d3eae55d6cc6ab65128 | # -*- coding: utf-8 -*-
'''
:Title
Insert Date
:Planguage
Python
:Requires
VoodooPad 3.5+
:Description
Inserts Date
EOD
'''
VPScriptSuperMenuTitle = "GTD"
VPScriptMenuTitle = "Insert Date"
VPShortcutMask = "control"
VPShortcutKey = "J"
import AppKit
import time
def main(windowController, *args, **kwargs):
te... |
5,798 | 96d7963faf720a3dc0d96b55ad65ee7ac83c1818 | # testa se uma aplicacao em modo de teste esta sendo construida
def test_config(app):
assert app.testing
|
5,799 | 1aacd04234d60e495888fc44abe3fbacf404e0ce | mapName =input('\nEnter map name(s) (omitting the mp_ prefix)\nSeparate map names with comma\n:').lower()
mapNameList =mapName.split(',')
def convertWPFile(mapName):
#Converts mapname_waypoints.gsc file (old style PEzBot format) to newer mapname.gsc file (new style Bot Warfare format)
fullMapName ='mp_'+m... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.