hexsha stringlengths 40 40 | size int64 6 782k | ext stringclasses 7
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 237 | max_stars_repo_name stringlengths 6 72 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses list | max_stars_count int64 1 53k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 184 | max_issues_repo_name stringlengths 6 72 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses list | max_issues_count int64 1 27.1k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 184 | max_forks_repo_name stringlengths 6 72 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses list | max_forks_count int64 1 12.2k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 6 782k | avg_line_length float64 2.75 664k | max_line_length int64 5 782k | alphanum_fraction float64 0 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
cfc55c5aba7e498ba45dd9258868abf4e71a6aae | 399 | py | Python | python/decorator/decorator.py | zeroam/TIL | 43e3573be44c7f7aa4600ff8a34e99a65cbdc5d1 | [
"MIT"
] | null | null | null | python/decorator/decorator.py | zeroam/TIL | 43e3573be44c7f7aa4600ff8a34e99a65cbdc5d1 | [
"MIT"
] | null | null | null | python/decorator/decorator.py | zeroam/TIL | 43e3573be44c7f7aa4600ff8a34e99a65cbdc5d1 | [
"MIT"
] | null | null | null | def say(func):
def employer():
print('Say something about you')
def say_name():
print('My name is jayone')
def say_nationality():
print('I am from Korea')
def wrapper():
employer()
say_name()
say_nationality()
func()
return wrapper
@say
d... | 16.625 | 40 | 0.576441 |
5c52eb6f2f141b03b55fb15abcef8eca6a2ad92e | 573 | py | Python | src/extras/logger.py | Somsubhra/Enrich | cf1e69b86ceb64c8b09c98b442e09c1196b50125 | [
"MIT"
] | 1 | 2015-11-30T09:27:51.000Z | 2015-11-30T09:27:51.000Z | src/extras/logger.py | Somsubhra/Enrich | cf1e69b86ceb64c8b09c98b442e09c1196b50125 | [
"MIT"
] | null | null | null | src/extras/logger.py | Somsubhra/Enrich | cf1e69b86ceb64c8b09c98b442e09c1196b50125 | [
"MIT"
] | null | null | null | # Headers
__author__ = 'Somsubhra Bairi'
__email__ = 'somsubhra.bairi@gmail.com'
# Logger class
class Logger:
# Log error
@staticmethod
def log_error(msg):
print '\033[91m' + 'Error: ' + msg + '\033[0m'
# Log success
@staticmethod
def log_success(msg):
print '\033[92m' + 'Suc... | 21.222222 | 56 | 0.56719 |
8f3bde461f6a176974f5ca4c0df7127a5d28350e | 2,224 | py | Python | roboraptorz/sim/simulator/simulator.py | icebear8/roboRinth | c0789a9faf978f31b0ed020d26fee2b04fb298ee | [
"MIT"
] | null | null | null | roboraptorz/sim/simulator/simulator.py | icebear8/roboRinth | c0789a9faf978f31b0ed020d26fee2b04fb298ee | [
"MIT"
] | null | null | null | roboraptorz/sim/simulator/simulator.py | icebear8/roboRinth | c0789a9faf978f31b0ed020d26fee2b04fb298ee | [
"MIT"
] | 1 | 2019-10-22T07:47:51.000Z | 2019-10-22T07:47:51.000Z | #!/usr/bin/env python
import argparse
import logging
import time
import sys
import threading
from MqttHandler import MqttHandler
logger = logging.getLogger(__name__)
running = True
def _initializeLogging(loglevel):
numeric_level = getattr(logging, loglevel.upper(), None)
if not isinstance(numeric_level, int):
... | 30.054054 | 134 | 0.695144 |
8f480ad8b9a7bb737a9e6709c7a6e99abfaf6906 | 521 | py | Python | benwaonline/util.py | goosechooser/benwaonline | e2879412aa6c3c230d25cd60072445165517b6b6 | [
"MIT"
] | null | null | null | benwaonline/util.py | goosechooser/benwaonline | e2879412aa6c3c230d25cd60072445165517b6b6 | [
"MIT"
] | 16 | 2017-09-13T10:21:40.000Z | 2020-06-01T04:32:22.000Z | benwaonline/util.py | goosechooser/benwaonline | e2879412aa6c3c230d25cd60072445165517b6b6 | [
"MIT"
] | null | null | null | """
Contains any utility functions used by processors or the benwaonline frontend.
"""
import os
import subprocess
import platform
def make_thumbnail(img, thumb_path, thumb_size="150x150"):
head, tail = os.path.split(img)
thumb_path = os.path.join(thumb_path, tail)
cmd = ['convert', img, '-strip', '-resiz... | 24.809524 | 78 | 0.650672 |
8f72b2a0ee19170b2b4d71167d098e985f5a676f | 1,132 | py | Python | KMeans/src/iris.py | quqixun/MLAlgorithms | 1ad46a899a6280a08c196fb4eb0931408c8636c7 | [
"MIT"
] | 2 | 2018-04-25T18:00:28.000Z | 2018-08-08T09:39:18.000Z | KMeans/src/iris.py | quqixun/MLAlgorithms | 1ad46a899a6280a08c196fb4eb0931408c8636c7 | [
"MIT"
] | null | null | null | KMeans/src/iris.py | quqixun/MLAlgorithms | 1ad46a899a6280a08c196fb4eb0931408c8636c7 | [
"MIT"
] | 2 | 2019-03-03T02:55:48.000Z | 2021-01-21T04:50:46.000Z | # Conventional Machine Learning Algorithms
# The Script to Test Class "kNN" on Iris.
# Author: Qixun Qu
# Create on: 2018/05/08
# Modify on: 2018/05/08
# ,,, ,,,
# ;" '; ;' ",
# ; @.ss$$$$$$s.@ ;
# `s$$$$$$$$$$$$$$$'
# $$$$$$$$$$$$$$$$$$
# $$$$P""Y$$$Y""W$$$$$
# $$$$ p"$$$"q $$$$$
# ... | 23.583333 | 61 | 0.543286 |
56db56b6d5faa391858b73b1e37b0a950055959f | 2,801 | py | Python | src/visuanalytics/analytics/control/scheduler/JsonScheduler.py | Biebertal-mach-mit-TV/Data-Analytics | 70cda2393e61f7ca0a1a4a5965646e908bd0faa9 | [
"MIT"
] | 1 | 2020-11-27T17:26:27.000Z | 2020-11-27T17:26:27.000Z | src/visuanalytics/analytics/control/scheduler/JsonScheduler.py | Biebertal-mach-mit-TV/Data-Analytics | 70cda2393e61f7ca0a1a4a5965646e908bd0faa9 | [
"MIT"
] | 85 | 2021-01-02T11:38:59.000Z | 2021-07-26T07:13:47.000Z | src/visuanalytics/analytics/control/scheduler/JsonScheduler.py | Biebertal-mach-mit-TV/Data-Analytics | 70cda2393e61f7ca0a1a4a5965646e908bd0faa9 | [
"MIT"
] | 1 | 2021-04-19T06:50:53.000Z | 2021-04-19T06:50:53.000Z | """
Modul welches den Json Scheduler beeinhaltet.
Sorgt dafür das ein Video zur richtigen Zeit gerendert und die Historisierung einer Datenquelle zur richtigen Zeit gestartet wird.
"""
import json
import logging
from datetime import datetime
from visuanalytics.analytics.control.scheduler.scheduler import Scheduler, i... | 36.376623 | 130 | 0.631917 |
56f8abfe92a4173f8cc66984102694d416125f9f | 1,477 | py | Python | First-Flask-App/app.py | kkysen/Soft-Dev | b19881b1fcc9c7daefc817e6b975ff6bce545d81 | [
"Apache-2.0"
] | null | null | null | First-Flask-App/app.py | kkysen/Soft-Dev | b19881b1fcc9c7daefc817e6b975ff6bce545d81 | [
"Apache-2.0"
] | null | null | null | First-Flask-App/app.py | kkysen/Soft-Dev | b19881b1fcc9c7daefc817e6b975ff6bce545d81 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/python
"""
Khyber Sen
SoftDev1 pd7
HW4 -- Fill Up Yer Flask
2017-09-22
"""
__author__ = 'Khyber Sen'
__date__ = '2017-09-22'
from flask import Flask
from flask import request
from flask import render_template
from urllib2 import urlopen
app = Flask(__name__)
@app.route('/hello')
def hello():
# type... | 17.795181 | 86 | 0.612051 |
859b7364daea8496562c5743782a0226950c2383 | 1,008 | py | Python | tests/core/test_cron.py | ph7vc/CL4M-B0T | e992cf63b1215ea7c241cab94edc251653dbaed7 | [
"MIT"
] | 9 | 2019-02-17T06:33:14.000Z | 2021-10-05T02:19:00.000Z | tests/core/test_cron.py | ns-phennessy/Bolt | e992cf63b1215ea7c241cab94edc251653dbaed7 | [
"MIT"
] | 28 | 2019-02-10T07:48:05.000Z | 2021-12-20T00:15:37.000Z | tests/core/test_cron.py | ph7vc/CL4M-B0T | e992cf63b1215ea7c241cab94edc251653dbaed7 | [
"MIT"
] | 4 | 2015-03-13T03:58:55.000Z | 2015-05-27T08:29:46.000Z | import unittest
from bolt.core.plugin import Plugin
from bolt import cron
from bolt import Bot
import yaml
from datetime import datetime
class TestCronPlugin(Plugin):
@cron("* * * * *")
def crontest(self):
pass
class TestCron(unittest.TestCase):
def setUp(self):
self.config_file = "/tmp... | 23.44186 | 62 | 0.619048 |
bb44044e1b828f961fccbad605ee0130e6477a18 | 1,996 | py | Python | main.py | LikeToAccess/RCB | 37510facf935a9a8559bdd85ac86b292b5764639 | [
"MIT"
] | 1 | 2022-02-02T18:08:10.000Z | 2022-02-02T18:08:10.000Z | main.py | LikeToAccess/RCB | 37510facf935a9a8559bdd85ac86b292b5764639 | [
"MIT"
] | null | null | null | main.py | LikeToAccess/RCB | 37510facf935a9a8559bdd85ac86b292b5764639 | [
"MIT"
] | null | null | null | import os
import threading
import format_json
from database import Database
from settings import *
log_filename = os.path.abspath("completed.log")
def file_line_count(file_path, memory_mapped=False):
print(
"Reading lines (mapping file to RAM)..." \
if memory_mapped else \
"Reading lines (dis... | 22.426966 | 67 | 0.6999 |
24714e11c4e705665766f495949641f3441a2f89 | 972 | py | Python | Algorithms/3_Strings/1.py | abphilip-codes/Hackerrank_DSA | bb9e233d9d45c5b14c138830602695ad4113fba4 | [
"MIT"
] | 1 | 2021-11-25T13:39:30.000Z | 2021-11-25T13:39:30.000Z | Algorithms/3_Strings/1.py | abphilip-codes/Hackerrank_DSA | bb9e233d9d45c5b14c138830602695ad4113fba4 | [
"MIT"
] | null | null | null | Algorithms/3_Strings/1.py | abphilip-codes/Hackerrank_DSA | bb9e233d9d45c5b14c138830602695ad4113fba4 | [
"MIT"
] | null | null | null | # https://www.hackerrank.com/challenges/bear-and-steady-gene/problem
#!/bin/python3
import math
import os
import random
import re
import sys
#
# Complete the 'steadyGene' function below.
#
# The function is expected to return an INTEGER.
# The function accepts STRING gene as parameter.
#
def steadyGene(gene):
a... | 24.3 | 108 | 0.572016 |
24e635cdc1387ac2f6332f540dc22f043893f911 | 823 | py | Python | server/bumf/api/urls.py | bumfiness/bumf | 71c404c0a8f804b8f0e127df3de6d8916db4c660 | [
"Apache-2.0"
] | 6 | 2017-01-07T17:59:46.000Z | 2017-02-10T13:19:46.000Z | server/bumf/api/urls.py | rixx/bumf | 71c404c0a8f804b8f0e127df3de6d8916db4c660 | [
"Apache-2.0"
] | null | null | null | server/bumf/api/urls.py | rixx/bumf | 71c404c0a8f804b8f0e127df3de6d8916db4c660 | [
"Apache-2.0"
] | null | null | null | from django.conf.urls import include, url
from rest_framework import routers
from rest_framework.authtoken import views
from bumf.api.views import (
BudgetAccountView, DossierView, ProjectView, RealAccountView,
RealTransactionView, UserView, VirtualTransactionView,
)
from .signals import * # noqa
router = r... | 31.653846 | 65 | 0.787363 |
79d0b6bd0426d21181b16714faa6aa2da5410f01 | 745 | py | Python | checks/http_and_https.py | thegreenwebfoundation/green-spider | 68f22886178bbe5b476a4591a6812ee25cb5651b | [
"Apache-2.0"
] | 19 | 2018-04-20T11:03:41.000Z | 2022-01-12T20:58:56.000Z | checks/http_and_https.py | thegreenwebfoundation/green-spider | 68f22886178bbe5b476a4591a6812ee25cb5651b | [
"Apache-2.0"
] | 160 | 2018-04-05T16:12:59.000Z | 2022-03-01T13:01:27.000Z | checks/http_and_https.py | thegreenwebfoundation/green-spider | 68f22886178bbe5b476a4591a6812ee25cb5651b | [
"Apache-2.0"
] | 8 | 2018-11-05T13:07:57.000Z | 2021-06-11T11:46:43.000Z | """
This adds, for every HTTP URL, the HTTPS counterpart,
and vice versa, to config.urls
So it doesn't actually perform tests. It only expands the
URLs to test by other checks.
"""
from checks.abstract_checker import AbstractChecker
class Checker(AbstractChecker):
def __init__(self, config, previous_results=None... | 27.592593 | 57 | 0.608054 |
30c1a2e893c6bd0652f8b7635c3e5b2b9027da24 | 1,814 | py | Python | src/standard_module/string_module.py | HuangHuaBingZiGe/GitHub-Demo | f3710f73b0828ef500343932d46c61d3b1e04ba9 | [
"Apache-2.0"
] | null | null | null | src/standard_module/string_module.py | HuangHuaBingZiGe/GitHub-Demo | f3710f73b0828ef500343932d46c61d3b1e04ba9 | [
"Apache-2.0"
] | null | null | null | src/standard_module/string_module.py | HuangHuaBingZiGe/GitHub-Demo | f3710f73b0828ef500343932d46c61d3b1e04ba9 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/python
# -*- coding: utf-8 -*-
import string
# python3 无stof和stoi方法,python3标准库已删,用的不多
# 将字符串转换成浮点型
# print(string.atof('1.11'))
# 将字符串转换为整型
# print(string.atoi('111'))
print("------------------------------------------------")
st = 'wyz'
print("字符串包括的属性和方法有:")
print(dir(st))
# 字符串的方法和属性
# ['__add__', '__... | 60.466667 | 902 | 0.62183 |
a501b40b3b5991a07a801ed2ba9b9c7b4febd400 | 3,005 | py | Python | test/test_npu/test_network_ops/test_mv.py | Ascend/pytorch | 39849cf72dafe8d2fb68bd1679d8fd54ad60fcfc | [
"BSD-3-Clause"
] | 1 | 2021-12-02T03:07:35.000Z | 2021-12-02T03:07:35.000Z | test/test_npu/test_network_ops/test_mv.py | Ascend/pytorch | 39849cf72dafe8d2fb68bd1679d8fd54ad60fcfc | [
"BSD-3-Clause"
] | 1 | 2021-11-12T07:23:03.000Z | 2021-11-12T08:28:13.000Z | test/test_npu/test_network_ops/test_mv.py | Ascend/pytorch | 39849cf72dafe8d2fb68bd1679d8fd54ad60fcfc | [
"BSD-3-Clause"
] | null | null | null | # Copyright (c) 2020 Huawei Technologies Co., Ltd
# Copyright (c) 2019, Facebook CORPORATION.
# All rights reserved.
#
# Licensed under the BSD 3-Clause License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://opensource.org/lice... | 41.164384 | 89 | 0.644925 |
241876ca0065e8b6e84151b6950d704f4f62e866 | 1,534 | py | Python | matplotlib_test.py | lixianyu/DL | 4cf08b2cc8a5478af38c1b00d765548efe396392 | [
"MIT"
] | null | null | null | matplotlib_test.py | lixianyu/DL | 4cf08b2cc8a5478af38c1b00d765548efe396392 | [
"MIT"
] | null | null | null | matplotlib_test.py | lixianyu/DL | 4cf08b2cc8a5478af38c1b00d765548efe396392 | [
"MIT"
] | null | null | null | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
% matplotlib inline
import seaborn as sns
sns.set_style('darkgrid')
# 加载红葡萄酒和白葡萄酒数据集
red_df = pd.read_csv('winequality-red.csv', sep=';')
white_df = pd.read_csv('winequality-white.csv', sep=';')
red_df = red_df.rename(columns = {'total_su... | 30.68 | 101 | 0.694263 |
03118a852d4f141b54e4d141993c749289d9d0a3 | 1,901 | py | Python | 2-resources/_PYTHON/code-examples-master/sqlite/python/random-write_to_sqlite.py | eengineergz/Lambda | 1fe511f7ef550aed998b75c18a432abf6ab41c5f | [
"MIT"
] | null | null | null | 2-resources/_PYTHON/code-examples-master/sqlite/python/random-write_to_sqlite.py | eengineergz/Lambda | 1fe511f7ef550aed998b75c18a432abf6ab41c5f | [
"MIT"
] | null | null | null | 2-resources/_PYTHON/code-examples-master/sqlite/python/random-write_to_sqlite.py | eengineergz/Lambda | 1fe511f7ef550aed998b75c18a432abf6ab41c5f | [
"MIT"
] | 1 | 2021-11-05T07:48:26.000Z | 2021-11-05T07:48:26.000Z | import sqlite3, random
names = ['ruan', 'stefan', 'philip', 'norman', 'frank', 'pete', 'johnny', 'peter', 'adam']
cities = ['cape town', 'johannesburg', 'pretoria', 'dublin', 'kroonstad', 'bloemfontein', 'port elizabeth', 'auckland', 'sydney']
lastnames = ['smith', 'bekker', 'admams', 'phillips', 'james', 'adamson']
w... | 90.52381 | 312 | 0.681746 |
30386c7b7509702c4031dc7bfcbc2cb4c98caf6f | 2,674 | py | Python | python/data_sutram/scraper/db_migrate.py | SayanGhoshBDA/code-backup | 8b6135facc0e598e9686b2e8eb2d69dd68198b80 | [
"MIT"
] | 16 | 2018-11-26T08:39:42.000Z | 2019-05-08T10:09:52.000Z | python/data_sutram/scraper/db_migrate.py | SayanGhoshBDA/code-backup | 8b6135facc0e598e9686b2e8eb2d69dd68198b80 | [
"MIT"
] | 8 | 2020-05-04T06:29:26.000Z | 2022-02-12T05:33:16.000Z | python/data_sutram/scraper/db_migrate.py | SayanGhoshBDA/code-backup | 8b6135facc0e598e9686b2e8eb2d69dd68198b80 | [
"MIT"
] | 5 | 2020-02-11T16:02:21.000Z | 2021-02-05T07:48:30.000Z | from datetime import tzinfo, timedelta, datetime
import sqlite3
import time
import urllib.request, urllib.parse, urllib.error
from bs4 import BeautifulSoup
import ssl
import re
import os.path
import urllib.request
from tqdm import tqdm
# Ignore SSL certificate errors
ctx = ssl.create_default_context()
ctx.check_hostnam... | 32.609756 | 141 | 0.636874 |
88fd048d8a5d74a09e9ad83cbcef5f2afb7ff770 | 1,075 | py | Python | src/kandidaturen/migrations/0001_initial.py | Sumarbrander/Stura-Mitgliederdatenbank | 691dbd33683b2c2d408efe7a3eb28e083ebcd62a | [
"MIT"
] | 1 | 2021-12-20T20:15:26.000Z | 2021-12-20T20:15:26.000Z | src/kandidaturen/migrations/0001_initial.py | Sumarbrander/Stura-Mitgliederdatenbank | 691dbd33683b2c2d408efe7a3eb28e083ebcd62a | [
"MIT"
] | null | null | null | src/kandidaturen/migrations/0001_initial.py | Sumarbrander/Stura-Mitgliederdatenbank | 691dbd33683b2c2d408efe7a3eb28e083ebcd62a | [
"MIT"
] | null | null | null | # Generated by Django 3.1.5 on 2021-05-02 23:01
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('aemter', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Ka... | 32.575758 | 115 | 0.571163 |
004c8069a2551a74a8188785602e96657662b7ef | 29,655 | py | Python | FSACO.py | Colosu/FSACO | 77695f830e6c0ac2f9e4f42e61dd0109c022e8ac | [
"MIT"
] | null | null | null | FSACO.py | Colosu/FSACO | 77695f830e6c0ac2f9e4f42e61dd0109c022e8ac | [
"MIT"
] | null | null | null | FSACO.py | Colosu/FSACO | 77695f830e6c0ac2f9e4f42e61dd0109c022e8ac | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 24 12:16:05 2020
@author: colosu
"""
import xml.etree.ElementTree as ET
from threading import Thread
import time
import operator
from os import listdir
from os.path import isfile, join
import matplotlib.pyplot as plt
import numpy as np
class splap... | 34.482558 | 147 | 0.682684 |
4e0a6691adebf6fa73288063cef6a479e206729f | 2,488 | py | Python | Files/main.py | AzloTaken/Flask | 1ceeafc330324dce4a02066d2fd23d1c76091946 | [
"MIT"
] | null | null | null | Files/main.py | AzloTaken/Flask | 1ceeafc330324dce4a02066d2fd23d1c76091946 | [
"MIT"
] | null | null | null | Files/main.py | AzloTaken/Flask | 1ceeafc330324dce4a02066d2fd23d1c76091946 | [
"MIT"
] | null | null | null | #!/usr/bin/python3
import discord, colorama, time
from discord.ext import commands
from colorama import Fore, Style
colorama.init()
prefix = ">"
auth_token = "PASTE TOKEN HERE"
client = commands.Bot(command_prefix=prefix)
client.remove_command("help")
@client.event
async def on_ready():
await client.change_prese... | 31.1 | 110 | 0.67283 |
9ddc117c80d4a523ffe8ffe354043b1e8a0046e9 | 1,595 | py | Python | create_lncs_urls.py | pku601/LDA | a4bcd3e40ed2920dc29bf0270eab05b245ea003e | [
"Apache-2.0"
] | null | null | null | create_lncs_urls.py | pku601/LDA | a4bcd3e40ed2920dc29bf0270eab05b245ea003e | [
"Apache-2.0"
] | null | null | null | create_lncs_urls.py | pku601/LDA | a4bcd3e40ed2920dc29bf0270eab05b245ea003e | [
"Apache-2.0"
] | null | null | null |
def write_file(fp, stop, content1, content2):
for ii in range(1, stop):
fp.write(content1 + str(ii) + content2 + '\n')
def combine_str(start_year, stop_year):
return '?facet-language=%22En%22&facet-content-type=%22Article%22&sortOrder=newestFirst&facet-discipline=%22Computer+Science%22&date-facet-mo... | 46.911765 | 230 | 0.708464 |
0603123a422656d9c65cfdd6391bf9680355f0ac | 2,578 | py | Python | Packs/ExportToXLSX/Scripts/ExportToXLSX/ExportToXLSX_test.py | diCagri/content | c532c50b213e6dddb8ae6a378d6d09198e08fc9f | [
"MIT"
] | 799 | 2016-08-02T06:43:14.000Z | 2022-03-31T11:10:11.000Z | Packs/ExportToXLSX/Scripts/ExportToXLSX/ExportToXLSX_test.py | diCagri/content | c532c50b213e6dddb8ae6a378d6d09198e08fc9f | [
"MIT"
] | 9,317 | 2016-08-07T19:00:51.000Z | 2022-03-31T21:56:04.000Z | Packs/ExportToXLSX/Scripts/ExportToXLSX/ExportToXLSX_test.py | diCagri/content | c532c50b213e6dddb8ae6a378d6d09198e08fc9f | [
"MIT"
] | 1,297 | 2016-08-04T13:59:00.000Z | 2022-03-31T23:43:06.000Z | from ExportToXLSX import parse_data
DATA_INPUT_SINGLE_DICT = {"key1": "val1", "key2": "val2"}
DATA_INPUT_MULTIPLE_DICTS = '{\"key1\":\"val1\",\"key2\":\"val2\"},{\"key1\":\"val3\",\"key2\":\"val4\"}'
def test_parse_data_single_item_no_error():
""" Unit test
Given
- parse_data help method
- in... | 31.82716 | 105 | 0.638092 |
ae1065c581699720587e29bd04ca4d3f962ddf05 | 220 | py | Python | 1313-decompress-run-length-encoded-list/1313-decompress-run-length-encoded-list.py | hyeseonko/LeetCode | 48dfc93f1638e13041d8ce1420517a886abbdc77 | [
"MIT"
] | 2 | 2021-12-05T14:29:06.000Z | 2022-01-01T05:46:13.000Z | 1313-decompress-run-length-encoded-list/1313-decompress-run-length-encoded-list.py | hyeseonko/LeetCode | 48dfc93f1638e13041d8ce1420517a886abbdc77 | [
"MIT"
] | null | null | null | 1313-decompress-run-length-encoded-list/1313-decompress-run-length-encoded-list.py | hyeseonko/LeetCode | 48dfc93f1638e13041d8ce1420517a886abbdc77 | [
"MIT"
] | null | null | null | class Solution:
def decompressRLElist(self, nums: List[int]) -> List[int]:
_len = len(nums)//2
output=[]
for i in range(_len):
output+=[nums[2*i+1]]*nums[2*i]
return output | 31.428571 | 62 | 0.540909 |
88601d50bd787d3e913c129b33818eb3cee4949c | 1,934 | py | Python | zencad/examples/2.Operations/1.AphineTrans/short_rotate.py | Spiritdude/zencad | 4e63b1a6306dd235f4daa2791b10249f7546c95b | [
"MIT"
] | 5 | 2018-04-11T14:11:40.000Z | 2018-09-12T19:03:36.000Z | zencad/examples/2.Operations/1.AphineTrans/short_rotate.py | Spiritdude/zencad | 4e63b1a6306dd235f4daa2791b10249f7546c95b | [
"MIT"
] | null | null | null | zencad/examples/2.Operations/1.AphineTrans/short_rotate.py | Spiritdude/zencad | 4e63b1a6306dd235f4daa2791b10249f7546c95b | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
"""
ZenCad API example: short_rotate
last update: 24.10.2019
Detail:
Short rotate application example.
That operation very useful if you need rotate object axis
by source axis vector and target axis vector.
Otherwise, With common rotation operation you should evaluate
rotation axis and rotat... | 23.585366 | 98 | 0.576525 |
c9e1be6a1de8be446e6390303289fa135f3b71ca | 1,018 | py | Python | my-cs/intern/py_details/graph_util.py | zaqwes8811/cs-courses | aa9cf5ad109c9cfcacaadc11bf2defb2188ddce2 | [
"Apache-2.0"
] | null | null | null | my-cs/intern/py_details/graph_util.py | zaqwes8811/cs-courses | aa9cf5ad109c9cfcacaadc11bf2defb2188ddce2 | [
"Apache-2.0"
] | null | null | null | my-cs/intern/py_details/graph_util.py | zaqwes8811/cs-courses | aa9cf5ad109c9cfcacaadc11bf2defb2188ddce2 | [
"Apache-2.0"
] | null | null | null |
def enc_digraph_to_select_in_edges(g):
"""
Change selection out edges to select in edges
@param g - Graph in Adj. List. Vertex correspond out edges
"""
copy_gr = {}
for k in g.keys():
copy_gr[k] = []
for k, v in g.items():
ends = g[k]
for elem in ends:
... | 19.960784 | 86 | 0.56778 |
0930298ff1222b660db60942dba7aac6ec115db2 | 46 | py | Python | python/python_backup/PRAC_PYTHON/poi.py | SayanGhoshBDA/code-backup | 8b6135facc0e598e9686b2e8eb2d69dd68198b80 | [
"MIT"
] | 16 | 2018-11-26T08:39:42.000Z | 2019-05-08T10:09:52.000Z | python/python_backup/PRAC_PYTHON/poi.py | SayanGhoshBDA/code-backup | 8b6135facc0e598e9686b2e8eb2d69dd68198b80 | [
"MIT"
] | 8 | 2020-05-04T06:29:26.000Z | 2022-02-12T05:33:16.000Z | python/python_backup/PRAC_PYTHON/poi.py | SayanGhoshBDA/code-backup | 8b6135facc0e598e9686b2e8eb2d69dd68198b80 | [
"MIT"
] | 5 | 2020-02-11T16:02:21.000Z | 2021-02-05T07:48:30.000Z | for i in range(1,6,1):
for j in range(1,10,1 | 23 | 23 | 0.630435 |
eee620b7cc87622fc73505261a33c3b97687201a | 1,269 | py | Python | frappe-bench/apps/erpnext/erpnext/accounts/report/unpaid_expense_claim/unpaid_expense_claim.py | Semicheche/foa_frappe_docker | a186b65d5e807dd4caf049e8aeb3620a799c1225 | [
"MIT"
] | 1 | 2021-04-29T14:55:29.000Z | 2021-04-29T14:55:29.000Z | frappe-bench/apps/erpnext/erpnext/accounts/report/unpaid_expense_claim/unpaid_expense_claim.py | Semicheche/foa_frappe_docker | a186b65d5e807dd4caf049e8aeb3620a799c1225 | [
"MIT"
] | null | null | null | frappe-bench/apps/erpnext/erpnext/accounts/report/unpaid_expense_claim/unpaid_expense_claim.py | Semicheche/foa_frappe_docker | a186b65d5e807dd4caf049e8aeb3620a799c1225 | [
"MIT"
] | 1 | 2021-04-29T14:39:01.000Z | 2021-04-29T14:39:01.000Z | # Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
def execute(filters=None):
columns, data = [], []
columns = get_columns()
data = get_unclaimed_expese_claims(filters)
re... | 36.257143 | 123 | 0.725768 |
09c9bb79e982907b8796b326756a7c4f581baccc | 279 | py | Python | Python/adventure/beta/run.py | SchickDominik/progprojects | 1eb9c5e3b9445f617b56bd9ceb02f2f182d730e2 | [
"MIT"
] | null | null | null | Python/adventure/beta/run.py | SchickDominik/progprojects | 1eb9c5e3b9445f617b56bd9ceb02f2f182d730e2 | [
"MIT"
] | 9 | 2020-08-19T19:31:51.000Z | 2020-09-01T15:30:43.000Z | Python/adventure/beta/run.py | SchickDominik/progprojects | 1eb9c5e3b9445f617b56bd9ceb02f2f182d730e2 | [
"MIT"
] | 2 | 2020-08-19T16:00:58.000Z | 2020-08-21T08:16:23.000Z | import os
import platform
if platform.system() == "Linux":
os.system("urxvt -e bash -c './game'")
elif platform.system() == "Darwin":
os.system(str(os.system("echo $TERM")) + "-e bash -c './game'")
elif platform.system() == "Windows":
os.system("start cmd /k game") | 27.9 | 67 | 0.620072 |
1104bbe0bdf03e162d07b18b2cc58f717a6b70be | 5,730 | py | Python | simple-tensorflow-demo/4.demos/5.lossTest.py | crackedcd/Intern.MT | 36398837af377a7e1c4edd7cbb15eabecd2c3103 | [
"MIT"
] | 1 | 2019-07-05T03:42:17.000Z | 2019-07-05T03:42:17.000Z | simple-tensorflow-demo/4.demos/5.lossTest.py | crackedcd/Intern.MT | 36398837af377a7e1c4edd7cbb15eabecd2c3103 | [
"MIT"
] | null | null | null | simple-tensorflow-demo/4.demos/5.lossTest.py | crackedcd/Intern.MT | 36398837af377a7e1c4edd7cbb15eabecd2c3103 | [
"MIT"
] | 1 | 2019-06-24T05:56:55.000Z | 2019-06-24T05:56:55.000Z | """
损失函数 loss
预测值(predict)(y)与已知答案(target)(y_)的差距
| -> 均方误差 MSE Mean Squared Error tf.reduce_mean(tf.square(y, y_))
loss最小 -> | -> 交叉熵 Cross Entropy tf.reduce_sum(tf.where(tf.greater(y, y_), if_true, if_false))
| -> 自定义 -tf.reduce_mean(y_ ... | 30.972973 | 112 | 0.552356 |
3a98aae5966b3a4679ae47b099cf5e591b479527 | 240 | py | Python | SystemInfos/io/infoPrinter.py | urss1/RPiTutorialSystemInfos | 4888824a66b9add228e9ee9979ad70018a7b9022 | [
"MIT"
] | null | null | null | SystemInfos/io/infoPrinter.py | urss1/RPiTutorialSystemInfos | 4888824a66b9add228e9ee9979ad70018a7b9022 | [
"MIT"
] | null | null | null | SystemInfos/io/infoPrinter.py | urss1/RPiTutorialSystemInfos | 4888824a66b9add228e9ee9979ad70018a7b9022 | [
"MIT"
] | null | null | null | # **************************************************
# io/systemInfoPrinter
# 26.10.2018 V1.0 - sumali - Create Project
# **************************************************
def show(name, value):
print "{0: <20}: {1}".format(name, value)
| 34.285714 | 52 | 0.370833 |
c93ac8bc0bb9c94f8e29dbba885e5c4a7659dace | 1,148 | py | Python | Openharmony v1.0/third_party/ltp/testcases/network/nfsv4/acl/setacl_stress.py | clkbit123/TheOpenHarmony | 0e6bcd9dee9f1a2481d762966b8bbd24baad6159 | [
"MIT"
] | 1 | 2022-02-15T08:51:55.000Z | 2022-02-15T08:51:55.000Z | hihope_neptune-oh_hid/00_src/v0.3/third_party/ltp/testcases/network/nfsv4/acl/setacl_stress.py | dawmlight/vendor_oh_fun | bc9fb50920f06cd4c27399f60076f5793043c77d | [
"Apache-2.0"
] | null | null | null | hihope_neptune-oh_hid/00_src/v0.3/third_party/ltp/testcases/network/nfsv4/acl/setacl_stress.py | dawmlight/vendor_oh_fun | bc9fb50920f06cd4c27399f60076f5793043c77d | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python3
'''
Access Control Lists stressing script
To lauch on the first client
Aurelien Charbon - Bull SA
'''
from random_gen import *
from optparse import OptionParser
import subprocess
import os
import random
alphabet='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789_-()'
t_alphabet=l... | 34.787879 | 109 | 0.743902 |
6ec565ddee247d41c0e39cd4c707dea97889fbef | 11,852 | py | Python | Packs/GoogleSheets/Integrations/GoogleSheets/GoogleSheets_test.py | cstone112/content | 7f039931b8cfc20e89df52d895440b7321149a0d | [
"MIT"
] | 2 | 2021-12-06T21:38:24.000Z | 2022-01-13T08:23:36.000Z | Packs/GoogleSheets/Integrations/GoogleSheets/GoogleSheets_test.py | cstone112/content | 7f039931b8cfc20e89df52d895440b7321149a0d | [
"MIT"
] | 87 | 2022-02-23T12:10:53.000Z | 2022-03-31T11:29:05.000Z | Packs/GoogleSheets/Integrations/GoogleSheets/GoogleSheets_test.py | cstone112/content | 7f039931b8cfc20e89df52d895440b7321149a0d | [
"MIT"
] | 2 | 2022-01-05T15:27:01.000Z | 2022-02-01T19:27:43.000Z | import json
import io
import pytest
import GoogleSheets
import os
from googleapiclient.discovery import build
from googleapiclient.http import HttpMock
from googleapiclient.http import HttpMockSequence
def util_load_json(path):
with io.open(path, mode='r', encoding='utf-8') as f:
return json.loads(f.read(... | 34.057471 | 118 | 0.677017 |
6c3a9c2140a285df17b2652e4229fc24a5e1291b | 3,107 | py | Python | Packs/PenfieldAI/Integrations/Penfield/Penfield.py | diCagri/content | c532c50b213e6dddb8ae6a378d6d09198e08fc9f | [
"MIT"
] | 799 | 2016-08-02T06:43:14.000Z | 2022-03-31T11:10:11.000Z | Packs/PenfieldAI/Integrations/Penfield/Penfield.py | diCagri/content | c532c50b213e6dddb8ae6a378d6d09198e08fc9f | [
"MIT"
] | 9,317 | 2016-08-07T19:00:51.000Z | 2022-03-31T21:56:04.000Z | Packs/PenfieldAI/Integrations/Penfield/Penfield.py | diCagri/content | c532c50b213e6dddb8ae6a378d6d09198e08fc9f | [
"MIT"
] | 1,297 | 2016-08-04T13:59:00.000Z | 2022-03-31T23:43:06.000Z | import urllib3
import traceback
import demistomock as demisto
from CommonServerPython import * # pylint: disable=unused-wildcard-import
from CommonServerUserPython import * # noqa
# Disable insecure warnings
urllib3.disable_warnings()
''' CLIENT CLASS '''
class Client(BaseClient):
def live_assign_get(self, a... | 27.495575 | 93 | 0.607982 |
66c09cd783d689ed50b5e96d43c8e2885aaf26bb | 94 | py | Python | Shivani/Sum using variable.py | 63Shivani/Python-BootCamp | 2ed0ef95af35d35c0602031670fecfc92d8cea0a | [
"MIT"
] | null | null | null | Shivani/Sum using variable.py | 63Shivani/Python-BootCamp | 2ed0ef95af35d35c0602031670fecfc92d8cea0a | [
"MIT"
] | null | null | null | Shivani/Sum using variable.py | 63Shivani/Python-BootCamp | 2ed0ef95af35d35c0602031670fecfc92d8cea0a | [
"MIT"
] | null | null | null | a=float(input("enter first number\n"))
b=float(input("enter second number\n"))
c=a+b
print(c)
| 18.8 | 39 | 0.702128 |
dd020440ceaef9c90cae6b48e2c52c4fed72e04b | 234 | py | Python | Online-Judges/DimikOJ/Python/83-power-of-2.py | shihab4t/Competitive-Programming | e8eec7d4f7d86bfa1c00b7fbbedfd6a1518f19be | [
"Unlicense"
] | 3 | 2021-06-15T01:19:23.000Z | 2022-03-16T18:23:53.000Z | Online-Judges/DimikOJ/Python/83-power-of-2.py | shihab4t/Competitive-Programming | e8eec7d4f7d86bfa1c00b7fbbedfd6a1518f19be | [
"Unlicense"
] | null | null | null | Online-Judges/DimikOJ/Python/83-power-of-2.py | shihab4t/Competitive-Programming | e8eec7d4f7d86bfa1c00b7fbbedfd6a1518f19be | [
"Unlicense"
] | null | null | null | for _ in range(int(input())):
n = int(input())
for i in range(1, n):
if 2 ** i == n:
print("It's a power of 2")
continue
else:
print("Not a power of 2")
continue
| 23.4 | 38 | 0.42735 |
06b61b17605f2b57619888545ed71881059ec3df | 833 | py | Python | tools/legacy/darkstar-vol-extractor/cmpvol.py | gifted-nguvu/darkstar-dts-converter | aa17a751a9f3361ca9bbb400ee4c9516908d1297 | [
"MIT"
] | 2 | 2020-03-18T18:23:27.000Z | 2020-08-02T15:59:16.000Z | tools/legacy/darkstar-vol-extractor/cmpvol.py | gifted-nguvu/darkstar-dts-converter | aa17a751a9f3361ca9bbb400ee4c9516908d1297 | [
"MIT"
] | 5 | 2019-07-07T16:47:47.000Z | 2020-08-10T16:20:00.000Z | tools/legacy/darkstar-vol-extractor/cmpvol.py | gifted-nguvu/darkstar-dts-converter | aa17a751a9f3361ca9bbb400ee4c9516908d1297 | [
"MIT"
] | 1 | 2020-03-18T18:23:30.000Z | 2020-03-18T18:23:30.000Z | import sys
import glob
import hashlib
importFiles = []
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
for importFile in sys.argv[1:]:
files = glob.glob(importFile)
importFiles.extend(files)
for impor... | 23.8 | 74 | 0.660264 |
662c27727b2e577f57ebf2105feeff5d4969ff37 | 368 | py | Python | ___Python/Carsten/p07_file_io/m00_rekursion.py | uvenil/PythonKurs201806 | 85afa9c9515f5dd8bec0c546f077d8cc39568fe8 | [
"Apache-2.0"
] | null | null | null | ___Python/Carsten/p07_file_io/m00_rekursion.py | uvenil/PythonKurs201806 | 85afa9c9515f5dd8bec0c546f077d8cc39568fe8 | [
"Apache-2.0"
] | null | null | null | ___Python/Carsten/p07_file_io/m00_rekursion.py | uvenil/PythonKurs201806 | 85afa9c9515f5dd8bec0c546f077d8cc39568fe8 | [
"Apache-2.0"
] | null | null | null | # 1) Fakultät
# iterative Definition
# 5! = 1*2*3*4*5 = 120
# rekursive Definition
# n! = n * (n-1*)!
# 0! = 1
def fak(n): # rekursiv
if n == 0:
return 1
else:
return n*fak(n-1)
print (fak(4))
def fak_iter(n): # iterativ
erg = 1
for i in range (1, n+1):
e... | 14.72 | 29 | 0.483696 |
663082a6fd6b5354dbe5eff69d9d9184c9b23d80 | 543 | py | Python | PYTHON/Date_and_Time/time_delta.py | byung-u/HackerRank | 4c02fefff7002b3af774b99ebf8d40f149f9d163 | [
"MIT"
] | null | null | null | PYTHON/Date_and_Time/time_delta.py | byung-u/HackerRank | 4c02fefff7002b3af774b99ebf8d40f149f9d163 | [
"MIT"
] | null | null | null | PYTHON/Date_and_Time/time_delta.py | byung-u/HackerRank | 4c02fefff7002b3af774b99ebf8d40f149f9d163 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import sys
from datetime import datetime
def time_delta(t1, t2):
do1 = datetime.strptime(t1, '%a %d %b %Y %H:%M:%S %z')
do2 = datetime.strptime(t2, '%a %d %b %Y %H:%M:%S %z')
diff_do = do1 - do2 # 1 day, 0:30:00
# print(diff_do, type(diff_do))
return abs((diff_do.days * 360... | 25.857143 | 60 | 0.569061 |
afa0e6d5c7cd8b5ef36b5e16d9addce557079768 | 36,060 | py | Python | tests/onegov/wtfs/test_forms.py | politbuero-kampagnen/onegov-cloud | 20148bf321b71f617b64376fe7249b2b9b9c4aa9 | [
"MIT"
] | null | null | null | tests/onegov/wtfs/test_forms.py | politbuero-kampagnen/onegov-cloud | 20148bf321b71f617b64376fe7249b2b9b9c4aa9 | [
"MIT"
] | null | null | null | tests/onegov/wtfs/test_forms.py | politbuero-kampagnen/onegov-cloud | 20148bf321b71f617b64376fe7249b2b9b9c4aa9 | [
"MIT"
] | null | null | null | from cgi import FieldStorage
from datetime import date
from freezegun import freeze_time
from io import BytesIO
from mock import MagicMock
from onegov.core.utils import module_path
from onegov.user import User
from onegov.user import UserCollection
from onegov.wtfs.collections import MunicipalityCollection
from onegov.... | 34.573346 | 75 | 0.690211 |
abecd1eea35dd87d3778dc3e816ef79d32988c93 | 555 | py | Python | parallel_processing/dask_client.py | stanton119/data-analysis | b6fda815c6cc1798ba13a5d2680369b7e5dfcdf9 | [
"Apache-2.0"
] | null | null | null | parallel_processing/dask_client.py | stanton119/data-analysis | b6fda815c6cc1798ba13a5d2680369b7e5dfcdf9 | [
"Apache-2.0"
] | 1 | 2021-02-11T23:44:52.000Z | 2021-02-11T23:44:52.000Z | parallel_processing/dask_client.py | stanton119/data-analysis | b6fda815c6cc1798ba13a5d2680369b7e5dfcdf9 | [
"Apache-2.0"
] | 1 | 2021-12-16T01:02:23.000Z | 2021-12-16T01:02:23.000Z | """
Quick script testing the dask client view to monitor jobs.
"""
import dask
import timeit
from dask.distributed import Client, progress
import time
import numpy as np
def delay_fcn(*args):
time.sleep(np.random.rand())
if __name__=='__main__':
client = Client(n_workers=2, threads_per_worker=2, memory_limit... | 24.130435 | 74 | 0.715315 |
05288dd0e7a39cd21866d91283ea79d9efdd6713 | 5,237 | py | Python | src/txt2ntf.py | r-gr/jxf-to-ntf | fc9563b72be9eddc89af5c31d829b2bf9a56f773 | [
"MIT"
] | null | null | null | src/txt2ntf.py | r-gr/jxf-to-ntf | fc9563b72be9eddc89af5c31d829b2bf9a56f773 | [
"MIT"
] | null | null | null | src/txt2ntf.py | r-gr/jxf-to-ntf | fc9563b72be9eddc89af5c31d829b2bf9a56f773 | [
"MIT"
] | null | null | null | import struct
def ftob(f: float):
#return int.to_bytes(int.from_bytes(struct.pack('<f', f), byteorder='little'))
return struct.pack('<f', f)
def itob(i: int):
return (*i.to_bytes(4, byteorder='little'),)
def main(n, size, infile, outfile):
# 32bits = 4 bytes
with open(outfile, 'wb') as f:
... | 33.356688 | 96 | 0.472408 |
75d3a53e9a0962ce42efa4dff82e6be35276ace4 | 219 | py | Python | autenticacao/urls.py | LeonardoHMS/imobi | 6b2b97a05df67ea7d493f7b601382f65c6629cc2 | [
"MIT"
] | null | null | null | autenticacao/urls.py | LeonardoHMS/imobi | 6b2b97a05df67ea7d493f7b601382f65c6629cc2 | [
"MIT"
] | null | null | null | autenticacao/urls.py | LeonardoHMS/imobi | 6b2b97a05df67ea7d493f7b601382f65c6629cc2 | [
"MIT"
] | null | null | null | from django.urls import path
from . import views
urlpatterns = [
path('cadastro/', views.cadastro, name="Cadastro"),
path('logar/', views.logar, name="Logar"),
path('sair/', views.sair, name="sair")
] | 27.375 | 55 | 0.639269 |
ddc65ee7aed8e1303dc9deb948721e84fcc687c2 | 2,967 | py | Python | playerClass.py | TarikMetinKaya/FarkleGame | 4d9cf429734c6c0b7b2f866d3e2c3ec0a1c8271c | [
"MIT"
] | null | null | null | playerClass.py | TarikMetinKaya/FarkleGame | 4d9cf429734c6c0b7b2f866d3e2c3ec0a1c8271c | [
"MIT"
] | null | null | null | playerClass.py | TarikMetinKaya/FarkleGame | 4d9cf429734c6c0b7b2f866d3e2c3ec0a1c8271c | [
"MIT"
] | null | null | null | from diceClass import Dice
class Player:
point = 0
processedDices = []
selectedDices = []
def __init__(self, point):
self.point = point
def throwDice(self, count):
throwedDice=[]
a= Dice()
for i in range(count):
(Dice.rollDice(a))
throwedDice... | 24.932773 | 50 | 0.469161 |
fb269e2ecf6c2935d989f3e1a94453136ec48faa | 8,625 | py | Python | src/onegov/user/cli.py | politbuero-kampagnen/onegov-cloud | 20148bf321b71f617b64376fe7249b2b9b9c4aa9 | [
"MIT"
] | null | null | null | src/onegov/user/cli.py | politbuero-kampagnen/onegov-cloud | 20148bf321b71f617b64376fe7249b2b9b9c4aa9 | [
"MIT"
] | null | null | null | src/onegov/user/cli.py | politbuero-kampagnen/onegov-cloud | 20148bf321b71f617b64376fe7249b2b9b9c4aa9 | [
"MIT"
] | null | null | null | """ Provides commands used to manage users.
Examples:
To add a user called ``admin@example.org`` to the ``towns-govikon`` schema,
with the role 'admin'::
dsn=postgres://user:password@localhost:5432/database
schema=towns-govikon
onegov-user --dsn $dsn --schema $schema add admin admin@example.org
This com... | 29.639175 | 79 | 0.617507 |
9b27c12a23aa6e9a9ea8a5cb7455c25d2dd55677 | 1,734 | py | Python | task_1/similarity/aggregate_events.py | strumswell/sentiment-apple-events | b6f4f7799374aba757874f5426b3a2c1bf7d29b5 | [
"MIT"
] | 1 | 2022-02-28T22:02:50.000Z | 2022-02-28T22:02:50.000Z | task_1/similarity/aggregate_events.py | strumswell/sentiment-apple-events | b6f4f7799374aba757874f5426b3a2c1bf7d29b5 | [
"MIT"
] | null | null | null | task_1/similarity/aggregate_events.py | strumswell/sentiment-apple-events | b6f4f7799374aba757874f5426b3a2c1bf7d29b5 | [
"MIT"
] | null | null | null | #%% Import modul
import pandas as pd
# %% Read documents
events = ['2020_Nov_Post', '2020_Nov', '2020_Nov_Pre', '2020_Oct_Post', '2020_Oct', '2020_Oct_Pre', '2020_Sept_Post', '2020_Sept', '2020_Sept_Pre', '2020_Jun_Post', '2020_Jun', '2020_Jun_Pre', '2019_Sept_Post', '2019_Sept', '2019_Sept_Pre', '2019_Jun', '2019_Jun... | 37.695652 | 463 | 0.690311 |
fd4516aff9ab6892208076844819bd5c98997093 | 955 | py | Python | run_all_fr_evaluations.py | habecker/transfer-gan | b935e69d0fa0d37ba80aab091ce59e1657eacb1e | [
"BSD-3-Clause"
] | null | null | null | run_all_fr_evaluations.py | habecker/transfer-gan | b935e69d0fa0d37ba80aab091ce59e1657eacb1e | [
"BSD-3-Clause"
] | 5 | 2021-03-19T14:21:08.000Z | 2022-03-12T00:42:00.000Z | run_all_fr_evaluations.py | habecker/transfer-gan | b935e69d0fa0d37ba80aab091ce59e1657eacb1e | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
import argparse, os, glob
parser = argparse.ArgumentParser(description='Evaluation')
parser.add_argument('--results_dir', type=str, default='./results/', help='')
parser.add_argument('--model_name', type=str, required=True)
opts = parser.parse_args()
for fp in glob.glob(os.path.join(opts.result... | 56.176471 | 140 | 0.721466 |
2f224bee1b91b69065f3b6a410de85038fde1ea6 | 519 | py | Python | Hackerrank_problems/kangaroo/solution.py | gbrls/CompetitiveCode | b6f1b817a655635c3c843d40bd05793406fea9c6 | [
"MIT"
] | 205 | 2021-09-30T15:41:05.000Z | 2022-03-27T18:34:56.000Z | Hackerrank_problems/kangaroo/solution.py | gbrls/CompetitiveCode | b6f1b817a655635c3c843d40bd05793406fea9c6 | [
"MIT"
] | 566 | 2021-09-30T15:27:27.000Z | 2021-10-16T21:21:02.000Z | Hackerrank_problems/kangaroo/solution.py | gbrls/CompetitiveCode | b6f1b817a655635c3c843d40bd05793406fea9c6 | [
"MIT"
] | 399 | 2021-09-29T05:40:46.000Z | 2022-03-27T18:34:58.000Z | # Logic:
# The required result is simply the solution of the equations
# x1 + y*v1 = x2 + y*v2 (where y is the number of jumps)
# which is same as checking if (x1-x2)%(v2-v1)==0
def kangaroo(x1, v1, x2, v2):
return "YES" if (v1 > v2) and not (x2 - x1) % (v2 - v1) else "NO"
if __name__ == '__main__':
# inpu... | 19.222222 | 69 | 0.587669 |
23c9950a04e8c3e9ee18237de79f4c0122e520b6 | 1,070 | py | Python | termuxtbb-master/kumpulanremaja.py | Zusyaku/Termux-And-Lali-Linux-V2 | b1a1b0841d22d4bf2cc7932b72716d55f070871e | [
"Apache-2.0"
] | 2 | 2021-11-17T03:35:03.000Z | 2021-12-08T06:00:31.000Z | termuxtbb-master/kumpulanremaja.py | Zusyaku/Termux-And-Lali-Linux-V2 | b1a1b0841d22d4bf2cc7932b72716d55f070871e | [
"Apache-2.0"
] | null | null | null | termuxtbb-master/kumpulanremaja.py | Zusyaku/Termux-And-Lali-Linux-V2 | b1a1b0841d22d4bf2cc7932b72716d55f070871e | [
"Apache-2.0"
] | 2 | 2021-11-05T18:07:48.000Z | 2022-02-24T21:25:07.000Z | import os
from time import sleep
a ='\033[92m'
b ='\033[91m'
c ='\033[0m'
os.system('clear')
print(a+'\t Tombol Tambahan Termux ')
print(a+'\t UP,Down,right,Left, CTRL ')
print(b+'\t Bye: Kumpulan Remaja')
print('\t web : Kumpulanremaja.com')
print('\t Facebook : fb.me/4Kumpulanremaja')
print('\t Github : https:... | 26.75 | 113 | 0.646729 |
23cb966bc6e7ee32d0c708479040d755456b243a | 1,742 | py | Python | research/cv/vnet/preprocess.py | leelige/mindspore | 5199e05ba3888963473f2b07da3f7bca5b9ef6dc | [
"Apache-2.0"
] | 77 | 2021-10-15T08:32:37.000Z | 2022-03-30T13:09:11.000Z | research/cv/vnet/preprocess.py | leelige/mindspore | 5199e05ba3888963473f2b07da3f7bca5b9ef6dc | [
"Apache-2.0"
] | 3 | 2021-10-30T14:44:57.000Z | 2022-02-14T06:57:57.000Z | research/cv/vnet/preprocess.py | leelige/mindspore | 5199e05ba3888963473f2b07da3f7bca5b9ef6dc | [
"Apache-2.0"
] | 24 | 2021-10-15T08:32:45.000Z | 2022-03-24T18:45:20.000Z | # Copyright 2021 Huawei Technologies Co., Ltd
#
# 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... | 44.666667 | 111 | 0.695178 |
9e27ef9c7772e61c539c074abd3e4b75164d079a | 1,423 | py | Python | Kaggle-Competitions/Rossman-Stores-Sales/scripts/helper.py | gopala-kr/ds-notebooks | bc35430ecdd851f2ceab8f2437eec4d77cb59423 | [
"MIT"
] | 1 | 2019-05-10T09:16:23.000Z | 2019-05-10T09:16:23.000Z | Kaggle-Competitions/Rossman-Stores-Sales/scripts/helper.py | gopala-kr/ds-notebooks | bc35430ecdd851f2ceab8f2437eec4d77cb59423 | [
"MIT"
] | null | null | null | Kaggle-Competitions/Rossman-Stores-Sales/scripts/helper.py | gopala-kr/ds-notebooks | bc35430ecdd851f2ceab8f2437eec4d77cb59423 | [
"MIT"
] | 1 | 2019-10-14T07:30:18.000Z | 2019-10-14T07:30:18.000Z | import numpy as np
import pandas as pd
from sklearn.preprocessing import LabelEncoder
def ToWeight(y):
w = np.zeros(y.shape, dtype=float)
ind = y != 0
w[ind] = 1./(y[ind]**2)
return w
def rmspe(yhat, y):
w = ToWeight(y)
rmspe = np.sqrt(np.mean( w * (y - yhat)**2 ))
return rmspe
def r... | 22.587302 | 74 | 0.623331 |
9e4c5169ebb44849d89fbfa433e423c5b7117d08 | 1,461 | py | Python | NaiveBayes/src/mushroom.py | quqixun/MLAlgorithms | 1ad46a899a6280a08c196fb4eb0931408c8636c7 | [
"MIT"
] | 2 | 2018-04-25T18:00:28.000Z | 2018-08-08T09:39:18.000Z | NaiveBayes/src/mushroom.py | quqixun/MLAlgorithms | 1ad46a899a6280a08c196fb4eb0931408c8636c7 | [
"MIT"
] | null | null | null | NaiveBayes/src/mushroom.py | quqixun/MLAlgorithms | 1ad46a899a6280a08c196fb4eb0931408c8636c7 | [
"MIT"
] | 2 | 2019-03-03T02:55:48.000Z | 2021-01-21T04:50:46.000Z | # Conventional Machine Learning Algorithms
# Test script for Class of "NaiveBayes" on Mushroom dataset.
# on Mushroom Dataset.
# Author: Qixun Qu
# Create on: 2018/04/25
# Modify on: 2018/04/25
# ,,, ,,,
# ;" '; ;' ",
# ; @.ss$$$$$$s.@ ;
# `s$$$$$$$$$$$$$$$'
# $$$$$$$$$$$$$$$$$$
# $$$$P"... | 23.564516 | 66 | 0.608487 |
9e9f0ad9bee627851ca76759f27237699980da0e | 599 | py | Python | frappe-bench/apps/erpnext/erpnext/regional/france/utils.py | Semicheche/foa_frappe_docker | a186b65d5e807dd4caf049e8aeb3620a799c1225 | [
"MIT"
] | null | null | null | frappe-bench/apps/erpnext/erpnext/regional/france/utils.py | Semicheche/foa_frappe_docker | a186b65d5e807dd4caf049e8aeb3620a799c1225 | [
"MIT"
] | null | null | null | frappe-bench/apps/erpnext/erpnext/regional/france/utils.py | Semicheche/foa_frappe_docker | a186b65d5e807dd4caf049e8aeb3620a799c1225 | [
"MIT"
] | null | null | null | # Copyright (c) 2018, Frappe Technologies and contributors
# For license information, please see license.txt
import frappe
from frappe import _
from erpnext import get_region
def create_transaction_log(doc, method):
region = get_region()
if region not in ["France"]:
return
else:
data = str(doc.as_dict())
fr... | 23.038462 | 58 | 0.72621 |
8d98934e6be5520fcfe43b3b3e3b1720a496037b | 942 | py | Python | research/cv/DDM/utils/func.py | leelige/mindspore | 5199e05ba3888963473f2b07da3f7bca5b9ef6dc | [
"Apache-2.0"
] | 77 | 2021-10-15T08:32:37.000Z | 2022-03-30T13:09:11.000Z | research/cv/DDM/utils/func.py | leelige/mindspore | 5199e05ba3888963473f2b07da3f7bca5b9ef6dc | [
"Apache-2.0"
] | 3 | 2021-10-30T14:44:57.000Z | 2022-02-14T06:57:57.000Z | research/cv/DDM/utils/func.py | leelige/mindspore | 5199e05ba3888963473f2b07da3f7bca5b9ef6dc | [
"Apache-2.0"
] | 24 | 2021-10-15T08:32:45.000Z | 2022-03-24T18:45:20.000Z | # Copyright 2021 Huawei Technologies Co., Ltd
#
# 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... | 36.230769 | 83 | 0.64862 |
93bdef4c1ffacff3d1ca2fae1594d3677c5dc36d | 1,989 | py | Python | hardware/chip/espressif_esp32/esp-idf/components/tinyusb/tinyusb/tools/build_all.py | wstong999/AliOS-Things | 6554769cb5b797e28a30a4aa89b3f4cb2ef2f5d9 | [
"Apache-2.0"
] | null | null | null | hardware/chip/espressif_esp32/esp-idf/components/tinyusb/tinyusb/tools/build_all.py | wstong999/AliOS-Things | 6554769cb5b797e28a30a4aa89b3f4cb2ef2f5d9 | [
"Apache-2.0"
] | null | null | null | hardware/chip/espressif_esp32/esp-idf/components/tinyusb/tinyusb/tools/build_all.py | wstong999/AliOS-Things | 6554769cb5b797e28a30a4aa89b3f4cb2ef2f5d9 | [
"Apache-2.0"
] | null | null | null | import os
import shutil
import sys
import subprocess
import time
travis = False
if "TRAVIS" in os.environ and os.environ["TRAVIS"] == "true":
travis = True
success_count = 0
fail_count = 0
exit_status = 0
all_device_example = ["cdc_msc_hid", "hid_generic_inout", "midi_test", "msc_dual_lun"]
all_boards = []
for ... | 32.606557 | 158 | 0.672197 |
198b0ec5a89105b759f8e21a39817da06d43338e | 5,021 | py | Python | listings/chapter05/band.py | SaschaKersken/Daten-Prozessanalyse | 370f07a75b9465329deb3671adbfbef8483f76f6 | [
"Apache-2.0"
] | 2 | 2021-09-20T06:16:41.000Z | 2022-01-17T14:24:43.000Z | listings/chapter05/band.py | SaschaKersken/Daten-Prozessanalyse | 370f07a75b9465329deb3671adbfbef8483f76f6 | [
"Apache-2.0"
] | null | null | null | listings/chapter05/band.py | SaschaKersken/Daten-Prozessanalyse | 370f07a75b9465329deb3671adbfbef8483f76f6 | [
"Apache-2.0"
] | null | null | null | from sys import exit
from csp import CSP
"""Bonus:
Lösung des Logikrätsels "Die Band" von Jonas Sandrock
https://www.logisch-gedacht.de/logikraetsel/band/
"""
# Konstanten zum einfachen Zugriff auf die 4 Elemente der Tupel
AGE = 0
INSTRUMENT = 1
POSITION = 2
PANTS_COLOR = 3
# Die möglichen Einzelwerte der Domänen
ag... | 42.91453 | 106 | 0.687712 |
19a0d3b345027bf47d6e304250ab0e4b8e5e86f5 | 2,643 | py | Python | imdb.py | diedoman/PhaseFour | 5243835e05750498b6963a82793c6838f49b4086 | [
"MIT"
] | null | null | null | imdb.py | diedoman/PhaseFour | 5243835e05750498b6963a82793c6838f49b4086 | [
"MIT"
] | null | null | null | imdb.py | diedoman/PhaseFour | 5243835e05750498b6963a82793c6838f49b4086 | [
"MIT"
] | null | null | null | import requests, json, time
import os.path
class tvdbAPI():
URL_base = 'https://api.thetvdb.com'
favorites = 'favorites.txt'
def __init__(self,apiKey,username,userkey):
print("Generating new connection with tvdb. Logging in...")
self.token = ''
self.apiKey = apiKey
self.username = username
sel... | 36.205479 | 111 | 0.67272 |
5ff7bca8269e568afaafef46678fd08ff57851b4 | 2,177 | py | Python | src/onegov/swissvotes/layouts/__init__.py | politbuero-kampagnen/onegov-cloud | 20148bf321b71f617b64376fe7249b2b9b9c4aa9 | [
"MIT"
] | null | null | null | src/onegov/swissvotes/layouts/__init__.py | politbuero-kampagnen/onegov-cloud | 20148bf321b71f617b64376fe7249b2b9b9c4aa9 | [
"MIT"
] | null | null | null | src/onegov/swissvotes/layouts/__init__.py | politbuero-kampagnen/onegov-cloud | 20148bf321b71f617b64376fe7249b2b9b9c4aa9 | [
"MIT"
] | null | null | null | from onegov.swissvotes.layouts.default import DefaultLayout
from onegov.swissvotes.layouts.mail import MailLayout
from onegov.swissvotes.layouts.page import AddPageLayout
from onegov.swissvotes.layouts.page import DeletePageAttachmentLayout
from onegov.swissvotes.layouts.page import DeletePageLayout
from onegov.swissvo... | 41.865385 | 74 | 0.833716 |
fd7e92074ccbf53d607a1da1a8ef702275c1cd63 | 1,162 | py | Python | test.py | LosWochos76/haushalt_wetter_extractor | 1132c38ed3fd132262b7263368db7a7eebe6086d | [
"MIT"
] | null | null | null | test.py | LosWochos76/haushalt_wetter_extractor | 1132c38ed3fd132262b7263368db7a7eebe6086d | [
"MIT"
] | null | null | null | test.py | LosWochos76/haushalt_wetter_extractor | 1132c38ed3fd132262b7263368db7a7eebe6086d | [
"MIT"
] | null | null | null | import unittest
import requests
from budget import Budget
class TestBudget(unittest.TestCase):
def setUp(self):
url = 'https://www.stadt-wetter.de/fileadmin/user_upload/Dokumente/Fachbereich_1/2021_-_Haushaltsplanentwurf.pdf'
r = requests.get(url, allow_redirects=True)
file = open('Haushalt... | 36.3125 | 121 | 0.64716 |
8b9ad99a4c0cc4f2802f89f669162e13c686bda2 | 359 | py | Python | comp/microsoft/008_new_string_without_3_same_cons_letters_by_deletion.py | cc13ny/all-in | bc0b01e44e121ea68724da16f25f7e24386c53de | [
"MIT"
] | 1 | 2015-12-16T04:01:03.000Z | 2015-12-16T04:01:03.000Z | comp/microsoft/008_new_string_without_3_same_cons_letters_by_deletion.py | cc13ny/all-in | bc0b01e44e121ea68724da16f25f7e24386c53de | [
"MIT"
] | 1 | 2016-02-09T06:00:07.000Z | 2016-02-09T07:20:13.000Z | comp/microsoft/008_new_string_without_3_same_cons_letters_by_deletion.py | cc13ny/all-in | bc0b01e44e121ea68724da16f25f7e24386c53de | [
"MIT"
] | 2 | 2019-06-27T09:07:26.000Z | 2019-07-01T04:40:13.000Z | class Solution:
def new_str(self, s):
if not s or len(s) < 3:
return s
res = s[0]
cnt = 1
i = 1
while i < len(s):
if s[i] == res[-1]:
cnt += 1
else:
cnt = 1
if cnt < 3:
res += s[i]... | 21.117647 | 31 | 0.309192 |
8bcdec9ca5adcb4d5dfe9dde770de66fc3ad9ae2 | 56 | py | Python | echo_adelle.py | EmanuelDms/automation | 25a0f370f40aa955225d7c3a1e28c2d8cc988689 | [
"MIT"
] | null | null | null | echo_adelle.py | EmanuelDms/automation | 25a0f370f40aa955225d7c3a1e28c2d8cc988689 | [
"MIT"
] | null | null | null | echo_adelle.py | EmanuelDms/automation | 25a0f370f40aa955225d7c3a1e28c2d8cc988689 | [
"MIT"
] | null | null | null | import os
os.system("echo Hello from the other side!")
| 14 | 44 | 0.732143 |
4748b35c8160336fc4f1a8deab918e36b9e8cbef | 3,875 | py | Python | pkg/pkg/data/load_data.py | tliu68/maggot_connectome | ef4bbd2011fa9e03da187fcca8c8c1ca79209a36 | [
"MIT"
] | null | null | null | pkg/pkg/data/load_data.py | tliu68/maggot_connectome | ef4bbd2011fa9e03da187fcca8c8c1ca79209a36 | [
"MIT"
] | null | null | null | pkg/pkg/data/load_data.py | tliu68/maggot_connectome | ef4bbd2011fa9e03da187fcca8c8c1ca79209a36 | [
"MIT"
] | null | null | null | import json
from pathlib import Path
import networkx as nx
import numpy as np
import pandas as pd
from sklearn.utils import Bunch
from ..graph import MaggotGraph
from ..utils import to_pandas_edgelist
DATA_VERSION = "2021-03-10" # set to whatever the most recent one is
DATA_PATH = Path(__file__).parent.parent.pare... | 31 | 88 | 0.682581 |
478fb79cb9eabd85b9cd8f9839fd55d99c790028 | 918 | py | Python | Topics/Sorting/Merge-Sort/merge-sort.py | shihab4t/Competitive-Programming | e8eec7d4f7d86bfa1c00b7fbbedfd6a1518f19be | [
"Unlicense"
] | 3 | 2021-06-15T01:19:23.000Z | 2022-03-16T18:23:53.000Z | Topics/Sorting/Merge-Sort/merge-sort.py | shihab4t/Competitive-Programming | e8eec7d4f7d86bfa1c00b7fbbedfd6a1518f19be | [
"Unlicense"
] | null | null | null | Topics/Sorting/Merge-Sort/merge-sort.py | shihab4t/Competitive-Programming | e8eec7d4f7d86bfa1c00b7fbbedfd6a1518f19be | [
"Unlicense"
] | null | null | null | def merge_sort(a: list, first: int, last: int) -> None:
"Sort Given a list of elements with O(n*log(n)) complexity"
if last == first:
return
mid = first + ((last - first) // 2)
merge_sort(a, first, mid)
merge_sort(a, mid+1, last)
len = last - first + 1
sort_list = []
j, k = fi... | 22.95 | 63 | 0.476035 |
ef288eea56edf02003ce97365268a684b3e13ae6 | 3,207 | py | Python | src/train.py | xbelda/movielens-recommender | 1e1335e2a2b9f57b948916ff415af149938caa33 | [
"MIT"
] | null | null | null | src/train.py | xbelda/movielens-recommender | 1e1335e2a2b9f57b948916ff415af149938caa33 | [
"MIT"
] | null | null | null | src/train.py | xbelda/movielens-recommender | 1e1335e2a2b9f57b948916ff415af149938caa33 | [
"MIT"
] | null | null | null | # Bibliography
# - [Collaborative Filtering for Movie Recommendations](https://keras.io/examples/structured_data/collaborative_filtering_movielens/)
# - [Getting Started with a Movie Recommendation System](https://www.kaggle.com/ibtesama/getting-started-with-a-movie-recommendation-system#Content-Based-Filtering)
# - [C... | 50.904762 | 164 | 0.590583 |
08b29c0ea61a8b5bbf60ccff14b6571f95d5a3ee | 21,596 | py | Python | gfbs.py | CityU-AIM-Group/GFBS | d71361243f1bcf699e1a20b312b05fe0be4dfd6d | [
"MIT"
] | null | null | null | gfbs.py | CityU-AIM-Group/GFBS | d71361243f1bcf699e1a20b312b05fe0be4dfd6d | [
"MIT"
] | null | null | null | gfbs.py | CityU-AIM-Group/GFBS | d71361243f1bcf699e1a20b312b05fe0be4dfd6d | [
"MIT"
] | 1 | 2021-12-19T12:31:05.000Z | 2021-12-19T12:31:05.000Z | '''Train CIFAR10 with PyTorch.'''
import torch
import logging
import datasets
import numpy as np
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import torchvision
from torch.optim.lr_scheduler import MultiStepLR
from torch.utils.tensorboard import SummaryWriter
from torchsummary impor... | 44.712215 | 186 | 0.610576 |
eb196b5a06a06398ba3e6645a5ef2228577b6659 | 1,253 | py | Python | nz_django/day6/model_form_demo/front/forms.py | gaohj/nzflask_bbs | 36a94c380b78241ed5d1e07edab9618c3e8d477b | [
"Apache-2.0"
] | null | null | null | nz_django/day6/model_form_demo/front/forms.py | gaohj/nzflask_bbs | 36a94c380b78241ed5d1e07edab9618c3e8d477b | [
"Apache-2.0"
] | 27 | 2020-02-12T07:55:58.000Z | 2022-03-12T00:19:09.000Z | nz_django/day6/model_form_demo/front/forms.py | gaohj/nzflask_bbs | 36a94c380b78241ed5d1e07edab9618c3e8d477b | [
"Apache-2.0"
] | 2 | 2020-02-18T01:54:55.000Z | 2020-02-21T11:36:28.000Z | from django import forms
from .models import User,Book
#原来继承于forms.Form
class AddBookForm(forms.ModelForm):
def clean_page(self):
page = self.cleaned_data.get('page')
if page > 108:
raise forms.ValidationError('页数不能大于108')
return page
class Meta:
model = Book
... | 28.477273 | 56 | 0.550678 |
de86655f8b6cca17beab53dd16e0e2e62667a3a0 | 91 | py | Python | kuontest/apps.py | ykomashiro/webtest | 2587d14de7ae9107e8d7d98c1db90f0a9608177e | [
"MIT"
] | null | null | null | kuontest/apps.py | ykomashiro/webtest | 2587d14de7ae9107e8d7d98c1db90f0a9608177e | [
"MIT"
] | null | null | null | kuontest/apps.py | ykomashiro/webtest | 2587d14de7ae9107e8d7d98c1db90f0a9608177e | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class KuontestConfig(AppConfig):
name = 'kuontest'
| 15.166667 | 33 | 0.758242 |
19db0893df0623a3c1e3312b80ae6e7daf58923e | 60 | py | Python | hardware/rider_device/rider_device.py | BlueHC/TTHack-2018--Easy-Rider-1 | 8cd8f66de88ff80751a1083350c38985ac26914d | [
"Apache-2.0"
] | null | null | null | hardware/rider_device/rider_device.py | BlueHC/TTHack-2018--Easy-Rider-1 | 8cd8f66de88ff80751a1083350c38985ac26914d | [
"Apache-2.0"
] | null | null | null | hardware/rider_device/rider_device.py | BlueHC/TTHack-2018--Easy-Rider-1 | 8cd8f66de88ff80751a1083350c38985ac26914d | [
"Apache-2.0"
] | null | null | null | import tid_creator
print(tid_creator.create_tid(123456789)) | 20 | 40 | 0.866667 |
c200c76da7bd3836577f6f1e4a58713fb79d953b | 39 | py | Python | lib/python3.5/_weakrefset.py | hwroitzsch/BikersLifeSaver | 469c738fdd6352c44a3f20689b17fa8ac04ad8a2 | [
"MIT"
] | 1 | 2020-08-16T04:04:23.000Z | 2020-08-16T04:04:23.000Z | lib/python3.5/_weakrefset.py | hwroitzsch/BikersLifeSaver | 469c738fdd6352c44a3f20689b17fa8ac04ad8a2 | [
"MIT"
] | 5 | 2020-06-05T18:53:24.000Z | 2021-12-13T19:49:15.000Z | lib/python3.5/_weakrefset.py | hwroitzsch/BikersLifeSaver | 469c738fdd6352c44a3f20689b17fa8ac04ad8a2 | [
"MIT"
] | null | null | null | /usr/local/lib/python3.5/_weakrefset.py | 39 | 39 | 0.820513 |
264289f36a5175989783a42d404e519b751958e1 | 928 | py | Python | source/pkgsrc/chat/matrix-synapse/patches/patch-synapse_handlers_room.py | Scottx86-64/dotfiles-1 | 51004b1e2b032664cce6b553d2052757c286087d | [
"Unlicense"
] | 1 | 2021-11-20T22:46:39.000Z | 2021-11-20T22:46:39.000Z | source/pkgsrc/chat/matrix-synapse/patches/patch-synapse_handlers_room.py | Scottx86-64/dotfiles-1 | 51004b1e2b032664cce6b553d2052757c286087d | [
"Unlicense"
] | null | null | null | source/pkgsrc/chat/matrix-synapse/patches/patch-synapse_handlers_room.py | Scottx86-64/dotfiles-1 | 51004b1e2b032664cce6b553d2052757c286087d | [
"Unlicense"
] | null | null | null | $NetBSD: patch-synapse_handlers_room.py,v 1.2 2021/08/31 19:57:59 js Exp $
This patch allows changing the default power level for the creator of a new
room. It's useful to set this higher than 100 so that the creator of the room
can give admin to others while still retaining the ability to revoke admin from
someone. I... | 46.4 | 79 | 0.659483 |
3e78c2f99fc48281e7ae16b21f6cc58813e7fc2f | 2,109 | py | Python | roboraptorz/client/mqttApp/mqttapp.py | icebear8/roboRinth | c0789a9faf978f31b0ed020d26fee2b04fb298ee | [
"MIT"
] | null | null | null | roboraptorz/client/mqttApp/mqttapp.py | icebear8/roboRinth | c0789a9faf978f31b0ed020d26fee2b04fb298ee | [
"MIT"
] | null | null | null | roboraptorz/client/mqttApp/mqttapp.py | icebear8/roboRinth | c0789a9faf978f31b0ed020d26fee2b04fb298ee | [
"MIT"
] | 1 | 2019-10-22T07:47:51.000Z | 2019-10-22T07:47:51.000Z | #!/usr/bin/env python
import argparse
import logging
import sys
import time
from MqttClient import MqttClient
from Control import *
from MapMatcher import *
from RoboDriver import *
logger = logging.getLogger(__name__)
client = None
def _initializeLogging(loglevel):
numeric_level = getattr(l... | 30.128571 | 134 | 0.706022 |
9026411be5b48ace4415fc1768b26cac9519430e | 935 | py | Python | 2265-count-nodes-equal-to-average-of-subtree/2265-count-nodes-equal-to-average-of-subtree.py | hyeseonko/LeetCode | 48dfc93f1638e13041d8ce1420517a886abbdc77 | [
"MIT"
] | 2 | 2021-12-05T14:29:06.000Z | 2022-01-01T05:46:13.000Z | 2265-count-nodes-equal-to-average-of-subtree/2265-count-nodes-equal-to-average-of-subtree.py | hyeseonko/LeetCode | 48dfc93f1638e13041d8ce1420517a886abbdc77 | [
"MIT"
] | null | null | null | 2265-count-nodes-equal-to-average-of-subtree/2265-count-nodes-equal-to-average-of-subtree.py | hyeseonko/LeetCode | 48dfc93f1638e13041d8ce1420517a886abbdc77 | [
"MIT"
] | null | null | null | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
# Reference
# Inspired by this solution: https://leetcode.com/problems/count-nodes-equal-to-average-of-subtree/discuss/2018060/... | 32.241379 | 150 | 0.561497 |
398088bacdc4eb87ef756b19e8d468951f08844d | 2,172 | py | Python | blockchain/metis.py | yashpatel5400/anonychain | 921804832839f3639477cfc441f138bc2f5ad685 | [
"MIT"
] | 1 | 2018-08-31T07:16:40.000Z | 2018-08-31T07:16:40.000Z | blockchain/metis.py | yashpatel5400/anonychain | 921804832839f3639477cfc441f138bc2f5ad685 | [
"MIT"
] | null | null | null | blockchain/metis.py | yashpatel5400/anonychain | 921804832839f3639477cfc441f138bc2f5ad685 | [
"MIT"
] | 1 | 2018-07-01T18:03:01.000Z | 2018-07-01T18:03:01.000Z | """
__author__ = Yash Patel
__name__ = metis.py
__description__ = Formats the raw blockchain graph data into the format required for
analysis by the METIS package
"""
import subprocess
import pickle
import networkx as nx
from scipy.sparse import dok_matrix, csr_matrix
import matplotlib
matplotlib.use('Ag... | 35.032258 | 85 | 0.633057 |
f2411236af32920263f33c13cab1db3eddf0ff6e | 1,883 | py | Python | tools/my-tools/wechat-assistant/v1/bot.py | iamjoel/tools-and-material | e206bf4113f1b4eb83a32326503459b4818ba76d | [
"MIT"
] | 9 | 2018-07-31T04:49:39.000Z | 2019-11-04T10:06:04.000Z | tools/my-tools/wechat-assistant/v1/bot.py | iamjoel/tools | e206bf4113f1b4eb83a32326503459b4818ba76d | [
"MIT"
] | 6 | 2020-02-10T14:46:57.000Z | 2022-02-13T05:50:12.000Z | tools/my-tools/wechat-assistant/v1/bot.py | iamjoel/tools-and-material | e206bf4113f1b4eb83a32326503459b4818ba76d | [
"MIT"
] | 5 | 2019-02-19T09:26:58.000Z | 2019-10-29T05:00:31.000Z | #!/usr/bin/python
# -*- coding:UTF-8 -*-
from wxpy import *
import re
# 初始化机器人,扫码登陆
bot = Bot()
apiKey = '去 http://www.tuling123.com/ 上去申请'
bot.enable_puid('wxpy_puid.pkl') # 不加参数,puid 会变。。。
# 新人入群的欢迎语
welcome_text = '''🎉 欢迎 @{} 的加入!
来做个简单的自我介绍吧~
'''
# 需管理的微信群
intro = '''
我是九彩拼盘大人的前端小助手~
发送:
入门:进入前端入门群交流
进阶:进入前... | 17.598131 | 56 | 0.655868 |
f29781b5f2114109bb2be12a105361b18131c375 | 338 | py | Python | project/cli/cache.py | DanielGrams/gsevp | e94034f7b64de76f38754b56455e83092378261f | [
"MIT"
] | 1 | 2021-06-01T14:49:18.000Z | 2021-06-01T14:49:18.000Z | project/cli/cache.py | DanielGrams/gsevp | e94034f7b64de76f38754b56455e83092378261f | [
"MIT"
] | 286 | 2020-12-04T14:13:00.000Z | 2022-03-09T19:05:16.000Z | project/cli/cache.py | DanielGrams/gsevpt | a92f71694388e227e65ed1b24446246ee688d00e | [
"MIT"
] | null | null | null | import click
from flask.cli import AppGroup
from project import app, img_path
from project.utils import clear_files_in_dir
cache_cli = AppGroup("cache")
@cache_cli.command("clear-images")
def clear_images():
click.echo("Clearing images..")
clear_files_in_dir(img_path)
click.echo("Done.")
app.cli.add_c... | 18.777778 | 44 | 0.760355 |
4b3f3b3da9643e88a38cd46151d682f8a42d2620 | 720 | py | Python | Welp/utils/setup_db.py | kkysen/Soft-Dev | b19881b1fcc9c7daefc817e6b975ff6bce545d81 | [
"Apache-2.0"
] | null | null | null | Welp/utils/setup_db.py | kkysen/Soft-Dev | b19881b1fcc9c7daefc817e6b975ff6bce545d81 | [
"Apache-2.0"
] | null | null | null | Welp/utils/setup_db.py | kkysen/Soft-Dev | b19881b1fcc9c7daefc817e6b975ff6bce545d81 | [
"Apache-2.0"
] | null | null | null | import sqlite3
import os
def initialize():
os.remove("data/database.db")
db = sqlite3.connect("data/database.db")
c = db.cursor()
c.execute('CREATE TABLE IF NOT EXISTS '
'accounts('
'username TEXT PRIMARY KEY, '
'password TEXT)')
c.execute('CREAT... | 23.225806 | 44 | 0.494444 |
29feb30fb826d6789f520cc3d52d9837260fd84f | 45,854 | py | Python | picoffee.py | Hofei90/picoffee | 6b2a00f2b4631790b90495d736afeb331d759241 | [
"MIT"
] | 3 | 2019-05-04T21:34:33.000Z | 2022-01-25T10:00:25.000Z | picoffee.py | Hofei90/picoffee | 6b2a00f2b4631790b90495d736afeb331d759241 | [
"MIT"
] | 4 | 2019-04-11T05:03:55.000Z | 2020-07-09T06:52:58.000Z | picoffee.py | Hofei90/picoffee | 6b2a00f2b4631790b90495d736afeb331d759241 | [
"MIT"
] | 1 | 2020-02-13T19:04:31.000Z | 2020-02-13T19:04:31.000Z | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# Script zur Kaffeekontrolle
import datetime
import os
import random
import shlex
import subprocess
import time
import signal
from sys import exit
import gpiozero
from RPLCD.i2c import CharLCD
from pirc522 import RFID
import Xtendgpiozero.buttonxtendgpiozero as xgpiozero
im... | 38.435876 | 120 | 0.589131 |
8ad6c9bd40bfe59e3c77701c60a27d657ddcf37f | 732 | py | Python | 2016/day05_how_about_a_nice_game_of_chess/python/src/test_solutions.py | tlake/advent-of-code | 17c729af2af5f1d95ba6ff68771a82ca6d00b05d | [
"MIT"
] | null | null | null | 2016/day05_how_about_a_nice_game_of_chess/python/src/test_solutions.py | tlake/advent-of-code | 17c729af2af5f1d95ba6ff68771a82ca6d00b05d | [
"MIT"
] | null | null | null | 2016/day05_how_about_a_nice_game_of_chess/python/src/test_solutions.py | tlake/advent-of-code | 17c729af2af5f1d95ba6ff68771a82ca6d00b05d | [
"MIT"
] | null | null | null | """Tests."""
import pytest
from part1 import PasswordFinder as PasswordFinder1
from part2 import PasswordFinder as PasswordFinder2
class TestPart1UnitTests:
"""."""
@pytest.mark.parametrize("test_input, expected", [
('abc', '18f47a30'),
])
def test_find_password(self, test_input, expected):
... | 24.4 | 60 | 0.64071 |
76eb4ed4d436f692a25081dbe8efe9a9b9a11102 | 2,818 | py | Python | Paddle_Industry_Practice_Sample_Library/Football_Action/PaddleVideo/paddlevideo/loader/pipelines/compose.py | linuxonly801/awesome-DeepLearning | b063757fa130c4d56aea5cce2e592610f1e169f9 | [
"Apache-2.0"
] | 883 | 2020-11-12T11:46:46.000Z | 2022-03-31T18:27:10.000Z | paddlevideo/loader/pipelines/compose.py | arkofgalaxy/PaddleVideo | 64251233c83b7eb681061b454da198a9082309a6 | [
"Apache-2.0"
] | 233 | 2020-12-09T06:04:59.000Z | 2022-03-28T08:16:51.000Z | paddlevideo/loader/pipelines/compose.py | arkofgalaxy/PaddleVideo | 64251233c83b7eb681061b454da198a9082309a6 | [
"Apache-2.0"
] | 225 | 2020-11-13T06:21:55.000Z | 2022-03-31T05:36:11.000Z | # Copyright (c) 2020 PaddlePaddle Authors. 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 applic... | 36.597403 | 90 | 0.586586 |
6a5a253f71ba9c9c5108c96dfff9fe7580036c75 | 626 | py | Python | Algorithms/3_Strings/6.py | abphilip-codes/Hackerrank_DSA | bb9e233d9d45c5b14c138830602695ad4113fba4 | [
"MIT"
] | 1 | 2021-11-25T13:39:30.000Z | 2021-11-25T13:39:30.000Z | Algorithms/3_Strings/6.py | abphilip-codes/Hackerrank_DSA | bb9e233d9d45c5b14c138830602695ad4113fba4 | [
"MIT"
] | null | null | null | Algorithms/3_Strings/6.py | abphilip-codes/Hackerrank_DSA | bb9e233d9d45c5b14c138830602695ad4113fba4 | [
"MIT"
] | null | null | null | # https://www.hackerrank.com/challenges/reduced-string/problem
#!/bin/python3
import math
import os
import random
import re
import sys
#
# Complete the 'superReducedString' function below.
#
# The function is expected to return a STRING.
# The function accepts STRING s as parameter.
#
def superReducedString(s,z=0):... | 18.969697 | 62 | 0.648562 |
6a6054c72078fbff7acac7d934dfb30ff3084b8b | 417 | py | Python | BIZa/2014/Zyabko_A_A/task_1_45.py | YukkaSarasti/pythonintask | eadf4245abb65f4400a3bae30a4256b4658e009c | [
"Apache-2.0"
] | null | null | null | BIZa/2014/Zyabko_A_A/task_1_45.py | YukkaSarasti/pythonintask | eadf4245abb65f4400a3bae30a4256b4658e009c | [
"Apache-2.0"
] | null | null | null | BIZa/2014/Zyabko_A_A/task_1_45.py | YukkaSarasti/pythonintask | eadf4245abb65f4400a3bae30a4256b4658e009c | [
"Apache-2.0"
] | null | null | null | # Задача 1. Вариант 45
# Напишите программу, которая будет сообщать род деятельности и псевдоним под которым скрывается Михаил Евграфович Салтыков. После вывода информации программа должна дожидаться пока пользователь нажмет Enter для выхода.
# Зябко Антон
print("Михаил Евграфович Салтыкоов-Щедриин (настоящая фамилия... | 59.571429 | 219 | 0.817746 |
7c1ac96ea9180c698b985b13936634b063fdb0ea | 4,116 | py | Python | tests/tests.py | alexandrebarbaruiva/rasa-plus | fe2ef9fcde007e42d62b38bf1afeeadd49f5ba95 | [
"MIT"
] | null | null | null | tests/tests.py | alexandrebarbaruiva/rasa-plus | fe2ef9fcde007e42d62b38bf1afeeadd49f5ba95 | [
"MIT"
] | 1 | 2020-08-08T13:00:11.000Z | 2020-08-08T13:00:11.000Z | tests/tests.py | alexandrebarbaruiva/rasa-plus | fe2ef9fcde007e42d62b38bf1afeeadd49f5ba95 | [
"MIT"
] | null | null | null | import unittest
import rasa_plus.__main__ as rasa_plus
import os
import shutil
class TestRasaPlusDomain(unittest.TestCase):
maxDiff = None
def setUp(self):
self.t_domain = "tests/test_files/domain"
return super().setUp()
def test_get_files_path_not_provided(self):
with self.asse... | 32.928 | 88 | 0.661079 |
7cb9da0a621e9cbf9ba87cc70f3aaa0b36c5b55e | 785 | py | Python | 1372/Fcat_1372_bfs.py | Leetcode-Secret-Society/warehouse | 40d7969683b1296f361e799cda37f15ceec52af8 | [
"MIT"
] | null | null | null | 1372/Fcat_1372_bfs.py | Leetcode-Secret-Society/warehouse | 40d7969683b1296f361e799cda37f15ceec52af8 | [
"MIT"
] | null | null | null | 1372/Fcat_1372_bfs.py | Leetcode-Secret-Society/warehouse | 40d7969683b1296f361e799cda37f15ceec52af8 | [
"MIT"
] | null | null | null | # Definition for a binary tree node.
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def longestZigZag(self, root: TreeNode) -> int:
max_len = 0
bfs_list = [(root, -1, 'l'), (root, -1, ... | 31.4 | 62 | 0.507006 |
6b00a5c4764fa0487343425f286f5971b386671b | 13,441 | py | Python | methods/transformers/utils/check_repo.py | INK-USC/RiddleSense | a3d57eaf084da9cf6b77692c608e2cd2870fbd97 | [
"MIT"
] | 3 | 2021-07-06T20:02:31.000Z | 2022-03-27T13:13:01.000Z | methods/transformers/utils/check_repo.py | INK-USC/RiddleSense | a3d57eaf084da9cf6b77692c608e2cd2870fbd97 | [
"MIT"
] | null | null | null | methods/transformers/utils/check_repo.py | INK-USC/RiddleSense | a3d57eaf084da9cf6b77692c608e2cd2870fbd97 | [
"MIT"
] | null | null | null | # coding=utf-8
# Copyright 2020 The HuggingFace Inc. team.
#
# 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 a... | 40.48494 | 142 | 0.654192 |
86ddef3be194e5e3d3d55dd41fb2848d19d7ba25 | 42 | py | Python | python/coding_dojang/database/sqlite/dbapi.py | zeroam/TIL | 43e3573be44c7f7aa4600ff8a34e99a65cbdc5d1 | [
"MIT"
] | null | null | null | python/coding_dojang/database/sqlite/dbapi.py | zeroam/TIL | 43e3573be44c7f7aa4600ff8a34e99a65cbdc5d1 | [
"MIT"
] | null | null | null | python/coding_dojang/database/sqlite/dbapi.py | zeroam/TIL | 43e3573be44c7f7aa4600ff8a34e99a65cbdc5d1 | [
"MIT"
] | null | null | null | def connect(database):
print(database) | 21 | 22 | 0.738095 |
07c089081e096cc5331b8206e4b9b5c5e58688e0 | 10,171 | py | Python | tests/onegov/gazette/test_views_notice_edit.py | politbuero-kampagnen/onegov-cloud | 20148bf321b71f617b64376fe7249b2b9b9c4aa9 | [
"MIT"
] | null | null | null | tests/onegov/gazette/test_views_notice_edit.py | politbuero-kampagnen/onegov-cloud | 20148bf321b71f617b64376fe7249b2b9b9c4aa9 | [
"MIT"
] | null | null | null | tests/onegov/gazette/test_views_notice_edit.py | politbuero-kampagnen/onegov-cloud | 20148bf321b71f617b64376fe7249b2b9b9c4aa9 | [
"MIT"
] | null | null | null | from freezegun import freeze_time
from tests.onegov.gazette.common import accept_notice
from tests.onegov.gazette.common import change_category
from tests.onegov.gazette.common import change_organization
from tests.onegov.gazette.common import edit_notice
from tests.onegov.gazette.common import edit_notice_unrestricted... | 39.730469 | 78 | 0.630223 |
07c14c594dd2c01e9a72d85cc6b56cf92e5d3004 | 4,922 | py | Python | notMNIST/notMNIST_linear.py | kazunori279/ml-misc | 6cf25dd44522cd49e6a1c3edff38f7dfc70cba33 | [
"Apache-2.0"
] | 31 | 2017-08-30T23:27:33.000Z | 2022-01-18T19:37:40.000Z | notMNIST/notMNIST_linear.py | kazunori279/ml-misc | 6cf25dd44522cd49e6a1c3edff38f7dfc70cba33 | [
"Apache-2.0"
] | null | null | null | notMNIST/notMNIST_linear.py | kazunori279/ml-misc | 6cf25dd44522cd49e6a1c3edff38f7dfc70cba33 | [
"Apache-2.0"
] | 15 | 2017-10-16T01:15:44.000Z | 2021-12-24T03:36:11.000Z |
# retrieving training file names
import re
from google.cloud import storage
GCS_BUCKET = "gcp-samples2-misc"
# GCS_DATA_DIR = "notMNIST_large_test"
GCS_DATA_DIR = "notMNIST_small"
#GCS_DATA_DIR = "notMNIST_large"
TRAIN_STEPS = 10
TRAIN_BATCH_SIZE = 100
def list_files_and_labels():
# get all filenames and labels ... | 33.256757 | 121 | 0.741568 |
07db799fe4104958f3a8733108f4614c6063b876 | 36 | py | Python | tests/__init__.py | ska-telescope/sdp-config | c4377c4fb0cfbad805b58163c1559fd7a574029e | [
"BSD-3-Clause"
] | 2 | 2019-07-15T09:49:34.000Z | 2019-10-14T16:04:17.000Z | tests/__init__.py | ska-telescope/sdp-config | c4377c4fb0cfbad805b58163c1559fd7a574029e | [
"BSD-3-Clause"
] | 17 | 2019-07-15T14:51:50.000Z | 2021-06-02T00:29:43.000Z | src/config_db/tests/__init__.py | ska-telescope/sdp-configuration-prototype | 8c6cbda04a83b0e16987019406ed6ec7e1058a31 | [
"BSD-3-Clause"
] | 1 | 2019-10-10T08:16:48.000Z | 2019-10-10T08:16:48.000Z | """Configuration database tests."""
| 18 | 35 | 0.722222 |
9c3700314959d7e50bf67544bd3899115fa61013 | 2,779 | py | Python | tests/onegov/server/test_config.py | politbuero-kampagnen/onegov-cloud | 20148bf321b71f617b64376fe7249b2b9b9c4aa9 | [
"MIT"
] | null | null | null | tests/onegov/server/test_config.py | politbuero-kampagnen/onegov-cloud | 20148bf321b71f617b64376fe7249b2b9b9c4aa9 | [
"MIT"
] | null | null | null | tests/onegov/server/test_config.py | politbuero-kampagnen/onegov-cloud | 20148bf321b71f617b64376fe7249b2b9b9c4aa9 | [
"MIT"
] | null | null | null | import tempfile
import textwrap
import pytest
from onegov.server import errors
from onegov.server.application import Application
from onegov.server.config import Config, ApplicationConfig
def test_static_application_config():
cfg = ApplicationConfig({
'path': '/application/',
'application': 'oneg... | 30.206522 | 75 | 0.602735 |
130efda2ab5cc75a63d6b1fa1ca8b4832dd52a07 | 22,200 | py | Python | web/src/userManager.py | liukai0322/docklet | 9e4d1f4fc2e523423b0e94406242a29b20643788 | [
"BSD-3-Clause"
] | 1 | 2016-05-31T06:52:53.000Z | 2016-05-31T06:52:53.000Z | web/src/userManager.py | liukai0322/docklet | 9e4d1f4fc2e523423b0e94406242a29b20643788 | [
"BSD-3-Clause"
] | null | null | null | web/src/userManager.py | liukai0322/docklet | 9e4d1f4fc2e523423b0e94406242a29b20643788 | [
"BSD-3-Clause"
] | null | null | null | '''
userManager for Docklet
provide a class for managing users and usergroups in Docklet
Warning: in some early versions, "token" stand for the instance of class model.User
now it stands for a string that can be parsed to get that instance.
in all functions start with "@administration_required" or "@a... | 37.563452 | 130 | 0.538153 |
137b4b38923d379cd7f15d04d885b04748a759c8 | 2,473 | py | Python | Python/zzz_training_challenge/Python_Challenge/solutions/ch08_binary_trees/solutions/ex12_complete_D.py | Kreijeck/learning | eaffee08e61f2a34e01eb8f9f04519aac633f48c | [
"MIT"
] | null | null | null | Python/zzz_training_challenge/Python_Challenge/solutions/ch08_binary_trees/solutions/ex12_complete_D.py | Kreijeck/learning | eaffee08e61f2a34e01eb8f9f04519aac633f48c | [
"MIT"
] | null | null | null | Python/zzz_training_challenge/Python_Challenge/solutions/ch08_binary_trees/solutions/ex12_complete_D.py | Kreijeck/learning | eaffee08e61f2a34e01eb8f9f04519aac633f48c | [
"MIT"
] | null | null | null | # Beispielprogramm für das Buch "Python Challenge"
#
# Copyright 2020 by Michael Inden
from ch08_binary_trees.util import TreeUtils
from ch08_binary_trees.solutions.ex12_complete_AB import count_nodes
from ch08_binary_trees.intro.intro_binary_tree_node import BinaryTreeNode
def is_complete(start_node):
node_cou... | 24.73 | 79 | 0.695107 |
139b87af206cd8ea094a46c1a1d75e52ad9ec112 | 444 | py | Python | pacman-arch/test/pacman/tests/sync-nodepversion06.py | Maxython/pacman-for-termux | 3b208eb9274cbfc7a27fca673ea8a58f09ebad47 | [
"MIT"
] | 23 | 2021-05-21T19:11:06.000Z | 2022-03-31T18:14:20.000Z | source/pacman-6.0.1/test/pacman/tests/sync-nodepversion06.py | Scottx86-64/dotfiles-1 | 51004b1e2b032664cce6b553d2052757c286087d | [
"Unlicense"
] | 11 | 2021-05-21T12:08:44.000Z | 2021-12-21T08:30:08.000Z | source/pacman-6.0.1/test/pacman/tests/sync-nodepversion06.py | Scottx86-64/dotfiles-1 | 51004b1e2b032664cce6b553d2052757c286087d | [
"Unlicense"
] | 1 | 2021-09-26T08:44:40.000Z | 2021-09-26T08:44:40.000Z | self.description = "nodepversion: -Su fails"
p1 = pmpkg("pkg1", "1.0-1")
p1.depends = ["provision=1.0"]
self.addpkg2db("local", p1)
p2 = pmpkg("pkg2", "1.0-1")
p2.provides = ["provision=1.0"]
self.addpkg2db("local", p2)
sp2 = pmpkg("pkg2", "1.1-1")
sp2.provides = ["provision=1.1"]
self.addpkg2db("sync", sp2)
self.a... | 22.2 | 44 | 0.662162 |
e0789c027e4adfdbc3c62d05315a2131c1aa406f | 2,540 | py | Python | packages/watchmen-storage-mongodb/src/watchmen_storage_mongodb/document_defs_helper.py | Indexical-Metrics-Measure-Advisory/watchmen | c54ec54d9f91034a38e51fd339ba66453d2c7a6d | [
"MIT"
] | null | null | null | packages/watchmen-storage-mongodb/src/watchmen_storage_mongodb/document_defs_helper.py | Indexical-Metrics-Measure-Advisory/watchmen | c54ec54d9f91034a38e51fd339ba66453d2c7a6d | [
"MIT"
] | null | null | null | packages/watchmen-storage-mongodb/src/watchmen_storage_mongodb/document_defs_helper.py | Indexical-Metrics-Measure-Advisory/watchmen | c54ec54d9f91034a38e51fd339ba66453d2c7a6d | [
"MIT"
] | null | null | null | from typing import List
from .document_mongo import MongoDocumentColumn, MongoDocumentColumnType
# noinspection DuplicatedCode
def create_str(name: str, nullable: bool = True) -> MongoDocumentColumn:
return MongoDocumentColumn(name=name, column_type=MongoDocumentColumnType.STRING, nullable=nullable)
def create_bo... | 36.811594 | 109 | 0.817717 |
4c3f179c1b2895cfe43aa0d57b0e0580b62f1210 | 440 | py | Python | books/PythonAutomate/webscrap/download_txt_file.py | zeroam/TIL | 43e3573be44c7f7aa4600ff8a34e99a65cbdc5d1 | [
"MIT"
] | null | null | null | books/PythonAutomate/webscrap/download_txt_file.py | zeroam/TIL | 43e3573be44c7f7aa4600ff8a34e99a65cbdc5d1 | [
"MIT"
] | null | null | null | books/PythonAutomate/webscrap/download_txt_file.py | zeroam/TIL | 43e3573be44c7f7aa4600ff8a34e99a65cbdc5d1 | [
"MIT"
] | null | null | null | import requests
# 웹으로부터 텍스트 파일 요청
res = requests.get("https://automatetheboringstuff.com/files/rj.txt")
# Response 객체 반환
print(type(res))
# 응답 결과가 성공적인지 출력
print(res.status_code == requests.codes.ok)
# 응답 결과가 정상적이지 않으면 에러 발생
res.raise_for_status()
# 텍스트 파일의 길이 출력
print(len(res.text))
# 파일에 저장
with open("RomeoAndJ... | 20 | 69 | 0.695455 |
4c7490abaa8ea4496fe6f6fa79723711cab9adc6 | 716 | py | Python | Interview Preparation Kits/Interview Preparation Kit/Stacks and Queues/Poisonous Plants/poisonous_plants.py | xuedong/hacker-rank | ce8a60f80c2c6935b427f9409d7e826ee0d26a89 | [
"MIT"
] | 1 | 2021-02-22T17:37:45.000Z | 2021-02-22T17:37:45.000Z | Interview Preparation Kits/Interview Preparation Kit/Stacks and Queues/Poisonous Plants/poisonous_plants.py | xuedong/hacker-rank | ce8a60f80c2c6935b427f9409d7e826ee0d26a89 | [
"MIT"
] | null | null | null | Interview Preparation Kits/Interview Preparation Kit/Stacks and Queues/Poisonous Plants/poisonous_plants.py | xuedong/hacker-rank | ce8a60f80c2c6935b427f9409d7e826ee0d26a89 | [
"MIT"
] | null | null | null | #!/bin/python3
import math
import os
import random
import re
import sys
# Complete the poisonousPlants function below.
def poisonousPlants(p):
stack = []
n = len(p)
ans = 0
for i in range(n):
count = 0
while stack and p[i] <= stack[-1][0]:
count = max(count, stack.pop()[1])... | 17.9 | 48 | 0.541899 |
e6b285b1212b9d27edfdf6f8940b275a19d64fde | 856 | py | Python | backend/api/btb/api/schema/resolvers/supply_by_id.py | prototypefund/project-c | a87a49d7c1317b1e3ec03ddd0ce146ad0391b5d2 | [
"MIT"
] | 4 | 2020-04-30T16:11:24.000Z | 2020-06-02T10:08:07.000Z | backend/api/btb/api/schema/resolvers/supply_by_id.py | prototypefund/project-c | a87a49d7c1317b1e3ec03ddd0ce146ad0391b5d2 | [
"MIT"
] | 291 | 2020-04-20T13:11:13.000Z | 2022-02-10T21:54:46.000Z | backend/api/btb/api/schema/resolvers/supply_by_id.py | prototypefund/project-c | a87a49d7c1317b1e3ec03ddd0ce146ad0391b5d2 | [
"MIT"
] | 2 | 2020-04-19T14:56:01.000Z | 2020-04-19T18:09:34.000Z | from graphene import ID, String, ObjectType
from btb.api.models import db
from sqlalchemy import text
from promise import Promise
from promise.dataloader import DataLoader
from flask import current_app, g
class SupplyLoader(DataLoader):
def batch_load_fn(self, keys):
current_app.logger.debug("load %s", k... | 29.517241 | 98 | 0.663551 |
fc091caeae7c026d39bca585dfb696d9d0bad572 | 782 | py | Python | chapter_four/module_tests/tests/flitton_fib_py/fib_calcs/test_fib_number.py | PacktPublishing/Speed-up-your-Python-with-Rust | 1fce5fb59ea966015768e7eca51c0e31d69531ec | [
"MIT"
] | 21 | 2021-09-10T12:46:26.000Z | 2022-03-23T02:50:39.000Z | chapter_four/managing_dependencies/tests/flitton_fib_py/fib_calcs/test_fib_number.py | PacktPublishing/Speed-up-your-Python-with-Rust | 1fce5fb59ea966015768e7eca51c0e31d69531ec | [
"MIT"
] | null | null | null | chapter_four/managing_dependencies/tests/flitton_fib_py/fib_calcs/test_fib_number.py | PacktPublishing/Speed-up-your-Python-with-Rust | 1fce5fb59ea966015768e7eca51c0e31d69531ec | [
"MIT"
] | 6 | 2021-09-02T08:32:37.000Z | 2022-03-17T21:15:25.000Z | from unittest import main, TestCase
from flitton_fib_py.fib_calcs.fib_number \
import recurring_fibonacci_number
class RecurringFibNumberTest(TestCase):
def test_zero(self):
self.assertEqual(
0, recurring_fibonacci_number(number=0)
)
def test_negative(self):
self.ass... | 21.135135 | 55 | 0.629156 |
fc52ca3fe45a392c7beca6bf100e05e13af0e5ec | 668 | py | Python | tests/onegov/core/test_metadata.py | politbuero-kampagnen/onegov-cloud | 20148bf321b71f617b64376fe7249b2b9b9c4aa9 | [
"MIT"
] | null | null | null | tests/onegov/core/test_metadata.py | politbuero-kampagnen/onegov-cloud | 20148bf321b71f617b64376fe7249b2b9b9c4aa9 | [
"MIT"
] | null | null | null | tests/onegov/core/test_metadata.py | politbuero-kampagnen/onegov-cloud | 20148bf321b71f617b64376fe7249b2b9b9c4aa9 | [
"MIT"
] | null | null | null | import morepath
from onegov.core.framework import Framework
from webtest import TestApp as Client
def test_metadata(redis_url):
class App(Framework):
pass
morepath.commit(App)
app = App()
app.configure_application(redis_url=redis_url)
app.namespace = 'tests'
app.set_application_id(... | 23.034483 | 54 | 0.70509 |
5dd259cfdb43f1d3475a0429218f1caeedd29ba1 | 2,378 | py | Python | Flask/FastAPI/Django/Python-API-Development.freeCodeCamp.org/03-FastAPI/main.py | shihab4t/Software-Development | 0843881f2ba04d9fca34e44443b5f12f509f671e | [
"Unlicense"
] | null | null | null | Flask/FastAPI/Django/Python-API-Development.freeCodeCamp.org/03-FastAPI/main.py | shihab4t/Software-Development | 0843881f2ba04d9fca34e44443b5f12f509f671e | [
"Unlicense"
] | null | null | null | Flask/FastAPI/Django/Python-API-Development.freeCodeCamp.org/03-FastAPI/main.py | shihab4t/Software-Development | 0843881f2ba04d9fca34e44443b5f12f509f671e | [
"Unlicense"
] | null | null | null | from fastapi import FastAPI, Response, status, HTTPException
from pydantic import BaseModel
from typing import Optional
from random import randrange
class Post(BaseModel):
title: str
content: str
published: bool = True
rating: Optional[int] = None
app = FastAPI()
my_post = [
{
"id": 1,... | 24.265306 | 78 | 0.626577 |
5dd5e90a67b99d4240a50300ee493d27e29ff4b0 | 6,131 | py | Python | AI/Assignment-TicTacToe/TicTacToe.py | ChanderJindal/Semester-6 | a1c73d2e684b5a2527048f6fa26999ab1fc9205c | [
"MIT"
] | null | null | null | AI/Assignment-TicTacToe/TicTacToe.py | ChanderJindal/Semester-6 | a1c73d2e684b5a2527048f6fa26999ab1fc9205c | [
"MIT"
] | null | null | null | AI/Assignment-TicTacToe/TicTacToe.py | ChanderJindal/Semester-6 | a1c73d2e684b5a2527048f6fa26999ab1fc9205c | [
"MIT"
] | null | null | null |
class TicTacToe:
def __init__(self,pick:str,sz:int=3,):
self.pick = pick
self.dim_sz = sz
self.board = self.ClearBoard()
def ClearBoard(self):
board = [['blur' for i in range(self.dim_sz)] for j in range(self.dim_sz)]
# made a 3x3 by-default board
return board
... | 35.235632 | 135 | 0.477736 |
f8d932e9e42879932bc0e9158e3ebefcaeac1740 | 2,383 | py | Python | Paddle_Industry_Practice_Sample_Library/nlp_projects/sentiment_analysis/skep_aspect_level/predict.py | linuxonly801/awesome-DeepLearning | b063757fa130c4d56aea5cce2e592610f1e169f9 | [
"Apache-2.0"
] | 1 | 2022-03-19T09:58:37.000Z | 2022-03-19T09:58:37.000Z | Paddle_Industry_Practice_Sample_Library/nlp_projects/sentiment_analysis/skep_aspect_level/predict.py | linuxonly801/awesome-DeepLearning | b063757fa130c4d56aea5cce2e592610f1e169f9 | [
"Apache-2.0"
] | null | null | null | Paddle_Industry_Practice_Sample_Library/nlp_projects/sentiment_analysis/skep_aspect_level/predict.py | linuxonly801/awesome-DeepLearning | b063757fa130c4d56aea5cce2e592610f1e169f9 | [
"Apache-2.0"
] | null | null | null | # Copyright (c) 2020 PaddlePaddle Authors. 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 appli... | 36.661538 | 111 | 0.739824 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.