index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
15,300
46748cfd8c946045aef12e881bc9c187cf7925e9
''' TestFilters.py @author: River Allen @date: July 8, 2010 @requires: pygtk, gobject, cairo Some hacky code to simulate filters with. It is a bit dirty and undocumented, so be forewarned. ''' from Data import models import os from numpy.random import randn from Movement import MoveExplorer, Movement ...
15,301
7fc756367b9de2bc3a8bbade1823cada3ca094e9
# --------------------------------------------------------- # Outlier detection by commute-time and Euclidean distances # # Sercan Taha Ahi, Nov 2011 (tahaahi at gmail dot com) # --------------------------------------------------------- import numpy as np import scipy as Sci from scipy import linalg from scipy.cluster...
15,302
596dd3339bfd35752f4eb95862ac77f04b3c8b39
from __future__ import print_function, division import numpy as np import cv2 as cv import os from tqdm import tqdm import time import face_recognition from imutils import build_montages from imutils import paths import sys sys.path.append("../") from baseline import sklearn_cluster if __name__ == "__main__": ...
15,303
66f4910b81bea3868419f23c4f350db1da673129
from __future__ import absolute_import from . import alltests __all__ = ['alltests']
15,304
f8f9f734abc4d5272dbabea90d9ea1a91fcb778b
/home/openerp/production/extra-addons/training/wizard/wizard_subscription_line_invoice.py
15,305
233dbabd2ef524d0ca47a9026a89ff7c35f1652b
from matplotlib import pyplot as plt from mpl_toolkits.mplot3d import Axes3D import seaborn as sns import numpy as np import torch import torch.nn as nn from tqdm import tqdm from Gaussian import GaussianDistribution class BayesianNRegression: #self.mapping a function could map x->a #self.Xdim #self.A...
15,306
ba3be201c9dbc888933b1ebb09a32e62b1d22882
#coding=utf-8 import random import os import sys allNamesList = os.listdir('Image') selectedNum = len(allNamesList) posPairNum = selectedNum negPairNum = 4 * selectedNum def initializeNotChosenList(): global selectedNum notChosenList = [] for i in range(selectedNum): notChosenList.append(i) ...
15,307
08bdaffafdddebd4e68dd8e014f26bd0d8c76ab9
from django import forms from Product.models import Product class StockForm(forms.Form): name = forms.CharField(label='', required=True, widget=forms.TextInput(attrs={ "placeholder":"Nazwa produktu *", "class":"input_field"})) qt = forms.IntegerField(label='', required=True, widget=forms.NumberInput(attrs=...
15,308
f7cce07c4ab32848a33a3648ae9fc3b32d63d683
#! /usr/bin/python3 from __future__ import print_function import sys import textwrap import re import xml.dom.minidom if len(sys.argv) < 3: print("Usage: %s help.xml install|live" % sys.argv[0], file=sys.stderr) sys.exit(1) if sys.version >= '3': # Force encoding to UTF-8 even in non-UTF-8 locales. ...
15,309
b777ca0432f7c338d8d55816d3fcabaa8425ae96
#calss header class _FROSTBITE(): def __init__(self,): self.name = "FROSTBITE" self.definitions = [u'injury to someone caused by severe cold, usually to their toes, fingers, ears, or nose'] self.parents = [] self.childen = [] self.properties = [] self.jsondata = {} self.specie = 'nouns' def run(...
15,310
ed8744e3092724bc07e74ac22ada410a6ba1ce93
# -*- coding: utf-8 -*- class DogLife: _DOG = [''' ____ ____ ____ ____ ( ) | | | | | | | | ( . . ) |____| | | | | |____| ( u ) | | | | | | (_________) | |____| |____| | ''', ''' _ _ \ / | | |...
15,311
d5e0aa78b195b1bed7649030359ae08eab73831d
''' File: cityHandler.py Project: controllers File Created: 2019-01-28 10:59:03 am Author: wangwei (wangw11.thu@gmail.com) ----- Last Modified: 2019-01-28 5:30:54 pm Modified By: wangwei (wangw11.thu@gmail.com>) ''' import os import sys import time import json import requests import traceback import tornado.web import ...
15,312
c47ccb0713c75ab5192d78389761df71c681331b
# Day 3 # ----- # Project: Treasure Island print(''' ******************************************************************************* | | | | _________|________________.=""_;=.______________|_____________________|_______ | | ,-"_,="" ...
15,313
143ed1565112ead07365551203ee7278f92fb65a
import boto3 s3 = boto3.resource("s3") conn = boto3.client("s3") client = boto3.client("batch") bucketName = "s3logs-manifest-qa-niaid-planx-pla-net" jobIndex = 0 for obj in conn.list_objects(Bucket=bucketName)["Contents"]: key = str(obj["Key"]) print "submitting job for " + key job = "test-" + str(jobIn...
15,314
f6df81d9071460d219ad41bfbdbff0ed5b0f8d90
from api.view.pipeline import * def setup(app): pre = '/api/pipelines' app.router.add_get(pre, get_pipes) app.router.add_put(pre, create_pipe) app.router.add_get(pre + '/{id}', getPipelineInfo) app.router.add_delete(pre + '/{id}', deletePipe) app.router.add_post(pre + '/{id}/start', startSt...
15,315
44ae05d2d780854484af394757cef32cef6f5cc3
# Copyright lowRISC contributors. # Licensed under the Apache License, Version 2.0, see LICENSE for details. # SPDX-License-Identifier: Apache-2.0 import unittest from reggen import gen_rtl class TestFieldCheck(unittest.TestCase): def test_check_bool(self): arg = {'field1': "true", 'field2': "false", 'f...
15,316
021b8979890173760539abc6f07266bdbfa96121
### ### Goals ### # Select one main catalog. Checks all other selected catalogs for similar stars # and creats a joint dataframe with all the gathered parameters ### ### Imports ### import pickle import galpy import numpy as np import csv import matplotlib.pyplot as plt from astroquery.vizier import Vizier from a...
15,317
96c8396e2ac1f8a5e219a782e1720afd0d8013ae
import socket import os, os.path print "Connecting..." if os.path.exists( "/var/lib/libvirt/qemu/channel/target/Virtual.org.qemu.guest_agent.0" ): client = socket.socket( socket.AF_UNIX, socket.SOCK_STREAM ) client.connect( "/var/lib/libvirt/qemu/channel/target/Virtual.org.qemu.guest_agent.0" ) print "Ready." ...
15,318
0e792f55a27073a28d892181bb237633b23af542
import Graffity import matplotlib.pyplot as pyplot import numpy import scipy import glob import PIL import images2gif import io fig = pyplot.figure(0) fig.clear() ax = fig.add_axes([0.1, 0.1, 0.8, 0.8]) # Change this directory to the location of the .TIF files on your system directory= '/home/fprakt/Data/Derotator/de...
15,319
4af6806934e51b778b375084c722d42670d57463
from django import forms from django.forms import ModelForm from posts.models import Post, Comment class AddPostForm(ModelForm): class Meta: model = Post fields = ('body',) class EditPostForm(ModelForm): class Meta: model = Post fields = ('body',) class AddCommentForm(Mode...
15,320
553cbbe61c0cc904f903f85a315517fa031011dc
#!/usr/bin/env python from socket import * import sys port = 8089 host = "192.168.1.35" # ip target ,eg ip 's raspberry pi s = socket(AF_INET, SOCK_DGRAM) buf = 32768 addr = (host,port) f1 = open("Testfile.txt",'rb') # Open in binary f2 = open("picture.npg",'rb') # Open in binary f3 = open("Testpdf.pdf",'rb') # Ope...
15,321
06599dba17a1eb4adcdf4ff8f5ee90b195aa218b
import numpy as np import numpy.ma as ma import matplotlib.pyplot as plt from netCDF4 import Dataset from mpl_toolkits.basemap import Basemap #m = Basemap(projection='cyl',lon_0=180,lat_0=0,urcrnrlat=60) #parallels = np.arange(-30,30,30) #meridians = np.arange(0,360,60122 #m.drawcoastlines() #m.drawparallels(parallel...
15,322
c6418df068d3fd2cab5b14002aa33a8a68ad73f9
# -*- coding: ISO-8859-1 -*- ''' Task Coach - Your friendly task manager Copyright (C) 2004-2009 Frank Niessink <frank@niessink.com> Task Coach is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of...
15,323
3ca60d94e169b817dff7a92ff30308038b8d320c
import numpy as np import matplotlib matplotlib.use('TkAgg') import matplotlib.pyplot as plt import cv2 from pathfinder import pathfinder import random import time import math from multiprocessing import Process, Manager import os import argparse from libtiff import TIFF from osgeo import osr, ogr # from tqdm import t...
15,324
8fdccc9669fed3fd2f46cd24ffcb92bd992cbd83
# args02.py import argparse parser = argparse.ArgumentParser(description='fixed size arguement list example') parser.add_argument('size', nargs=2) args = parser.parse_args('1024 768'.split()) print (args.size)
15,325
3dbd3037f4f3d7b02314de25a0de25aed778bb37
''' Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n). If d(a) = b and d(b) = a, where a ≠ b, then a and b are an amicable pair and each of a and b are called amicable numbers. For example, the proper divisors of 220 are 1, 2, 4, 5, 10, 11, 20, 22, 44, 55 and 110; ...
15,326
45930e4881d47e3b9166e5120d0cc5cc79f0bfa8
from numpy import* a = array(eval(input())) b = zeros(37, dtype=int) for i in range(size(a)): if a[i]==0: b[0]+=1 if a[i] == 1: b[1] += 1 elif a[i] == 2: b[2] +=1 elif a[i] == 3: b[3] +=1 elif a[i] == 4: b[4] +=1 elif a[i] ==5: b[5] +=1 elif a[i]==6: b[6]+=1 elif a[i]==7: b[7]+=1 elif a[i]==8:...
15,327
d90b5c38bbe4f8682e073891bd008a67e3694ade
import pygame import simple_draw as sd class Button: def __init__(self, x, y, caption, event=None): self.x = x self.y = y self.caption = caption self._color1 = sd.COLOR_YELLOW self._color2 = sd.COLOR_DARK_YELLOW self._height = 10 self._width = 30 if ...
15,328
eadda476e27d70c0779bf4c300ca0ddeea6fb289
import time def test_customer_get(iamport): customer_uid = 'customer_get_cuid_{}'.format(str(time.time())) try: iamport.customer_get(customer_uid) except iamport.ResponseError as e: assert e.code == 1 assert e.message == u'요청하신 customer_uid({})로 등록된 정보를 찾을 수 없습니다.'.format(customer_...
15,329
b7323c57b636e0308f565461f102aa01f3df32ff
#!/usr/bin/python3 ''' Implements the Aho-Corasick automaton ''' from collections import deque patterns = list(map(lambda x: x.strip(), open('patterns.txt', 'r'))) letters = [chr(ord('a') + i) for i in range(26)] class trieNode: ''' Trie Node data structure Each trie node contains a boolean indicating whether it is...
15,330
cbccfb24c1b7bac4d2475a538b01d97f5e232397
""" NOTE: Probably do not actually need any of this: equivalent tests have been incorporated into get_lines in process_methods.py Contains methods used to "clean up" a lines_list, i.e. remove lines that are likely not actually there """ import numpy as np from main import * # from process_methods import * import math ...
15,331
dbd1041a57c462dfaf38a3c50f61f0f2a2700533
def mkdir_p(path): ''' Implements ``mkdir -p``. ''' import errno import os if path: try: os.makedirs(path) except OSError as ex: if ex.errno == errno.EEXIST: pass else: raise
15,332
b5719fb5981f14de33d5c7873df957aeeba18247
# This code generates a dictionary with the query id as it's key and it's top 100 documents # generated by bm25 model, which does not consider the relevance judgement, as it's corresponding value import pickle import os # make the directory if it doesn't exist already newpath = r'../../Encoded Data Structures (Phase ...
15,333
258132cdb1ee990966835f49adaa6ca4b31dcfe8
while True: c0 = int(input("Give me a non-negative and non-zero number: ")) count = 0 while c0 != 1 and c0 != -1: if c0 % 2 == 0: c0 = c0 / 2 print(c0) count += 1 else: c0 = (3 * c0 + 1) print(c0) count ...
15,334
161c09b849186313714948e389b5b1baa32a10fe
import re def is_Nigerian(args1): """ This function checks if a given number is a Nigerian phone number. Parameters: args1 (str): the phone number to be checked. Return str: a remark that indicates if the phone number is Nigerian or not. """ if len(args1) == 0: ...
15,335
725d7a8637908cec164002d856a9c4077e2bf8b7
import scrapy from scrapy.crawler import CrawlerProcess items = [] class AzaniSpider(scrapy.Spider): name = "azani" custom_settings = { 'FEED_FORMAT': 'csv', 'FEED_URI': 'User/export.csv' } start_urls = [ 'https://www.liveyoursport.com/squash/?search_query=&page=1&limit=36&sor...
15,336
bd68d3f5448ac5c6684eab1e9cb337f216d9a39d
# --- Day 4: Repose Record --- from urllib.request import urlopen from collections import Counter import pandas as pd import numpy as np data = urlopen('https://raw.githubusercontent.com/MarynaLongnickel/RandomStuff/master/Advent%20of%20Code%202018/Day%204/day4.txt') df = [] # parse each line to extract timestamp, ...
15,337
eefced65993a244aa32a1c71abaa6252b35321c3
#!/usr/bin/env python from distutils.core import setup, Extension import os import subprocess from os.path import join, exists # If you are creating a sdist from the full bllipparser code base, you # may need the swig and flex packages. The Python packages include the # outputs of these commands so you can build the ...
15,338
8de43d37e06335c301f0035ca83907b782f036de
import torch from typing import Optional, List from contextlib import contextmanager, ExitStack from typing import ContextManager class PostInitProcessor(type): def __call__(cls, *args, **kwargs): obj = type.__call__(cls, *args, **kwargs) obj.__post__init__() return obj @contextmanager def...
15,339
64331b86df954f27de3f2e0c292da9430c104986
# Copyright 2009-2010 by Ka-Ping Yee # # 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 w...
15,340
051109e642c21e999075cb5bdefe2b5d2938f943
import time from crawler.message_bus import MessageBus def test_receive_message(): message_bus = MessageBus('queue-kafka-bootstrap:9092', 'tweet-created') message_bus.send(b'test_message') time.sleep(5) response = message_bus.consume_one() assert response.value == b'test_message'
15,341
bbf5a119be0854445a482ba9d35f547854687150
# This files contains your custom actions which can be used to run # custom Python code. # # See this guide on how to implement these action: # https://rasa.com/docs/rasa/custom-actions # This is a simple example for a custom action which utters "Hello World!" from typing import Any, Text, Dict, List from rasa_sdk ...
15,342
efb66a5658891fc45c9eaf39289ea103506f3bb9
sum = lambda n1, n2: n1 + n2 s1 = sum(10, 20) print(s1) people1 = [("c", 30), ("b", 200), ("a", 1000), ("d", 4)] people2 = sorted(people1, key=lambda t:t[1]) print(people2)
15,343
8c34e8ea163424a15226e250a91f5218e1a5c4cb
from flask_wtf import FlaskForm from wtforms import StringField, TextAreaField, BooleanField from wtforms.validators import DataRequired class CategoriaForm(FlaskForm): name = StringField( 'Nome', validators = [ DataRequired(message="Campo obrigatório") ], render_kw = { ...
15,344
80f79f386e4145c50f12353ae402fd41ff013870
from tempfile import gettempdir from os.path import join import tempfile class File: def __init__(self, filename): self.filename = filename def write(self, row): with open(self.filename, 'a') as f: f.write(row) def __add__(self, other): tfile = tempfile.Name...
15,345
3aba3e721c33f655c34706bee05296226738b3aa
import pandas as pd import numpy as np import torch from pytorch.param_helper import create_dir, create_main_dir, import_config from active_learning.model_pipeline import TrainPipeline from active_learning.data_gen import create_data_loader from active_learning.extract_features import extract_features import glob impor...
15,346
be7b7addd4a0b387f9ca6da690dc443cbec53342
# coding: utf-8 from flask import (Blueprint, request, url_for, redirect, render_template, flash, json) from tango import db, cache from tango.ui.tables import make_table from tango.models import Setting, DictCode, Category from tango.ui import navbar from nodes.models import NodeHost from nodes.t...
15,347
3c8d0e908b7737d3a186b948a629e5887203c5ed
# -*- coding: utf-8 -*- """ Created on Thu Sep 19 15:07:13 2019 @author: agnib """ country = ('India','America','Mexico','Bangladesh') capital = ('Delhi NCR','Washington DC','Mexico City','Dhaka') zipped = tuple(zip(country,capital)) print(zipped)
15,348
15417fe2e520de87a75e13290ac0f2a5d5fbc055
# -*- coding: utf-8 -*- """ Created on Fri Dec 29 14:36:50 2017 @author: Kim """ import os import glob import shutil as sh import sys path=sys.path[0] for line in open("%s/Parameters.txt" %path, "r"): if line.startswith("Directory"): directory=line.split(":")[1].strip() if line.starts...
15,349
3551d1d6ff2169079383bc7abe5bea0fc6bb1f29
#! /usr/bin/env python3 # -*- coding: utf-8 -*- # Source: https://leetcode.com/problems/can-make-arithmetic-progression-from-sequence/ # Author: Miao Zhang # Date: 2021-05-12 class Solution: def canMakeArithmeticProgression(self, arr: List[int]) -> bool: arr.sort() diff = arr[1] - arr[0] ...
15,350
5001f7c8c953ffc9c6162bc5172b94e87b68244f
import joblib import pickle import numpy as np from sklearn.neural_network import MLPClassifier from sklearn.linear_model import LogisticRegression from sklearn.metrics import accuracy_score from keras.models import Sequential from keras.layers import Dense from keras.utils import to_categorical from keras.callbacks i...
15,351
7156d9612b9bc4db72c86ae4c812f37e96042ce1
# -*- coding: utf-8 -*- """ Created on Sun Nov 24 13:52:24 2019 @author: Eric """ import os import io import csv import pandas as pd import numpy as np import psycopg2 from psycopg2 import sql from sys import exit from sqlalchemy import create_engine # list of states to explore states = ['tennessee','west_virginia','...
15,352
e7c433d1b38141eea5e71e4c84eeb365686d0a1d
# Copyright (C) Rocket Software 1993-2015 hello_name = input ('Type your name: ') print("Hello", hello_name)
15,353
69e655b1b5d7aaf04467f9f4308beda775283831
# check with Geert: # Correct files, and correct order for test images # check that JC .names correspond to the order of the test set from models.fixedLDA import fixedLDA from evaluation import metrics from gibbs_input import process_gibbs_input as gibbs_input nominal_alpha = 0.35 n_vis_words = 750 # '{0}, {1}, {2}...
15,354
fb67ae4d7799fc36cf2ff3dcd3b58f7d2d2c25f4
from django.db import models # Create your models here. class Member(models.Model): """メンバー""" name = models.CharField('name', max_length=255) slackName = models.CharField('slack_name', max_length=255) graduateDate = models.DateTimeField('graduate_date') def __str__(self): return self.name
15,355
499f83e4996885a6dc3729d6a69442152cc900a8
import time import numpy as np from scipy import sparse from sklearn.preprocessing import normalize import util, imageio, pickle, frame, scipy from util import * class Frame: def __init__(self): util.raiseNotDefined() def load_sketch(self, sketch): self.sketch = sketch def load_gray(self...
15,356
e88793aa8b448fc1d21eb5d0865849b73f8f086a
"""Logistic regression on the basic data""" import numpy as np import mdp from sklearn import cross_validation from sklearn import linear_model import sys import load_data from base import calc_score, split_data from logistic_base_model import Logistic_Base_Model, prepare_params class Logistic_In...
15,357
36ded3f4cb5cb4f1f5aef8442fb15a26bb3c1955
import common year_common = common.import_year_common(2019) tape = common.extract_numbers(common.read_file('2019/25/data.txt')) moves = [ 'south', 'take monolith', 'east', 'take asterisk', 'west', 'north', # 'west', # 'take coin', # 'north', # 'east', # 'take astronaut ice ...
15,358
323d7e2938e9fba78a04e36a8780ab71cda9d9c2
# Copyright 2018 ZTE Corporation. 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 ...
15,359
4de14486c81bc41a4129de1eb8f4de11e7bbdf45
# -*- coding: utf-8 -*- import re import scrapy from scrapy.http import Request from urllib import parse # python2使用 import urlparse from MovieSpider.settings import SQL_DATETIME_FORMAT, SQL_DATE_FORMAT from datetime import datetime from MovieSpider.items import Ygdy8Item, MovieItemLoader from MovieSpider.utils.commo...
15,360
164ff80648fce136f5b724c52bfa277ce9591530
def fun(a, b, c, d, e, g): return print(a + " " + b + " " + c + " " + d + " " + e + " " + g) print(fun(a = input("введите имя "), b = input("введите фамилию "), c = input("введите город "), d = input("введите год рождения "), e = input("введите email "), g = input("введите номер телеыона ")))
15,361
412a5e5c854b5f5f8fb417c801021990abc5cc2e
import cv2 import numpy as np image = cv2.imread('./black-background-white-font-believe-in-yourself-460x460.jpg',0) cv2.imshow("Original",image) cv2.waitKey(0) kernel = np.ones((5,5),np.uint8) # Erosion erosion = cv2.erode(image,kernel,iterations=1) cv2.imshow("Erosion",erosion) cv2.waitKey(0) # Dilation dilation ...
15,362
e5db1a9d7307f3ce66f47d223142cd46ca32a281
# import numpy as np import caffe import tables import os from os import walk import sys import timeit import numpy as np proto_txt = 'ssdh.prototxt' caffe_model = 'ssdh.caffemodel' image = '/home/angle/hackathon/query/img.jpg' #Function to generate hash codes, given the model and path to images def ann_images(id): ...
15,363
93a76129e863ad178116a839215c7a41868c6733
# -*- coding: utf-8 -*- from django.core.management.base import BaseCommand from apps.shelf.models import (Book, Keyword) class Command(BaseCommand): def handle(self, *args, **opts): books = Book.objects.filter(for_random=None) for book in books: book.set_for_random() pri...
15,364
2272bc4303bfdc91bc7e23e11c2652d97aefc0d1
#!/usr/bin/python import alsaaudio as audio import time import os import struct import sys audioformat=audio.PCM_FORMAT_S16_LE # second arg to PCM can be ,audio.PCM_NONBLOCK periodsize=1024 rate=44100 indev='hw:1,0' outdev='hw:1,0' skip=3 def fix(d): """Turn mono data into stereo""" line=d n=2 return ...
15,365
ad4a8d7460853942f3ab8fb570042725095a4cff
import sys import os sys.path.append( os.path.dirname( os.path.dirname( os.path.abspath(__file__) ) ) ) import numpy as np import configargparse import skvideo.io from tqdm import tqdm import time import matplotlib.pyplot as plt import pickle import torch import torch.nn as nn import torch.nn.functional as F from t...
15,366
34c888ff27db5bd95f7f41bf72a17e201aa0c729
# vim: set fileencoding=utf-8 : """Test L{gbp.command_wrappers.Command}'s tarball unpack""" import unittest from gbp.command_wrappers import Command, CommandExecFailed from . testutils import GbpLogTester, patch_popen class TestCommandWrapperFailures(unittest.TestCase, GbpLogTester): def setUp(self): se...
15,367
969b67f628708f946bfc55855c57e39099204024
import numpy as np import cv2 import random from CNNUtil import paths LENGTH = 180 def findRegion(img): gray = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY) rct, thr = cv2.threshold(gray, 1, 255, cv2.THRESH_BINARY) contours, hierachy = cv2.findContours(thr, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) x, y, w, h =...
15,368
aebd28a1282286826338a7d77d5652366462ebbf
/home/durgesh/miniconda3/lib/python3.6/posixpath.py
15,369
cb80c72a8feb3f4277438c2738733dbcd7869966
import os import re i = 0 start = 'bbc' names = os.listdir(start) for name in names: path_to_file = os.path.join(start, name) if os.path.isdir(path_to_file): match = re.search('[a-z]+', name) match2 = re.search('[а-я]+', name) if match and match2: print(name) ...
15,370
cb58cc6b5a05a4807eec1e7c6410065a58bd8c7c
import pickle from collections import defaultdict from collections import Counter from heapq import nlargest def label_ne(ne,post_bi_un,pre_bi_un,post_si_un,pre_si_un, main_cat, decision_list): # check which main cat it belongs to candidate_tags = [] if main_cat == "LOC": # keys are every subcat and their values ...
15,371
eb9df1a929585e8dce0f7f6d38d6b4e22e081c8d
import speech_recognition as sr from gtts import gTTS from playsound import playsound from datetime import datetime from googletrans import LANGUAGES, Translator import os # Code For Speech Output def speak(text, lang='en'): tts = gTTS(text, lang=lang) filename=f'voice.mp3' tts.save(filename) playsound...
15,372
d73b0d24e6c301977ebcbc8afe941ab2a92dca0a
tup=('a','b','c','d','d') print(tup.count('d')) print(tup.index('d'))
15,373
b0f0769f68fb5012b54d60affab05c0566c6e5e6
#application of linked lists from LinkedListPKG import LinkedList; myLL = LinkedList(); myLL.insertStart(11); myLL.insertStart(22); myLL.insertStart(33); #myLL.insertEnd(99); myLL.traverse(); print(myLL.size())
15,374
6377569c1d8b0671d8c7071e422be18d78be195e
from django.db import models import datetime class GeoPhoto(models.Model): title = models.CharField(max_length=250) latitude=models.FloatField() longitude=models.FloatField() photo_url = models.CharField(max_length=500, unique=True) photo_thumbnail_url = models.CharField(max_length=500) date_ad...
15,375
2618a507ee9afbde1316caeba300157ebcec5a1c
'''Program to print the greater number between two number Developer:Aakash Date:21.02.2020 --------------------------------''' a=int(input("Enter any number=")) b=int(input("Enter any other number=")) if(a>b): print("The First number is greater i.e.,",a) else: print("The Second number is greater i.e.,",b)
15,376
b1b9bf08309d4ebfffaf61a1c3096166fdbc88a2
sentence = 'xaxax' sentence = sentence.lower() score = 0 def check_palindrome(segment): reversed = segment[::-1] return reversed == segment # for begin in range(len(sentence)-2): # for stop in range(3, len(sentence)+1): # end = begin + stop # if end > len(sentence): # continu...
15,377
63771847f0a23e6bcc98fd372f8742a0b608754b
# Embedded file name: scripts/client/ArenaHelpers/GameModes/AreaConquest/ACGameModeClient.py import BigWorld import Math from ACSector import ACSector from ArenaHelpers.GameModes import GameModeClient from ArenaHelpers.GameModes.AreaConquest import ACSectorClient from ArenaHelpers.GameModes.AreaConquest import AC_EVENT...
15,378
6c656e482e11e043f17d92404eafe4dd920c3236
def ism(x): if x>='a' and x<='z': return True return False def isM(x): if x>='A' and x<='Z': return True return False def rot13( string ): for x in range(len(string)): if ism(string[x]): if chr(ord(string[x])+13) <= 'z': string[x]=chr(ord(string...
15,379
7f5d2436659c47db04c431965e48751e4840a970
nome = input('Digite seu nome: ') print('Olá,', nome, 'bom dia!') primeiro_numero = int(input('Digite o primeiro número: ')) segundo_numero = int(input('Digite o segundo número: ')) soma = primeiro_numero + segundo_numero texto = 'O resultado da soma é:' print(texto, soma)
15,380
3bf8d290780cf30b5d311af5fb9aefaea0a099bb
import itertools def app(): n = 1000 b = 1 m = 0 for i in itertools.count(): if len(str(m)) > n: raise RuntimeError("Not found") elif len(str(m)) == n: return str(i) b, m = m, b + m if __name__ == "__main__": print(app())
15,381
54508d6dfb471d6d6b4e04dffc405a8cc4b153fb
import json from . import TrafficResponseObject class GoogleResponseObject(TrafficResponseObject.TrafficResponse): json_data = "" duration = 0 distance = 0 def __init__(self, json_data=""): print(json_data) self.json_data = json_data parsedData = json.loads(json_data)...
15,382
90b6c7763b199cd7098031d3728ab6439890deec
from selenium import webdriver from selenium.webdriver.common.by import By driver = webdriver.Chrome('/usr/local/bin/chromedriver') driver.get('https://www.convertworld.com/hu/homerseklet/celsius.html') deg = input("Hőmérséklet=") print(deg) xpath = "//input[@name='amount']" print(xpath) driver.find_element(By.XPAT...
15,383
b82b9047054ff367cb32830245ccaf686f5136c7
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. # 2019, SMART Health IT. import os import io import unittest import json from . import eventdefinition from .fhirdate import FHIRDate class EventDefinitionTests(unittest.TestCase): def instantiate_from(self, ...
15,384
2ccf7f6d58e70c70203f57c6580abfecb034d1ce
# -*- coding: UTF-8 -*- # 工具模块 import os from datetime import datetime import uuid import PIL from PIL import Image from werkzeug.utils import secure_filename ALLOWED_IMAGE_EXTENSIONS = set(['png','jpg','jpeg','gif','bmp']) ALLOWED_VIDEO_EXTENSIONS = set(['mp4','avi']) ALLOWED_AUDIO_EXTENSIONS = set(['mp3','m4a']) ...
15,385
fca01e325c7ff9602d9a4eab68b944e01314da00
""" Event message representation """ from .core import AbstractMessage from .core import MessageType class EventMesasge(AbstractMessage): """A string notification that will appear in the web app and will express the overall state of the job.""" def __init__(self, message): self._message = messag...
15,386
0471fddeacb48ae69fbb3d3d9be8b3e79f2b382d
''' Created on 2017年1月3日 @author: wujianxin ''' import re import requests import urllib.request class QSBK: def __init__(self): self.pageIndex = 1 self.user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)' self.headers = {'User-Agent': self.user_agent} self.stories = [] ...
15,387
37b34851f7831ed2657d4800e405bb6efc5acc7f
#You will be given an array with 5 numbers. #The first 2 numbers represent a range, and the next two numbers represent another range. #The final number in the array is X. #The goal of your program is to determine if both ranges overlap by at least X numbers. #For example, in the array [4, 10, 2, 6, 3] the ranges 4 ...
15,388
ba49afe13f8e149ccb95ee15674eaf102ec2b936
from src.definitions import Set from .BaseViewerScene import BaseViewerScene class SendersViewerScene(BaseViewerScene): def __init__(self, session, redis): super().__init__() self.session = session self.redis = redis def fetch(self, start, end): senders = self.redis.zrange(Se...
15,389
8628e29a5798e85e9bef24c36071fad47e34fbac
# Generated by Django 3.1.2 on 2020-10-08 19:21 from django.conf import settings from django.db import migrations, models import django.db.models.deletion import provider.models class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER...
15,390
77f61da573c98810b5aad69a4258d20a127a18f5
import enum class NAME_TYPE(enum.Enum): UNKNOWN = 0 #(0), -- Name type not known PRINCIPAL = 1 #(1), -- Just the name of the principal as in SRV_INST = 2 #(2), -- Service and other unique instance (krbtgt) SRV_HST = 3 #(3), -- Service with host name as instance SRV_XHST = 4 # (4), -- Service w...
15,391
64f37f99424d3006b292cf7db7146d1cfcccebf9
def chek(k,li): global turn,result mid = (len(li)-1)//2 if li[mid] == k: result += 1 return else: left = li[:mid] right = li[mid+1:] if k < li[mid]: turn += 1 chek(k,left) elif k > li[mid]: turn -= 1 chek(k,r...
15,392
646afc9465e77a32ba248f84e76476df4345061c
import pygame import math #Display pygame.init() WIDTH,HEIGHT = 800,500 win = pygame.display.set_mode((WIDTH,HEIGHT)) pygame.display.set_caption("Hangman") #adding the images images = [] for i in range(7): image = pygame.image.load("hangman"+ str(i)+".png") images.append(image) #button letters location RADIUS ...
15,393
3a59d631b3c3d35e08659929bbdcbde424ee02b5
import bpy import logging import os import json from bpy_extras.io_utils import ExportHelper, ImportHelper from bpy.app.handlers import persistent import traceback import time import ctypes import sys import platform import random import math import subprocess import datetime from bpy.props import EnumProperty, StringP...
15,394
00a15e283f26d6c724d280d0e37a2d906f14f3f5
SCALE_FACTOR = 0.1 FEATHER_AMOUNT = 11 COLOUR_CORRECT_BLUR_FRAC = 0.6 FACE_POINTS = list(range(17, 68)) MOUTH_POINTS = list(range(48, 61)) RIGHT_BROW_POINTS = list(range(17, 22)) LEFT_BROW_POINTS = list(range(22, 27)) RIGHT_EYE_POINTS = list(range(36, 42)) LEFT_EYE_POINTS = list(range(42, 48)) NOSE_POINTS = list(rang...
15,395
1a1c3b9aa5e3d7ccba09918d7fa74e2371398870
import unittest from unittest.mock import patch from infra.controller_factory import ControllerFactory from config.game import Game class GameTest(unittest.TestCase): def test_if_this_class_is_singleton(self): instance_one = Game() instance_two = Game() self.assertEqual(instance_one, instan...
15,396
56ad3ef5a1e191d5fe3bb051b31a69cb9044d632
import sys import numpy as np from collections import defaultdict sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N, K = lr() A = np.array([0] + lr()) A = (A-1) % K Acum = A.cumsum() % K counter = defaultdict(int) answer = 0 for i, x in enumerate(Acum): ...
15,397
cd6808f272fb20848b38fdb96c85759db0bb39c3
from pexpect.popen_spawn import PopenSpawn import pexpect from datetime import datetime import requests import json import urllib3 import os import subprocess import time urllib3.disable_warnings() import sys import re import ipv6linklocalforwarding import signal import tempfile class QuantaSkylake(object): def __...
15,398
0321ed32197d1a1623699d7f708c73371f10beb5
import argparse import json import os import warnings import datetime class GatherOptions(): def __init__(self): parser = argparse.ArgumentParser(description="Scoring thinking game") current_time = datetime.datetime.now() parser.add_argument("--save_dir", default=("Thinking\...
15,399
8397fb9f846139dc5b19cc9d43f01afad0a26207
#Задача 4. Вариант 11. #Напишите программу, которая выводит имя, под которым скрывается Йоханнес Бруфельдт. Дополнительно необходимо вывести область интересов указанной личности, место рождения, годы рождения и смерти (если человек умер), вычислить возраст на данный момент (или момент смерти). Для хранения всех необхо...