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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c303703573e9c207e6328fb94dfd9df0974ef478 | 2,148 | py | Python | movie-stills/__init__.py | JHerseth/movie-stills | 1b64118ea1d85431c11941d63c6f51424acfcb42 | [
"MIT"
] | null | null | null | movie-stills/__init__.py | JHerseth/movie-stills | 1b64118ea1d85431c11941d63c6f51424acfcb42 | [
"MIT"
] | null | null | null | movie-stills/__init__.py | JHerseth/movie-stills | 1b64118ea1d85431c11941d63c6f51424acfcb42 | [
"MIT"
] | null | null | null | import ffmpeg
from random import randrange
import argparse
import sys
from pathlib import Path
import os
import progressbar
parser = argparse.ArgumentParser(description="Summarizes a movie in screenshots.")
parser.add_argument('-f','--file', type=str, help="Full path to file to summarize.")
parser.a... | 34.645161 | 130 | 0.646182 |
c31594a067ebaaae4afc4f4181efb83e67bfd716 | 935 | py | Python | books/PythonCleanCode/ch6_descriptors/descriptors_implementation_1.py | zeroam/TIL | 43e3573be44c7f7aa4600ff8a34e99a65cbdc5d1 | [
"MIT"
] | null | null | null | books/PythonCleanCode/ch6_descriptors/descriptors_implementation_1.py | zeroam/TIL | 43e3573be44c7f7aa4600ff8a34e99a65cbdc5d1 | [
"MIT"
] | null | null | null | books/PythonCleanCode/ch6_descriptors/descriptors_implementation_1.py | zeroam/TIL | 43e3573be44c7f7aa4600ff8a34e99a65cbdc5d1 | [
"MIT"
] | null | null | null | """Clean Code in Python - Chapter 6: Getting more out of our objects with
descriptors
> Different forms of implementing descriptors (``__dict__`` vs. ``weakref``)
- The global state problem
"""
class SharedDataDescriptor:
def __init__(self, initial_value):
self.value = initial_value
... | 22.261905 | 77 | 0.608556 |
7d71410e92e26370f16e991c8a17cf172023c0b0 | 12,039 | py | Python | quizgenx.py | scribblemaniac/quizgenx | 5ff7571fb28a72a08dd4a4605c800635ccfdf427 | [
"MIT"
] | null | null | null | quizgenx.py | scribblemaniac/quizgenx | 5ff7571fb28a72a08dd4a4605c800635ccfdf427 | [
"MIT"
] | 9 | 2016-05-19T20:37:41.000Z | 2016-05-19T21:23:17.000Z | quizgenx.py | scribblemaniac/quizgenx | 5ff7571fb28a72a08dd4a4605c800635ccfdf427 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import argparse
import ast # ast.literal_eval()
import sys # sys.stdin / sys.stdout
from xml.etree import ElementTree
import copy # copy.deepcopy()
import os.path # os.path.join
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--input", help="A quiz file to read. If not specified s... | 44.261029 | 186 | 0.619404 |
81d1975d1a2f3ccb9ac7d4d4e9177ed355164376 | 11,741 | py | Python | research/cv/centernet_resnet101/src/centernet_det.py | leelige/mindspore | 5199e05ba3888963473f2b07da3f7bca5b9ef6dc | [
"Apache-2.0"
] | 1 | 2021-11-18T08:17:44.000Z | 2021-11-18T08:17:44.000Z | research/cv/centernet_resnet101/src/centernet_det.py | leelige/mindspore | 5199e05ba3888963473f2b07da3f7bca5b9ef6dc | [
"Apache-2.0"
] | null | null | null | research/cv/centernet_resnet101/src/centernet_det.py | leelige/mindspore | 5199e05ba3888963473f2b07da3f7bca5b9ef6dc | [
"Apache-2.0"
] | 2 | 2019-09-01T06:17:04.000Z | 2019-10-04T08:39:45.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... | 38.2443 | 110 | 0.654544 |
6fe27a1f17eb27e01677147276f5b10fda118816 | 4,371 | py | Python | web_api/app.py | TimSchmittmann/ML2-Project | 7ad01366f2322018065efcae542ae75786b3c0ec | [
"MIT"
] | null | null | null | web_api/app.py | TimSchmittmann/ML2-Project | 7ad01366f2322018065efcae542ae75786b3c0ec | [
"MIT"
] | null | null | null | web_api/app.py | TimSchmittmann/ML2-Project | 7ad01366f2322018065efcae542ae75786b3c0ec | [
"MIT"
] | null | null | null | import os
from flask import Flask
from joblib import load
import numpy as np
import pandas as pd
from sklearn.model_selection import RandomizedSearchCV
from sklearn.pipeline import Pipeline
from sklearn.naive_bayes import MultinomialNB
from skmultilearn.problem_transform import ClassifierChain
from skmultilear... | 35.25 | 89 | 0.611988 |
836bb0a0c4959ee22eac2f544fabcfa882b3622e | 561 | py | Python | exercises/pt/solution_03_10_01.py | tuanducdesign/spacy-course | f8d092c5fa2997fccb3f367d174dce8667932b3d | [
"MIT"
] | null | null | null | exercises/pt/solution_03_10_01.py | tuanducdesign/spacy-course | f8d092c5fa2997fccb3f367d174dce8667932b3d | [
"MIT"
] | null | null | null | exercises/pt/solution_03_10_01.py | tuanducdesign/spacy-course | f8d092c5fa2997fccb3f367d174dce8667932b3d | [
"MIT"
] | null | null | null | import spacy
from spacy.tokens import Doc
nlp = spacy.blank("pt")
# Definir a função para o atributo getter
def get_has_number(doc):
# Retornar verdadeiro (True) se algum token do doc for número (token.like_num)
return any(token.like_num for token in doc)
# Definir a propriedade extendida "has_number" com o... | 31.166667 | 82 | 0.768271 |
54117facd6117596a90c88314455b0ee71483d0b | 3,878 | py | Python | frappe-bench/env/lib/python2.7/site-packages/stdnum/dk/cpr.py | Semicheche/foa_frappe_docker | a186b65d5e807dd4caf049e8aeb3620a799c1225 | [
"MIT"
] | null | null | null | frappe-bench/env/lib/python2.7/site-packages/stdnum/dk/cpr.py | Semicheche/foa_frappe_docker | a186b65d5e807dd4caf049e8aeb3620a799c1225 | [
"MIT"
] | null | null | null | frappe-bench/env/lib/python2.7/site-packages/stdnum/dk/cpr.py | Semicheche/foa_frappe_docker | a186b65d5e807dd4caf049e8aeb3620a799c1225 | [
"MIT"
] | null | null | null | # cpr.py - functions for handling Danish CPR numbers
#
# Copyright (C) 2012-2015 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (... | 32.864407 | 76 | 0.708355 |
54b6476eefcbda9c14181ebe6841c57ae72c5fee | 241 | py | Python | exercises/zh/solution_02_02_02.py | Jette16/spacy-course | 32df0c8f6192de6c9daba89740a28c0537e4d6a0 | [
"MIT"
] | 2,085 | 2019-04-17T13:10:40.000Z | 2022-03-30T21:51:46.000Z | exercises/zh/solution_02_02_02.py | Jette16/spacy-course | 32df0c8f6192de6c9daba89740a28c0537e4d6a0 | [
"MIT"
] | 79 | 2019-04-18T14:42:55.000Z | 2022-03-07T08:15:43.000Z | exercises/zh/solution_02_02_02.py | Jette16/spacy-course | 32df0c8f6192de6c9daba89740a28c0537e4d6a0 | [
"MIT"
] | 361 | 2019-04-17T13:34:32.000Z | 2022-03-28T04:42:45.000Z | import spacy
nlp = spacy.load("zh_core_web_sm")
doc = nlp("周杰伦是一个人物。")
# 查找标签是"人物"的字符串的哈希值
person_hash = nlp.vocab.strings["人物"]
print(person_hash)
# 查找person_hash来拿到字符串
person_string = nlp.vocab.strings[person_hash]
print(person_string)
| 18.538462 | 46 | 0.771784 |
49c8eba7ca22a08a47cdb1571892f24fe0c93e47 | 2,134 | py | Python | yolov5-coreml-tflite-converter/inference-python/python_model/coreml_model.py | SchweizerischeBundesbahnen/sbb-ml-models | 485356aeb0a277907c160d435f7f654154046a70 | [
"MIT"
] | null | null | null | yolov5-coreml-tflite-converter/inference-python/python_model/coreml_model.py | SchweizerischeBundesbahnen/sbb-ml-models | 485356aeb0a277907c160d435f7f654154046a70 | [
"MIT"
] | null | null | null | yolov5-coreml-tflite-converter/inference-python/python_model/coreml_model.py | SchweizerischeBundesbahnen/sbb-ml-models | 485356aeb0a277907c160d435f7f654154046a70 | [
"MIT"
] | null | null | null | import logging
import torch
from coremltools.models.model import MLModel
from constants import BATCH_SIZE, IMAGE_NAME, IOU_NAME, CONF_NAME, CONFIDENCE_NAME, COORDINATES_NAME
from pytorch_nms import pt_xywh2yxyx_yolo
class CoreMLModel():
def __init__(self, model_path):
logging.info("- Initializing CoreML... | 44.458333 | 122 | 0.696813 |
b7575978f94145aff69cd3bfc02823b9898b8ce7 | 11,545 | py | Python | bigbench/benchmark_tasks/long_context_integration/task.py | lintangsutawika/BIG-bench | 230057960f8682b0051b2a1c4c3c6e0830f72769 | [
"Apache-2.0"
] | 460 | 2021-01-26T21:23:37.000Z | 2022-03-31T15:55:10.000Z | bigbench/benchmark_tasks/long_context_integration/task.py | lintangsutawika/BIG-bench | 230057960f8682b0051b2a1c4c3c6e0830f72769 | [
"Apache-2.0"
] | 475 | 2021-01-27T01:29:01.000Z | 2022-03-30T20:23:56.000Z | bigbench/benchmark_tasks/long_context_integration/task.py | lintangsutawika/BIG-bench | 230057960f8682b0051b2a1c4c3c6e0830f72769 | [
"Apache-2.0"
] | 305 | 2021-01-26T23:28:11.000Z | 2022-03-31T14:51:26.000Z | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, so... | 31.457766 | 125 | 0.580858 |
b7c03cab17063d04ab09e5376de04073ae6921b7 | 2,382 | py | Python | adsClientRackSorter.py | WolleTD/RackSorterPython | f6eb4f562e4b6008ce9ec9e64de1f1947cb84318 | [
"MIT"
] | null | null | null | adsClientRackSorter.py | WolleTD/RackSorterPython | f6eb4f562e4b6008ce9ec9e64de1f1947cb84318 | [
"MIT"
] | null | null | null | adsClientRackSorter.py | WolleTD/RackSorterPython | f6eb4f562e4b6008ce9ec9e64de1f1947cb84318 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# file: adsClientRackSorter.py
#
# Kleines, statisches Testprogramm für die ADS-Kommunikation mit pyADS
# Eingabe-Daten für das racksorter-Modul sind direkt im Code in main()
# eingetragen.
import racksorter
import pyads
import time
from copy import copy
# Dimensionen des Hochregallagers
xSize ... | 30.935065 | 81 | 0.685139 |
4d8f07371bbbb045ab84e1d813387257921a763b | 289 | py | Python | Sketche/boids/head.py | kantel/p5 | 2ef14191c35fdb056b44624c6ff0ff764c88cc30 | [
"MIT"
] | null | null | null | Sketche/boids/head.py | kantel/p5 | 2ef14191c35fdb056b44624c6ff0ff764c88cc30 | [
"MIT"
] | null | null | null | Sketche/boids/head.py | kantel/p5 | 2ef14191c35fdb056b44624c6ff0ff764c88cc30 | [
"MIT"
] | null | null | null | import p5
from pvector import PVector
def setup():
mover1 = PVector(10.0, 20.0)
print(mover1.heading())
print(mover1)
mover2 = PVector(5, 7)
print(mover2.heading())
print(mover2)
print(mover1 + mover2)
print(mover1 - mover2)
def draw():
pass
p5.run() | 17 | 32 | 0.629758 |
4da610bc8ee6181eec6186a902dab3dfe5beb1db | 452 | py | Python | exercises/es/test_01_08_02.py | Jette16/spacy-course | 32df0c8f6192de6c9daba89740a28c0537e4d6a0 | [
"MIT"
] | 2,085 | 2019-04-17T13:10:40.000Z | 2022-03-30T21:51:46.000Z | exercises/es/test_01_08_02.py | Jette16/spacy-course | 32df0c8f6192de6c9daba89740a28c0537e4d6a0 | [
"MIT"
] | 79 | 2019-04-18T14:42:55.000Z | 2022-03-07T08:15:43.000Z | exercises/es/test_01_08_02.py | Jette16/spacy-course | 32df0c8f6192de6c9daba89740a28c0537e4d6a0 | [
"MIT"
] | 361 | 2019-04-17T13:34:32.000Z | 2022-03-28T04:42:45.000Z | def test():
assert "for ent in doc.ents" in __solution__, "¿Estás iterando sobre las entidades?"
assert (
"print(ent.text, ent.label_)" in __solution__
), "¿Estás imprimiendo en pantalla el texto y el label?"
__msg__.good(
"¡Muy buen trabajo! Hasta ahora el modelo a estado correcto toda... | 37.666667 | 88 | 0.661504 |
15103b30e5925c9751ee4fbef1f040ab86dffa98 | 723 | py | Python | cleanUpDatabse.py | bhemsen/bigBrother | 260f927fdcf6b6d43ec79a7a7ea4ba61a44c5e6d | [
"MIT"
] | null | null | null | cleanUpDatabse.py | bhemsen/bigBrother | 260f927fdcf6b6d43ec79a7a7ea4ba61a44c5e6d | [
"MIT"
] | null | null | null | cleanUpDatabse.py | bhemsen/bigBrother | 260f927fdcf6b6d43ec79a7a7ea4ba61a44c5e6d | [
"MIT"
] | null | null | null | import mysql.connector
import time
from mysql.connector import Error
def cleanUp():
db = mysql.connector.connect(
host="localhost",
user="webadmin",
passwd="password",
database="sensoro"
)
sql = "DELETE FROM temperature WHERE DATEDIFF(day, NOW()) <= %s"
curser =... | 21.909091 | 68 | 0.558783 |
427c193b505027bd498bd0a3659601881fa3d0f0 | 909 | py | Python | ISTp/2014/korsakov_a_a/task_4_34.py | YukkaSarasti/pythonintask | eadf4245abb65f4400a3bae30a4256b4658e009c | [
"Apache-2.0"
] | null | null | null | ISTp/2014/korsakov_a_a/task_4_34.py | YukkaSarasti/pythonintask | eadf4245abb65f4400a3bae30a4256b4658e009c | [
"Apache-2.0"
] | null | null | null | ISTp/2014/korsakov_a_a/task_4_34.py | YukkaSarasti/pythonintask | eadf4245abb65f4400a3bae30a4256b4658e009c | [
"Apache-2.0"
] | null | null | null | # Задача 4. Вариант 34
# Напишите программу, которая выводит имя, под которым скрывается Мария Луиза Полякова —
# Байдарова. Дополнительно необходимо вывести область интересов указанной личности, место
# рождения, годы рождения и смерти (если человек умер), вычислить возраст на данный момент
#(или момент смерти). Для х... | 39.521739 | 90 | 0.782178 |
428f199099a16e33971c7da7ba944a08567fb26c | 1,285 | py | Python | top/clearlight/base/liaoxuefeng/third_party_module/psutil/psutil_learn.py | ClearlightY/Python_learn | 93b9b7efae5a1cf05faf8ee7c5e36dcc99c7a232 | [
"Apache-2.0"
] | 1 | 2020-01-16T09:23:43.000Z | 2020-01-16T09:23:43.000Z | top/clearlight/base/liaoxuefeng/third_party_module/psutil/psutil_learn.py | ClearlightY/Python_learn | 93b9b7efae5a1cf05faf8ee7c5e36dcc99c7a232 | [
"Apache-2.0"
] | null | null | null | top/clearlight/base/liaoxuefeng/third_party_module/psutil/psutil_learn.py | ClearlightY/Python_learn | 93b9b7efae5a1cf05faf8ee7c5e36dcc99c7a232 | [
"Apache-2.0"
] | null | null | null | import psutil
# 获取CPU逻辑数量
print(psutil.cpu_count())
# CPU物理核心 : 2说明是双核超线程, 4则是4核非超线程
print(psutil.cpu_count(logical=False))
# 统计CPU的用户/系统/空闲时间
print(psutil.cpu_times())
# 实现类似top命令的CPU使用率
for x in range(3):
print(psutil.cpu_percent(interval=1, percpu=True))
# 获取内存信息
print(psutil.virtual_memory())
print(psutil.s... | 15.864198 | 54 | 0.720623 |
c439262702e55108de2d7995a3793537fc4ff254 | 874 | py | Python | setup.py | Chia-vie/Secret_Diary | 0e007634fd2c2625d8734b054fbe3c8c6b5b7343 | [
"MIT"
] | null | null | null | setup.py | Chia-vie/Secret_Diary | 0e007634fd2c2625d8734b054fbe3c8c6b5b7343 | [
"MIT"
] | null | null | null | setup.py | Chia-vie/Secret_Diary | 0e007634fd2c2625d8734b054fbe3c8c6b5b7343 | [
"MIT"
] | null | null | null | import setuptools
# read in required packages from requirements.txt
with open("requirements.txt", "r") as fh:
requirements = fh.read().splitlines()
setuptools.setup(
name="SecretDiary",
version="0.0.0",
author='Christine Ackerl',
author_email='ci.a@univie.ac.at',
description='Ich weiß nicht.',
... | 33.615385 | 70 | 0.662471 |
c44631d1d47e9c3c86e9deefe695784e82fc4823 | 201 | py | Python | 832-flipping-an-image/832-flipping-an-image.py | hyeseonko/LeetCode | 48dfc93f1638e13041d8ce1420517a886abbdc77 | [
"MIT"
] | 2 | 2021-12-05T14:29:06.000Z | 2022-01-01T05:46:13.000Z | 832-flipping-an-image/832-flipping-an-image.py | hyeseonko/LeetCode | 48dfc93f1638e13041d8ce1420517a886abbdc77 | [
"MIT"
] | null | null | null | 832-flipping-an-image/832-flipping-an-image.py | hyeseonko/LeetCode | 48dfc93f1638e13041d8ce1420517a886abbdc77 | [
"MIT"
] | null | null | null | class Solution:
def flipAndInvertImage(self, image: List[List[int]]) -> List[List[int]]:
image = [im[::-1] for im in image]
return [[0 if c==1 else 1 for c in row] for row in image] | 50.25 | 76 | 0.61194 |
c45c098bec2dab5561123232735009902374d26d | 18,243 | py | Python | data-pipeline/src/data_pipeline/datasets/gnomad_v2/gnomad_v2_mnvs.py | broadinstitute/gnomadjs | 00da72cdc2cb0753f822c51456ec15147c024a1d | [
"MIT"
] | 38 | 2018-02-24T02:33:52.000Z | 2020-03-03T23:17:04.000Z | data-pipeline/src/data_pipeline/datasets/gnomad_v2/gnomad_v2_mnvs.py | broadinstitute/gnomadjs | 00da72cdc2cb0753f822c51456ec15147c024a1d | [
"MIT"
] | 385 | 2018-02-21T16:53:13.000Z | 2020-03-04T00:52:40.000Z | data-pipeline/src/data_pipeline/datasets/gnomad_v2/gnomad_v2_mnvs.py | broadinstitute/gnomadjs | 00da72cdc2cb0753f822c51456ec15147c024a1d | [
"MIT"
] | 12 | 2018-02-22T09:45:43.000Z | 2020-02-27T21:37:52.000Z | import csv
import itertools
import hail as hl
from data_pipeline.data_types.locus import normalized_contig, x_position
from data_pipeline.data_types.variant.transcript_consequence import consequence_term_rank
# Change field quote character from double quotes to single quotes.
# Work around for hail-is/hail#5796 to ... | 36.413174 | 117 | 0.573809 |
67083d17f7f075567cd75455b240c7412493c779 | 575 | py | Python | exercises/en/test_04_04.py | tuanducdesign/spacy-course | f8d092c5fa2997fccb3f367d174dce8667932b3d | [
"MIT"
] | 2 | 2020-07-07T01:46:37.000Z | 2021-04-20T03:19:43.000Z | exercises/en/test_04_04.py | tuanducdesign/spacy-course | f8d092c5fa2997fccb3f367d174dce8667932b3d | [
"MIT"
] | null | null | null | exercises/en/test_04_04.py | tuanducdesign/spacy-course | f8d092c5fa2997fccb3f367d174dce8667932b3d | [
"MIT"
] | null | null | null | def test():
assert (
'spacy.blank("en")' in __solution__
), "Did you create the blank English model?"
assert (
"DocBin(docs=docs)" in __solution__
), "Did you create the DocBin object correctly?"
assert "doc_bin.to_disk(" in __solution__, "Did you use the method to_disk?"
assert ... | 38.333333 | 86 | 0.655652 |
67144f1c844b693786c7ad07aa1ed1205a2be8cf | 25,507 | py | Python | spo/spo/doctype/anfrage/anfrage.py | libracore/spo | efff6da53a776c4483f06d9ef1acc8a7aa96b28e | [
"MIT"
] | null | null | null | spo/spo/doctype/anfrage/anfrage.py | libracore/spo | efff6da53a776c4483f06d9ef1acc8a7aa96b28e | [
"MIT"
] | 6 | 2019-08-23T18:36:26.000Z | 2019-11-12T13:12:12.000Z | spo/spo/doctype/anfrage/anfrage.py | libracore/spo | efff6da53a776c4483f06d9ef1acc8a7aa96b28e | [
"MIT"
] | 1 | 2021-08-14T22:22:43.000Z | 2021-08-14T22:22:43.000Z | # -*- coding: utf-8 -*-
# Copyright (c) 2019, libracore and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe.utils.data import today, add_days, nowdate, get_datetime_str
from spo.utils.timesheet_h... | 39.66874 | 416 | 0.563806 |
67a4b0fd8f262496da6807e1f61aebae43c40c9e | 403 | py | Python | Project Euler Questions 21 - 30/Project Euler Question 28.py | Clayton-Threm/Coding-Practice | 6671e8a15f9e797338caa617dae45093f4157bc1 | [
"MIT"
] | 1 | 2020-02-11T02:03:02.000Z | 2020-02-11T02:03:02.000Z | Project Euler Questions 21 - 30/Project Euler Question 28.py | Clayton-Threm/Coding-Practice | 6671e8a15f9e797338caa617dae45093f4157bc1 | [
"MIT"
] | null | null | null | Project Euler Questions 21 - 30/Project Euler Question 28.py | Clayton-Threm/Coding-Practice | 6671e8a15f9e797338caa617dae45093f4157bc1 | [
"MIT"
] | null | null | null | #Project Euler Question 28
#Number Spiral Diagonals
def spiral_numbers(r):
spiral_list = []
count = -1
gap = 2
x = 1
while x <= (r**2):
spiral_list.append(x)
count += 1
if count == 4:
gap += 2
count = 0
x += gap
#print (spiral_list)
r... | 20.15 | 59 | 0.543424 |
67e0b1ce455932d27744aa1a085919be4f6a5cf4 | 10,950 | py | Python | exercises/networking_selfpaced/networking-workshop/collections/ansible_collections/community/general/plugins/callback/logentries.py | tr3ck3r/linklight | 5060f624c235ecf46cb62cefcc6bddc6bf8ca3e7 | [
"MIT"
] | null | null | null | exercises/networking_selfpaced/networking-workshop/collections/ansible_collections/community/general/plugins/callback/logentries.py | tr3ck3r/linklight | 5060f624c235ecf46cb62cefcc6bddc6bf8ca3e7 | [
"MIT"
] | null | null | null | exercises/networking_selfpaced/networking-workshop/collections/ansible_collections/community/general/plugins/callback/logentries.py | tr3ck3r/linklight | 5060f624c235ecf46cb62cefcc6bddc6bf8ca3e7 | [
"MIT"
] | null | null | null | # (c) 2015, Logentries.com, Jimmy Tang <jimmy.tang@logentries.com>
# (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
callback: logentries... | 33.181818 | 157 | 0.630502 |
2255c11f7bcb2804d141d8b8aaa1f6d601cc16c2 | 1,207 | py | Python | Ass1.py | abhinav27021994/NLP | 50a9d0af6fa3ed969d22a3a3fa2eef15b2a10df7 | [
"Unlicense"
] | null | null | null | Ass1.py | abhinav27021994/NLP | 50a9d0af6fa3ed969d22a3a3fa2eef15b2a10df7 | [
"Unlicense"
] | null | null | null | Ass1.py | abhinav27021994/NLP | 50a9d0af6fa3ed969d22a3a3fa2eef15b2a10df7 | [
"Unlicense"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Wed Feb 10 22:40:55 2021
@author: Abhinav
"""
import nltk
from nltk.corpus import movie_reviews
from nltk.tokenize import PunktSentenceTokenizer
from nltk.corpus import stopwords
from nltk import word_tokenize
from nltk import sent_tokenize
#ELIMINATION OF STOPWORDS... | 25.680851 | 82 | 0.759735 |
3f1563bbb86b79694d00ded1a5c4c7d48dac91ef | 934 | py | Python | PINp/2014/Koleganov_N_S/task_4_10.py | YukkaSarasti/pythonintask | eadf4245abb65f4400a3bae30a4256b4658e009c | [
"Apache-2.0"
] | null | null | null | PINp/2014/Koleganov_N_S/task_4_10.py | YukkaSarasti/pythonintask | eadf4245abb65f4400a3bae30a4256b4658e009c | [
"Apache-2.0"
] | null | null | null | PINp/2014/Koleganov_N_S/task_4_10.py | YukkaSarasti/pythonintask | eadf4245abb65f4400a3bae30a4256b4658e009c | [
"Apache-2.0"
] | null | null | null | # Задание 4. Вариант 10.
# Напишите программу, которая выводит имя, под которым скрывается Уильям Сидни
# Портер. Дополнительно необходимо вывести область интересов указанной
# личности, место рождения, годы рождения и смерти (если человек умер),
# вычислить возраст на данный момент (или момент смерти). Для хранения вс... | 44.47619 | 104 | 0.776231 |
452eb457a711c81963f3d53d04a86daf27bbf968 | 2,280 | py | Python | monitoring/prometheus/aliyun-exporter/aliyun_exporter/web.py | smthkissinger/docker-images | 35e868295d04fa780325ada4168381f1e80e8fe4 | [
"BSD-3-Clause"
] | 264 | 2018-12-09T13:41:45.000Z | 2022-02-08T07:10:02.000Z | monitoring/prometheus/aliyun-exporter/aliyun_exporter/web.py | smthkissinger/docker-images | 35e868295d04fa780325ada4168381f1e80e8fe4 | [
"BSD-3-Clause"
] | 42 | 2018-12-11T10:20:57.000Z | 2019-10-25T09:56:22.000Z | monitoring/prometheus/aliyun-exporter/aliyun_exporter/web.py | smthkissinger/docker-images | 35e868295d04fa780325ada4168381f1e80e8fe4 | [
"BSD-3-Clause"
] | 154 | 2018-12-11T02:12:01.000Z | 2022-03-25T03:45:54.000Z | import json
from aliyunsdkcore.client import AcsClient
from flask import (
Flask, render_template
)
from prometheus_client import make_wsgi_app
from werkzeug.wsgi import DispatcherMiddleware
from aliyun_exporter import CollectorConfig
from aliyun_exporter.QueryMetricMetaRequest import QueryMetricMetaRequest
from ... | 33.529412 | 98 | 0.689912 |
7a0b05271518d6e9e0b73c549c58871d95d58b5a | 618 | py | Python | 48-rotate-image/48-rotate-image.py | hyeseonko/LeetCode | 48dfc93f1638e13041d8ce1420517a886abbdc77 | [
"MIT"
] | 2 | 2021-12-05T14:29:06.000Z | 2022-01-01T05:46:13.000Z | 48-rotate-image/48-rotate-image.py | hyeseonko/LeetCode | 48dfc93f1638e13041d8ce1420517a886abbdc77 | [
"MIT"
] | null | null | null | 48-rotate-image/48-rotate-image.py | hyeseonko/LeetCode | 48dfc93f1638e13041d8ce1420517a886abbdc77 | [
"MIT"
] | null | null | null | class Solution:
def rotate(self, matrix: List[List[int]]) -> None:
"""
Do not return anything, modify matrix in-place instead.
"""
N = len(matrix)
for row in range(int(N/2)):
for col in range(row, N-1-row):
temp_b = matrix[col][N-1-row]
... | 38.625 | 63 | 0.487055 |
e199fdd304cba0a3b283c2e3fe41922acd4ec353 | 2,788 | py | Python | Python2/Modulo_4_exe2.py | Belaschich/SoulON | 9f908b025b34fc79187b4efd5ea93a78dca0ef7e | [
"MIT"
] | null | null | null | Python2/Modulo_4_exe2.py | Belaschich/SoulON | 9f908b025b34fc79187b4efd5ea93a78dca0ef7e | [
"MIT"
] | null | null | null | Python2/Modulo_4_exe2.py | Belaschich/SoulON | 9f908b025b34fc79187b4efd5ea93a78dca0ef7e | [
"MIT"
] | null | null | null | '''
Crie um script contendo cinco funções:
Criar itens, onde o usuário pode selecionar a quantidade de campos;
Mostrar todos os documentos;
Deletar documentos pelo ID;
Deletar toda a coleção do banco de dados;
Atualizar documentos por ID ou por campos.
OBS: Não precisa criar menu para escolha das funções, elas podem se... | 34.85 | 120 | 0.684362 |
beca6ecfe9500733c30f0133d04499e8451ab470 | 308 | py | Python | python/greedy_florist.py | higoress/HackerRank | ac13fc378734e70eef08b357bb36c47655d7d0be | [
"MIT"
] | null | null | null | python/greedy_florist.py | higoress/HackerRank | ac13fc378734e70eef08b357bb36c47655d7d0be | [
"MIT"
] | null | null | null | python/greedy_florist.py | higoress/HackerRank | ac13fc378734e70eef08b357bb36c47655d7d0be | [
"MIT"
] | null | null | null | def getMinimumCost(k, c):
c.sort()
friend_cost = [[] for _ in range(k)]
while c:
for i in range(k):
if c:
friend_cost[i].append((len(friend_cost[i])+1) * c.pop())
else:
break
return sum([sum(cost) for cost in friend_cost])
| 25.666667 | 72 | 0.49026 |
55c12780b218d2fd616e43efa9ec19c2f1c3cb78 | 808 | py | Python | tests/test_yaml_parser.py | kkaruso/niv | 67ba82c93279db4dae503d4dceec7ba5e9931c0a | [
"MIT"
] | null | null | null | tests/test_yaml_parser.py | kkaruso/niv | 67ba82c93279db4dae503d4dceec7ba5e9931c0a | [
"MIT"
] | null | null | null | tests/test_yaml_parser.py | kkaruso/niv | 67ba82c93279db4dae503d4dceec7ba5e9931c0a | [
"MIT"
] | null | null | null | """
module to test yam_parser
"""
import os
from unittest import TestCase
import yaml
from src.yaml_parser.yaml_parser import get_yaml # pylint: disable=import-error
class Test(TestCase):
"""
class to test the yaml_parser functions
"""
def setUp(self) -> None:
data = {'name': 'Silenthand Ol... | 26.064516 | 99 | 0.611386 |
36ae4519f77d6d3a3e6ff3e51fa764dfd2a53122 | 1,978 | py | Python | School/G12/BinarySearch_noslice.py | MastaCoder/Projects | ebb0a3134522b12f052fec8d753005f384adf1b1 | [
"MIT"
] | 5 | 2018-10-11T01:55:40.000Z | 2021-12-25T23:38:22.000Z | School/G12/BinarySearch_noslice.py | MastaCoder/mini_projects | ebb0a3134522b12f052fec8d753005f384adf1b1 | [
"MIT"
] | null | null | null | School/G12/BinarySearch_noslice.py | MastaCoder/mini_projects | ebb0a3134522b12f052fec8d753005f384adf1b1 | [
"MIT"
] | 1 | 2019-02-22T14:42:50.000Z | 2019-02-22T14:42:50.000Z | import random, math
def binary_search(numbers, look):
"""Binary Search algorithm"""
# Split at the start
start = 0 # Start is beginning
mid = len(numbers) // 2 # the middle
end = len(numbers) - 1 # end
found = -2 # temp not found
# is it empty?
if not numbers:
return -1
... | 28.666667 | 73 | 0.593529 |
a11c3e84c992b3d8941f0045e66bba5df96e91b0 | 302 | py | Python | code/examples/Loops.py | SaschaMzH/hucon | 830b6c5e21c2c7316c61e8afdf708066374b9b62 | [
"BSD-3-Clause"
] | 2 | 2019-09-25T13:39:22.000Z | 2019-09-26T10:06:13.000Z | code/examples/Loops.py | SaschaMzH/hucon | 830b6c5e21c2c7316c61e8afdf708066374b9b62 | [
"BSD-3-Clause"
] | 44 | 2019-09-25T14:35:48.000Z | 2021-08-20T17:26:12.000Z | code/examples/Loops.py | SaschaMzH/hucon | 830b6c5e21c2c7316c61e8afdf708066374b9b62 | [
"BSD-3-Clause"
] | 8 | 2019-09-25T13:53:07.000Z | 2022-02-24T19:23:44.000Z | """ Print a text on the console looping.
Copyright (C) 2019 Basler AG
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
i = None
for i in range(1, 6):
print(str('HuCon Rocks ') + str(i))
| 20.133333 | 65 | 0.668874 |
a18de61a0a631e022aa70cbb1d7b71fc1835d9db | 931 | py | Python | src/onegov/town6/views/external_link.py | politbuero-kampagnen/onegov-cloud | 20148bf321b71f617b64376fe7249b2b9b9c4aa9 | [
"MIT"
] | null | null | null | src/onegov/town6/views/external_link.py | politbuero-kampagnen/onegov-cloud | 20148bf321b71f617b64376fe7249b2b9b9c4aa9 | [
"MIT"
] | null | null | null | src/onegov/town6/views/external_link.py | politbuero-kampagnen/onegov-cloud | 20148bf321b71f617b64376fe7249b2b9b9c4aa9 | [
"MIT"
] | null | null | null | from onegov.org.views.external_link import handle_new_external_link, \
edit_external_link, get_external_link_form
from onegov.town6 import TownApp
from onegov.core.security import Private
from onegov.town6.layout import DefaultLayout, ExternalLinkLayout
from onegov.org.models.external_link import (
ExternalLink... | 34.481481 | 70 | 0.779807 |
a1a89acc6c6a319886935419645266ee9f6a1d56 | 858 | py | Python | 503/Fcat_503_stack.py | Leetcode-Secret-Society/warehouse | 40d7969683b1296f361e799cda37f15ceec52af8 | [
"MIT"
] | null | null | null | 503/Fcat_503_stack.py | Leetcode-Secret-Society/warehouse | 40d7969683b1296f361e799cda37f15ceec52af8 | [
"MIT"
] | null | null | null | 503/Fcat_503_stack.py | Leetcode-Secret-Society/warehouse | 40d7969683b1296f361e799cda37f15ceec52af8 | [
"MIT"
] | null | null | null | from typing import List
class Solution:
def nextGreaterElements(self, nums: List[int]) -> List[int]:
max_value = nums[0]
stack = [(0, nums[0])]
result = [-1] * len(nums)
for i in range(1, len(nums)):
current_num = nums[i]
max_value = max(current_num, max_val... | 31.777778 | 64 | 0.527972 |
c5777e0753fa152161d6bf5e8fc784cea0a56886 | 1,039 | py | Python | lang-python/findStringsInFile/find.py | xd23fe39/technical-notes | bb6348705a95db24d07b1081b1aa0265dda131ce | [
"MIT"
] | null | null | null | lang-python/findStringsInFile/find.py | xd23fe39/technical-notes | bb6348705a95db24d07b1081b1aa0265dda131ce | [
"MIT"
] | null | null | null | lang-python/findStringsInFile/find.py | xd23fe39/technical-notes | bb6348705a95db24d07b1081b1aa0265dda131ce | [
"MIT"
] | null | null | null | # Python Hilfsscript für die Zeichenkettenzerlegung
#
# Teilzeichenkette für Suche (Wortanfang)
SEARCH_PATTERN = "XXXX"
print("\nSearch Pattern: %s\n" % SEARCH_PATTERN)
##
# Parsen einer Zeile / Zeichenkette
#
def parser(line):
lsize = len(line)
print("Parser Input: %d chars\n" % (lsize))
for i in range(... | 32.46875 | 88 | 0.564966 |
3de752da2c6ae627a442a77645fea8aef40e0835 | 2,086 | py | Python | AP_SS16/US1/datenersteller.py | DimensionalScoop/kautschuk | 90403f97cd60b9716cb6a06668196891d5d96578 | [
"MIT"
] | 3 | 2016-04-27T17:07:00.000Z | 2022-02-02T15:43:15.000Z | AP_SS16/US1/datenersteller.py | DimensionalScoop/kautschuk | 90403f97cd60b9716cb6a06668196891d5d96578 | [
"MIT"
] | 5 | 2016-04-27T17:10:03.000Z | 2017-06-20T14:54:20.000Z | AP_SS16/US1/datenersteller.py | DimensionalScoop/kautschuk | 90403f97cd60b9716cb6a06668196891d5d96578 | [
"MIT"
] | null | null | null | import os, sys, inspect
# realpath() will make your script run, even if you symlink it :)
cmd_folder = os.path.realpath(os.path.abspath(os.path.split(inspect.getfile( inspect.currentframe() ))[0]))
if cmd_folder not in sys.path:
sys.path.insert(0, cmd_folder)
# use this if you want to include modules from a subfo... | 33.111111 | 148 | 0.682167 |
4947a70d2d46b3de146d05029d3e341204de541b | 3,012 | py | Python | _search/server/ijsite.py | NicoKiaru/imagej.github.io | e334937e361f1aa0ad45cf46ba5c8fadfc32be28 | [
"CC-BY-3.0"
] | 16 | 2020-08-03T20:08:00.000Z | 2022-03-02T15:50:47.000Z | _search/server/ijsite.py | NicoKiaru/imagej.github.io | e334937e361f1aa0ad45cf46ba5c8fadfc32be28 | [
"CC-BY-3.0"
] | 196 | 2015-09-14T19:15:07.000Z | 2022-03-31T02:22:39.000Z | _search/server/ijsite.py | NicoKiaru/imagej.github.io | e334937e361f1aa0ad45cf46ba5c8fadfc32be28 | [
"CC-BY-3.0"
] | 60 | 2020-06-04T14:18:37.000Z | 2022-03-30T23:10:55.000Z | #!/bin/env python
import logging, os, traceback
from bs4 import BeautifulSoup
from parseutil import first_sentence
logger = logging.getLogger(__name__)
def is_imagej_website(docroot):
notes = os.path.join(docroot, 'notes.html')
return os.path.isfile(notes)
def extract_description(doc, body):
desc = ... | 28.961538 | 76 | 0.561089 |
77371f70ad0971573d5de4fdda944dee01d332be | 12,655 | py | Python | src/visitpy/examples/sync_minmax_macro.py | visit-dav/vis | c08bc6e538ecd7d30ddc6399ec3022b9e062127e | [
"BSD-3-Clause"
] | 226 | 2018-12-29T01:13:49.000Z | 2022-03-30T19:16:31.000Z | src/visitpy/examples/sync_minmax_macro.py | visit-dav/vis | c08bc6e538ecd7d30ddc6399ec3022b9e062127e | [
"BSD-3-Clause"
] | 5,100 | 2019-01-14T18:19:25.000Z | 2022-03-31T23:08:36.000Z | src/visitpy/examples/sync_minmax_macro.py | visit-dav/vis | c08bc6e538ecd7d30ddc6399ec3022b9e062127e | [
"BSD-3-Clause"
] | 84 | 2019-01-24T17:41:50.000Z | 2022-03-10T10:01:46.000Z | import re
def SaveActivePlots(activePlots):
thePlots = GetPlotList()
for p in range(thePlots.GetNumPlots()):
if thePlots.GetPlots(p).activeFlag == 1:
activePlots.append(p)
def RestoreActivePlots(activePlots):
SetActivePlots(tuple(activePlots))
#########################################... | 35.647887 | 85 | 0.58546 |
f318d267316bdcaf4f17a84c95a2d4ca86a8b6c7 | 189 | py | Python | 1.Array/Python/array.py | Vinaypatil-Ev/vinEvC_datastructure | 3e02e49c03a2b7d2e09af9a2dce080e6d9abbf74 | [
"MIT"
] | 3 | 2020-09-10T18:40:40.000Z | 2020-09-15T17:32:12.000Z | 1.Array/Python/array.py | Vinaypatil-Ev/vinEvC_datastructure | 3e02e49c03a2b7d2e09af9a2dce080e6d9abbf74 | [
"MIT"
] | null | null | null | 1.Array/Python/array.py | Vinaypatil-Ev/vinEvC_datastructure | 3e02e49c03a2b7d2e09af9a2dce080e6d9abbf74 | [
"MIT"
] | null | null | null | # integer Array
a = [1, 3, 4, 5, 6]
# string array
b = ["this", "Is", "String"]
# float array
c = [3.4, 6.89, 55.90]
# multi-dimentional array
d = [
[1, 3],
[2, 4]
] | 13.5 | 28 | 0.465608 |
b86e4eb5b9bcdde6139c61555993dd9a3ad33575 | 114 | pyde | Python | sketches/titeltest/titeltest.pyde | kantel/processingpy | 74aae222e46f68d1c8f06307aaede3cdae65c8ec | [
"MIT"
] | 4 | 2018-06-03T02:11:46.000Z | 2021-08-18T19:55:15.000Z | sketches/titeltest/titeltest.pyde | kantel/processingpy | 74aae222e46f68d1c8f06307aaede3cdae65c8ec | [
"MIT"
] | null | null | null | sketches/titeltest/titeltest.pyde | kantel/processingpy | 74aae222e46f68d1c8f06307aaede3cdae65c8ec | [
"MIT"
] | 3 | 2019-12-23T19:12:51.000Z | 2021-04-30T14:00:31.000Z | def setup():
size(400, 400)
this.surface.setTitle(u"Hallo Wörld!")
def draw():
background("#000000")
| 16.285714 | 42 | 0.622807 |
a23b564f71bbf35cf02841a368daff1df202eea9 | 715 | py | Python | Python/zzz_training_challenge/Python_Challenge/solutions/tests/ch05_datastructures/ex06_longest _subsequence_test.py | Kreijeck/learning | eaffee08e61f2a34e01eb8f9f04519aac633f48c | [
"MIT"
] | null | null | null | Python/zzz_training_challenge/Python_Challenge/solutions/tests/ch05_datastructures/ex06_longest _subsequence_test.py | Kreijeck/learning | eaffee08e61f2a34e01eb8f9f04519aac633f48c | [
"MIT"
] | null | null | null | Python/zzz_training_challenge/Python_Challenge/solutions/tests/ch05_datastructures/ex06_longest _subsequence_test.py | Kreijeck/learning | eaffee08e61f2a34e01eb8f9f04519aac633f48c | [
"MIT"
] | null | null | null | # Beispielprogramm für das Buch "Python Challenge"
#
# Copyright 2020 by Michael Inden
import pytest
from ch05_datastructures.solutions.ex06_longest_subsequence import find_longest_growing_sequence
@pytest.mark.parametrize("values, expected",
[([7, 2, 7, 1, 2, 5, 7, 1], [1, 2, 5, 7]),
... | 34.047619 | 96 | 0.51049 |
a76a779f84d5bc34bb04995a4644427feae4ceb6 | 7,878 | py | Python | mumath/server.py | fourpoints/mumath | f1c36c4a5b3c32a3e7f8e7a922eafea8b7a14fd4 | [
"MIT"
] | null | null | null | mumath/server.py | fourpoints/mumath | f1c36c4a5b3c32a3e7f8e7a922eafea8b7a14fd4 | [
"MIT"
] | null | null | null | mumath/server.py | fourpoints/mumath | f1c36c4a5b3c32a3e7f8e7a922eafea8b7a14fd4 | [
"MIT"
] | null | null | null | import http.server
import socketserver
import importlib
import sys
import html
from functools import partial
from http.server import HTTPStatus
from pathlib import Path
from urllib.parse import unquote
from .core import MuMath
from .util import listify
# Most of this is copied from http.server:
# https://github.com/py... | 32.02439 | 129 | 0.596344 |
a7c7f24814080bf0e6db2122f0b897387fd7c802 | 4,543 | py | Python | src/onegov/translator_directory/models/translator.py | politbuero-kampagnen/onegov-cloud | 20148bf321b71f617b64376fe7249b2b9b9c4aa9 | [
"MIT"
] | null | null | null | src/onegov/translator_directory/models/translator.py | politbuero-kampagnen/onegov-cloud | 20148bf321b71f617b64376fe7249b2b9b9c4aa9 | [
"MIT"
] | null | null | null | src/onegov/translator_directory/models/translator.py | politbuero-kampagnen/onegov-cloud | 20148bf321b71f617b64376fe7249b2b9b9c4aa9 | [
"MIT"
] | null | null | null | from uuid import uuid4
from onegov.core.orm.mixins import ContentMixin, meta_property
from onegov.file import AssociatedFiles
from onegov.gis import CoordinatesMixin
from onegov.search import ORMSearchable
from libres.db.models.timestamp import TimestampMixin
from sqlalchemy import Column, Text, Enum, Date, Integer, B... | 28.217391 | 77 | 0.70284 |
020c958738d513d46f59e6ab3a150876846bd725 | 4,372 | py | Python | transformer/Model.py | DragonYong/Sklearn | b604c4bc41ecfa5c10613f713d6ca5c73214c07c | [
"Apache-2.0"
] | null | null | null | transformer/Model.py | DragonYong/Sklearn | b604c4bc41ecfa5c10613f713d6ca5c73214c07c | [
"Apache-2.0"
] | null | null | null | transformer/Model.py | DragonYong/Sklearn | b604c4bc41ecfa5c10613f713d6ca5c73214c07c | [
"Apache-2.0"
] | 1 | 2021-02-03T07:35:20.000Z | 2021-02-03T07:35:20.000Z | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 2020-06-20-20:42
# @Author : TuringEmmy
# @Email : yonglonggeng@163.com
# @WeChat : csy_lgy
# @File : Model.py
# @Project : PaperProject
from tensorflow import keras
import tensorflow as tf
from Encoder import EncoderLayer
from Decoder import Deco... | 38.350877 | 101 | 0.655764 |
5a704ddda572c409ed66e6fed92f7c6c928a4a67 | 3,715 | py | Python | Packs/IntegrationsAndIncidentsHealthCheck/Scripts/IncidentsCheck_Widget_IncidentsErrorsInfo/IncidentsCheck_Widget_IncidentsErrorsInfo_test.py | diCagri/content | c532c50b213e6dddb8ae6a378d6d09198e08fc9f | [
"MIT"
] | 799 | 2016-08-02T06:43:14.000Z | 2022-03-31T11:10:11.000Z | Packs/IntegrationsAndIncidentsHealthCheck/Scripts/IncidentsCheck_Widget_IncidentsErrorsInfo/IncidentsCheck_Widget_IncidentsErrorsInfo_test.py | diCagri/content | c532c50b213e6dddb8ae6a378d6d09198e08fc9f | [
"MIT"
] | 9,317 | 2016-08-07T19:00:51.000Z | 2022-03-31T21:56:04.000Z | Packs/IntegrationsAndIncidentsHealthCheck/Scripts/IncidentsCheck_Widget_IncidentsErrorsInfo/IncidentsCheck_Widget_IncidentsErrorsInfo_test.py | diCagri/content | c532c50b213e6dddb8ae6a378d6d09198e08fc9f | [
"MIT"
] | 1,297 | 2016-08-04T13:59:00.000Z | 2022-03-31T23:43:06.000Z | import pytest
import demistomock as demisto
from IncidentsCheck_Widget_IncidentsErrorsInfo import main
@pytest.mark.parametrize('list_, expected', [
([{"Type": "note",
'Contents': '''[{"incidentid": "7", "numberoferrors": 2, "owner": "", "playbookname": "AutoFocusPolling",
"taskid": "3", "taskname":... | 51.597222 | 115 | 0.515209 |
f033186a9e29fcf7e9397995f5e29ffad5de84fa | 91 | py | Python | apps/ui_test/pixel_test.py | Obyoxar/RobolabStatistics | 08343ca3ac49df7efdac33692d7cc4b783e851f5 | [
"MIT"
] | 2 | 2017-11-30T21:12:11.000Z | 2017-12-01T07:52:43.000Z | apps/ui_test/pixel_test.py | Obyoxar/RobolabStatistics | 08343ca3ac49df7efdac33692d7cc4b783e851f5 | [
"MIT"
] | 14 | 2017-11-14T18:12:53.000Z | 2018-06-03T16:07:57.000Z | apps/ui_test/pixel_test.py | Obyoxar/RobolabStatistics | 08343ca3ac49df7efdac33692d7cc4b783e851f5 | [
"MIT"
] | 3 | 2018-02-05T10:40:03.000Z | 2018-02-09T09:29:19.000Z | from robolib.robogui import pixel_editor as pe
arr = pe.get_pixel_input(3, 3)
print(arr)
| 15.166667 | 46 | 0.769231 |
6513b34b1d2fa323c0abe3f38741b1315d816d6b | 13,494 | py | Python | AP_SS16/601/PythonSkript.py | DimensionalScoop/kautschuk | 90403f97cd60b9716cb6a06668196891d5d96578 | [
"MIT"
] | 3 | 2016-04-27T17:07:00.000Z | 2022-02-02T15:43:15.000Z | AP_SS16/601/PythonSkript.py | DimensionalScoop/kautschuk | 90403f97cd60b9716cb6a06668196891d5d96578 | [
"MIT"
] | 5 | 2016-04-27T17:10:03.000Z | 2017-06-20T14:54:20.000Z | AP_SS16/601/PythonSkript.py | DimensionalScoop/kautschuk | 90403f97cd60b9716cb6a06668196891d5d96578 | [
"MIT"
] | null | null | null | ##################################################### Import system libraries ######################################################
import matplotlib as mpl
mpl.rcdefaults()
mpl.rcParams.update(mpl.rc_params_from_file('meine-matplotlibrc'))
import matplotlib.pyplot as plt
import numpy as np
import scipy.constants as c... | 41.648148 | 246 | 0.604713 |
d7be1f814ab726843458fa2e3ed1eaa038d95499 | 15,543 | py | Python | Utils/py/GoPro/utils/Network.py | tarsoly/NaoTH | dcd2b67ef6bf9953c81d3e1b26e543b5922b7d52 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | Utils/py/GoPro/utils/Network.py | tarsoly/NaoTH | dcd2b67ef6bf9953c81d3e1b26e543b5922b7d52 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | Utils/py/GoPro/utils/Network.py | tarsoly/NaoTH | dcd2b67ef6bf9953c81d3e1b26e543b5922b7d52 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | import subprocess
import shutil
import re
import threading
import time
from utils import Logger, blackboard
from utils.Bluetooth import Bluetooth
# setup logger for network related logs
logger = Logger.getLogger("Network")
class Network(threading.Thread):
""" Handles the connection to the GoPro wifi network."""... | 41.010554 | 168 | 0.575693 |
045b46a0ef82f909b68faf68a12e9e1ef96dfc48 | 564 | py | Python | Python/B4-Personenzaehler/Personenzaehler Erweiterung1.py | frankyhub/Calliope | 335f0ef5ca9bcf57e14166319501ec9086bc09bf | [
"MIT"
] | null | null | null | Python/B4-Personenzaehler/Personenzaehler Erweiterung1.py | frankyhub/Calliope | 335f0ef5ca9bcf57e14166319501ec9086bc09bf | [
"MIT"
] | null | null | null | Python/B4-Personenzaehler/Personenzaehler Erweiterung1.py | frankyhub/Calliope | 335f0ef5ca9bcf57e14166319501ec9086bc09bf | [
"MIT"
] | null | null | null | def on_forever():
if input.button_is_pressed(Button.A):
basic.show_leds("""
. # # # .
# . . . #
# # # # #
# # # # #
# # # # #
""")
basic.set_led_color(0x00ff00)
else:
basic.show_leds("""
. # .... | 25.636364 | 61 | 0.342199 |
f0c3667d644489426aad07b52bcc30695caa3b1a | 3,142 | py | Python | PyStellar/stellar/psguser/dao/psguser_dao.py | psgstellar/Stellar | 947d4b3d9d6b9c74d4c9ebd29683793a8d86fad2 | [
"Apache-2.0"
] | 3 | 2021-01-24T17:07:55.000Z | 2021-02-20T20:11:13.000Z | PyStellar/stellar/psguser/dao/psguser_dao.py | psgstellar/Stellar | 947d4b3d9d6b9c74d4c9ebd29683793a8d86fad2 | [
"Apache-2.0"
] | 61 | 2021-01-10T12:59:01.000Z | 2021-06-24T09:19:20.000Z | PyStellar/stellar/psguser/dao/psguser_dao.py | psgstellar/Stellar | 947d4b3d9d6b9c74d4c9ebd29683793a8d86fad2 | [
"Apache-2.0"
] | 1 | 2021-01-14T05:23:32.000Z | 2021-01-14T05:23:32.000Z | import pymysql
from stellar.settings import MYSQLUSER, MYSQLNAME, MYSQLPASSWORD, MYSQLHOST, MYSQLPORT
class PsgUserList:
def psguserlistdao(self, sqluser):
return_json = {}
userList = []
try:
print('------try---------')
connection = pymysql.connect(
... | 29.641509 | 115 | 0.457989 |
aca63abe87a9834c0aa1c8f5b75832529b44a1c3 | 26,358 | py | Python | src/main/python/supervolt/supervoltbatterybluepy.py | BikeAtor/WoMoAtor | 700cc8b970dcfdd5af2f471df1a223d2a38cb1bf | [
"Apache-2.0"
] | null | null | null | src/main/python/supervolt/supervoltbatterybluepy.py | BikeAtor/WoMoAtor | 700cc8b970dcfdd5af2f471df1a223d2a38cb1bf | [
"Apache-2.0"
] | null | null | null | src/main/python/supervolt/supervoltbatterybluepy.py | BikeAtor/WoMoAtor | 700cc8b970dcfdd5af2f471df1a223d2a38cb1bf | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python3
'''
connect to: 84:28:D7:8F:54:70
notificationhandler installed
services:
Service <uuid=Generic Attribute handleStart=1 handleEnd=4>
Service <uuid=Generic Access handleStart=5 handleEnd=13>
Service <uuid=6e400001-b5a3-f393-e0a9-e50e24dcca9e handleStart=14 handleEnd=65535>
characteristics:
Cha... | 44.076923 | 144 | 0.492981 |
c5d1599077c4b40135f220c694c41da8ba3f9b89 | 517 | py | Python | dewar/app.py | shonenada-archives/dewar | 392b996771a35bc26e9c301cc2a25bad973e8f61 | [
"MIT"
] | null | null | null | dewar/app.py | shonenada-archives/dewar | 392b996771a35bc26e9c301cc2a25bad973e8f61 | [
"MIT"
] | null | null | null | dewar/app.py | shonenada-archives/dewar | 392b996771a35bc26e9c301cc2a25bad973e8f61 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
import os
from flask import Flask
from flask._compat import string_types
from dewar.config import CONFIG
from dewar.exts import setup_database, setup_login
def create_app(import_name=None, config=None):
app = Flask(import_name or __name__)
app.config.from_object('dewar.settings')
... | 19.148148 | 50 | 0.719536 |
c5f27c41240a309848e958b0a4ce80b36f91a527 | 13,887 | py | Python | Co-Simulation/Sumo/sumo-1.7.0/tools/contributed/sumopy/coremodules/scenario/scenario.py | uruzahe/carla | 940c2ab23cce1eda1ef66de35f66b42d40865fb1 | [
"MIT"
] | 4 | 2020-11-13T02:35:56.000Z | 2021-03-29T20:15:54.000Z | Co-Simulation/Sumo/sumo-1.7.0/tools/contributed/sumopy/coremodules/scenario/scenario.py | uruzahe/carla | 940c2ab23cce1eda1ef66de35f66b42d40865fb1 | [
"MIT"
] | 9 | 2020-12-09T02:12:39.000Z | 2021-02-18T00:15:28.000Z | Co-Simulation/Sumo/sumo-1.7.0/tools/contributed/sumopy/coremodules/scenario/scenario.py | uruzahe/carla | 940c2ab23cce1eda1ef66de35f66b42d40865fb1 | [
"MIT"
] | 1 | 2020-11-20T19:31:26.000Z | 2020-11-20T19:31:26.000Z | # Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
# Copyright (C) 2016-2020 German Aerospace Center (DLR) and others.
# SUMOPy module
# Copyright (C) 2012-2017 University of Bologna - DICAM
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public ... | 43.261682 | 331 | 0.523727 |
4f7c3a4c28bb29a469545eef1c757ec64f6229dc | 3,159 | py | Python | workspace/cogrob/service_manager/util/psutil_helper.py | CogRob/Rorg | dbf9d849e150404c117f6f0062476d995cec7316 | [
"BSD-3-Clause"
] | 8 | 2019-05-07T02:30:58.000Z | 2021-12-10T18:44:45.000Z | workspace/cogrob/service_manager/util/psutil_helper.py | CogRob/Rorg | dbf9d849e150404c117f6f0062476d995cec7316 | [
"BSD-3-Clause"
] | 1 | 2021-03-17T07:18:23.000Z | 2021-03-17T07:18:23.000Z | workspace/cogrob/service_manager/util/psutil_helper.py | CogRob/Rorg | dbf9d849e150404c117f6f0062476d995cec7316 | [
"BSD-3-Clause"
] | 2 | 2019-05-21T14:15:24.000Z | 2022-02-09T12:50:24.000Z | # Copyright (c) 2019, The Regents of the University of California
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, thi... | 35.897727 | 79 | 0.750237 |
8cc48f2bae485b9eb469fef513c798f3f07783b5 | 1,518 | py | Python | python/pyopenGL/ogl1/ogl4_ref_xy.py | SayanGhoshBDA/code-backup | 8b6135facc0e598e9686b2e8eb2d69dd68198b80 | [
"MIT"
] | 16 | 2018-11-26T08:39:42.000Z | 2019-05-08T10:09:52.000Z | python/pyopenGL/ogl1/ogl4_ref_xy.py | SayanGhoshBDA/code-backup | 8b6135facc0e598e9686b2e8eb2d69dd68198b80 | [
"MIT"
] | 8 | 2020-05-04T06:29:26.000Z | 2022-02-12T05:33:16.000Z | python/pyopenGL/ogl1/ogl4_ref_xy.py | SayanGhoshBDA/code-backup | 8b6135facc0e598e9686b2e8eb2d69dd68198b80 | [
"MIT"
] | 5 | 2020-02-11T16:02:21.000Z | 2021-02-05T07:48:30.000Z | # program to plot axes and reflect it in all the three parts
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import sys
def init():
#glClearColor(0.0,0.0,0.0,1.0) # set the background color to black (R,G,B,alpha)
#glClearColor(0.5,0.8,0.3,1.0)
glClearColor(1.0... | 28.111111 | 120 | 0.615942 |
8cedf8663f99ee360929be2879c25bc21d70c26d | 214 | py | Python | 30 Days of Code/30DoC-day-07/30DoC_day_7.py | nirobio/puzzles | fda8c84d8eefd93b40594636fb9b7f0fde02b014 | [
"MIT"
] | null | null | null | 30 Days of Code/30DoC-day-07/30DoC_day_7.py | nirobio/puzzles | fda8c84d8eefd93b40594636fb9b7f0fde02b014 | [
"MIT"
] | null | null | null | 30 Days of Code/30DoC-day-07/30DoC_day_7.py | nirobio/puzzles | fda8c84d8eefd93b40594636fb9b7f0fde02b014 | [
"MIT"
] | null | null | null | #!/bin/python3
import math
import os
import random
import re
import sys
if __name__ == '__main__':
num = int(input())
for i in range(1, 11):
answer = num * i
print(num, 'x', i, '=', answer, sep=' ')
| 14.266667 | 44 | 0.602804 |
50b354085ff178605b315754dbf968de4af6e243 | 1,767 | py | Python | DataProcess/augmentation/knn.py | ZhangQiHang-98/RFID_Scirpt | 0f74087add4cf16e2d201ad4f31cc1abd287db7e | [
"MIT"
] | 3 | 2021-12-24T04:52:03.000Z | 2021-12-27T02:14:49.000Z | DataProcess/augmentation/knn.py | ZhangQiHang-98/RFID_Scirpt | 0f74087add4cf16e2d201ad4f31cc1abd287db7e | [
"MIT"
] | null | null | null | DataProcess/augmentation/knn.py | ZhangQiHang-98/RFID_Scirpt | 0f74087add4cf16e2d201ad4f31cc1abd287db7e | [
"MIT"
] | null | null | null | import numpy as np
import operator
import utils
# 根据DTW矩阵选择N个邻居
def get_neighbors(x_train, x_test_instance, k, dist_fun, dist_fun_params,
pre_computed_matrix=None, index_test_instance=None,
return_distances=False):
"""
Given a test instance, this function returns its neighb... | 38.413043 | 91 | 0.649123 |
e88b4aec09a62641530a00112b502ad6de761e85 | 2,895 | py | Python | zencad/geom/boolops.py | Spiritdude/zencad | 4e63b1a6306dd235f4daa2791b10249f7546c95b | [
"MIT"
] | 5 | 2018-04-11T14:11:40.000Z | 2018-09-12T19:03:36.000Z | zencad/geom/boolops.py | Spiritdude/zencad | 4e63b1a6306dd235f4daa2791b10249f7546c95b | [
"MIT"
] | null | null | null | zencad/geom/boolops.py | Spiritdude/zencad | 4e63b1a6306dd235f4daa2791b10249f7546c95b | [
"MIT"
] | null | null | null | from OCC.Core.BRepAlgoAPI import BRepAlgoAPI_Fuse, BRepAlgoAPI_Cut, BRepAlgoAPI_Common, BRepAlgoAPI_Section
from OCC.Core.TopoDS import TopoDS_Shape
from zencad.geom.shape import shape_generator, Shape
from zencad.lazifier import lazy
from zencad.geom.boolops_base import occ_pair_union, occ_pair_difference, occ_pair_i... | 24.125 | 107 | 0.61658 |
fa664288070c63d67581b25a99ae9b95479e6435 | 1,355 | py | Python | Python/Searching/2/find_str_array_with_empty_str.py | Tikam02/Data_Structure_Algorithms | 7c17f744975a72fa42f0f3f892c0b7e041cdef0c | [
"MIT"
] | 5 | 2017-08-03T06:33:49.000Z | 2021-08-06T13:20:57.000Z | Python/Searching/2/find_str_array_with_empty_str.py | Tikam02/Data_Structure_Algorithms | 7c17f744975a72fa42f0f3f892c0b7e041cdef0c | [
"MIT"
] | null | null | null | Python/Searching/2/find_str_array_with_empty_str.py | Tikam02/Data_Structure_Algorithms | 7c17f744975a72fa42f0f3f892c0b7e041cdef0c | [
"MIT"
] | 6 | 2017-04-27T13:30:49.000Z | 2020-11-01T20:28:55.000Z | #!/usr/bin/env python
__author__ = "bt3"
''' Given a sorted an array with empty strings,
we use binary search to find some string (since the list is sorted):
--> we deal with the empty strings with strip and then run to left
and right, or move mid to the closed non-empty str (remember that
the index ... | 24.636364 | 72 | 0.509225 |
d773c9f2b4c2d28d332f7795fd8859e653243268 | 2,610 | py | Python | feedcrawler/imdb.py | rix1337/RSScrawler | 5a1c067148310c03321329d3fa409a4e4144fce7 | [
"MIT"
] | 63 | 2016-03-21T21:35:07.000Z | 2021-03-20T22:50:34.000Z | feedcrawler/imdb.py | rix1337/RSScrawler | 5a1c067148310c03321329d3fa409a4e4144fce7 | [
"MIT"
] | 200 | 2016-03-15T21:45:26.000Z | 2021-04-03T10:47:45.000Z | feedcrawler/imdb.py | rix1337/RSScrawler | 5a1c067148310c03321329d3fa409a4e4144fce7 | [
"MIT"
] | 25 | 2016-03-15T20:44:33.000Z | 2020-10-25T09:43:48.000Z | # -*- coding: utf-8 -*-
# FeedCrawler
# Projekt von https://github.com/rix1337
import re
from imdb import IMDb
from feedcrawler import internal
from feedcrawler.url import get_url
def clean_imdb_id(string):
integer = re.findall(r'\d+', string)[0]
return integer
def get_imdb_id(key, content, filename):
... | 31.829268 | 133 | 0.526054 |
a8fc0c31de8c2fff96b8f1d22bdc2d9c9b07447e | 629 | py | Python | Algorithms/Implementation/minimum_distances.py | byung-u/HackerRank | 4c02fefff7002b3af774b99ebf8d40f149f9d163 | [
"MIT"
] | null | null | null | Algorithms/Implementation/minimum_distances.py | byung-u/HackerRank | 4c02fefff7002b3af774b99ebf8d40f149f9d163 | [
"MIT"
] | null | null | null | Algorithms/Implementation/minimum_distances.py | byung-u/HackerRank | 4c02fefff7002b3af774b99ebf8d40f149f9d163 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import sys
from collections import Counter
from operator import itemgetter
from functools import reduce
n = int(input())
c = list(map(int, input().strip().split()))
# Check pair
cnt = Counter()
for n in c:
cnt[n] += 1
sorted_cnt = sorted(cnt.items(), key=itemgetter(1))
if sorted_cnt[-1][1]... | 21.689655 | 88 | 0.624801 |
7e37b5325e3035b5ff2cea22cc0c5982284a27fe | 2,178 | py | Python | view/user.py | sadlll/ablog | d04b532751c297fe9cd25563d08f48e8aaee7f48 | [
"Apache-2.0"
] | null | null | null | view/user.py | sadlll/ablog | d04b532751c297fe9cd25563d08f48e8aaee7f48 | [
"Apache-2.0"
] | null | null | null | view/user.py | sadlll/ablog | d04b532751c297fe9cd25563d08f48e8aaee7f48 | [
"Apache-2.0"
] | 1 | 2020-09-14T07:09:34.000Z | 2020-09-14T07:09:34.000Z | # coding:utf-8
from view import route, url_for, View, LoginView, NoLoginView
from model.user import User
@route('/signin', name='signin')
class SignIn(NoLoginView):
def get(self):
self.render('user/signin.html')
def post(self):
username = self.get_argument("username")
password = self... | 29.04 | 84 | 0.578972 |
7ef59da1552788ddb8ac73382580b7ca603964de | 3,021 | py | Python | scripts/ci/docker/build_docker_visit_ci.py | visit-dav/vis | c08bc6e538ecd7d30ddc6399ec3022b9e062127e | [
"BSD-3-Clause"
] | 226 | 2018-12-29T01:13:49.000Z | 2022-03-30T19:16:31.000Z | scripts/ci/docker/build_docker_visit_ci.py | visit-dav/vis | c08bc6e538ecd7d30ddc6399ec3022b9e062127e | [
"BSD-3-Clause"
] | 5,100 | 2019-01-14T18:19:25.000Z | 2022-03-31T23:08:36.000Z | scripts/ci/docker/build_docker_visit_ci.py | visit-dav/vis | c08bc6e538ecd7d30ddc6399ec3022b9e062127e | [
"BSD-3-Clause"
] | 84 | 2019-01-24T17:41:50.000Z | 2022-03-10T10:01:46.000Z | # Copyright (c) Lawrence Livermore National Security, LLC and other VisIt
# Project developers. See the top-level LICENSE file for dates and other
# details. No copyright assignment is required to contribute to VisIt.
#
# Helper script that drives our docker build and tag for ci
#
import os
import sys
import subpro... | 29.910891 | 93 | 0.633565 |
70b1b66e951dc832b8d3e80fca9085d5796af443 | 1,660 | py | Python | hystreet/hystreet_to_s3/main.py | cfleschhut/virushack | 2fe7ded0be8672b066edef7fed52573794db2ba5 | [
"Apache-2.0"
] | null | null | null | hystreet/hystreet_to_s3/main.py | cfleschhut/virushack | 2fe7ded0be8672b066edef7fed52573794db2ba5 | [
"Apache-2.0"
] | null | null | null | hystreet/hystreet_to_s3/main.py | cfleschhut/virushack | 2fe7ded0be8672b066edef7fed52573794db2ba5 | [
"Apache-2.0"
] | null | null | null | import requests
import pandas as pd
import os
import json
from datetime import datetime, timedelta
import boto3
client = boto3.client('s3')
df = pd.DataFrame(columns=['timestamp', 'station_id', 'pedestrians_count',
'unverified', 'weather_condition', 'temperature', 'min_temperature'])
heade... | 39.52381 | 118 | 0.643976 |
cbddfc46746292a5fbe8e1e60ff12db37496e862 | 324 | py | Python | DataStructures/LinkedList/ReversePrint.py | baby5/HackerRank | 1e68a85f40499adb9b52a4da16936f85ac231233 | [
"MIT"
] | null | null | null | DataStructures/LinkedList/ReversePrint.py | baby5/HackerRank | 1e68a85f40499adb9b52a4da16936f85ac231233 | [
"MIT"
] | null | null | null | DataStructures/LinkedList/ReversePrint.py | baby5/HackerRank | 1e68a85f40499adb9b52a4da16936f85ac231233 | [
"MIT"
] | null | null | null | #coding:utf-8
def ReversePrint(head):
data_list = []
node = head
while node.next:
data_list.append(node.data)
node = node.next
for data in data_list[::-1]:
print data
#smart
def ReversePrint(head):
if head is None:
return
ReversePrint(head.next)
print head.d... | 18 | 35 | 0.608025 |
1dc61ee5e6389d96da8b09b4cff094ce1233b614 | 374 | py | Python | Python/Courses/Python-Tutorials.Zulkarnine-Mahmud/00.Fundamentals/11.Prime.py | shihab4t/Books-Code | b637b6b2ad42e11faf87d29047311160fe3b2490 | [
"Unlicense"
] | null | null | null | Python/Courses/Python-Tutorials.Zulkarnine-Mahmud/00.Fundamentals/11.Prime.py | shihab4t/Books-Code | b637b6b2ad42e11faf87d29047311160fe3b2490 | [
"Unlicense"
] | null | null | null | Python/Courses/Python-Tutorials.Zulkarnine-Mahmud/00.Fundamentals/11.Prime.py | shihab4t/Books-Code | b637b6b2ad42e11faf87d29047311160fe3b2490 | [
"Unlicense"
] | null | null | null | from math import sqrt
def is_prime(number):
if number <= 1:
return False
if number == 2:
return True
if number % 2 == 0:
return False
for ith in range(3, int(sqrt(number) + 1), 2):
if number % ith == 0:
return False
return True
for i in range(1, 100000... | 18.7 | 50 | 0.534759 |
93187fd83973b8fbca60b0f1ff5b0682e92f67ba | 825 | py | Python | Boot2Root/hackthebox/Aragog/files/xxe.py | Kan1shka9/CTFs | 33ab33e094ea8b52714d5dad020c25730e91c0b0 | [
"MIT"
] | 21 | 2016-02-06T14:30:01.000Z | 2020-09-11T05:39:17.000Z | Boot2Root/hackthebox/Aragog/files/xxe.py | Kan1shka9/CTFs | 33ab33e094ea8b52714d5dad020c25730e91c0b0 | [
"MIT"
] | null | null | null | Boot2Root/hackthebox/Aragog/files/xxe.py | Kan1shka9/CTFs | 33ab33e094ea8b52714d5dad020c25730e91c0b0 | [
"MIT"
] | 7 | 2017-02-02T16:27:02.000Z | 2021-04-30T17:14:53.000Z | import requests
from base64 import b64decode
def GetFile(fname):
payload = '<!--?xml version="1.0" ?--><!DOCTYPE replace [<!ENTITY random SYSTEM "php://filter/convert.base64-encode/resource=' + fname + '"> ]> <details><subnet_mask>&random;</subnet_mask><test></test></details>'
resp = requests.post('http://10.10.10.7... | 29.464286 | 213 | 0.678788 |
9318c2f1b83543aa92256ed1080be85e42728219 | 1,178 | py | Python | Hackerrank_problems/day_of_the_programmer/solution.py | gbrls/CompetitiveCode | b6f1b817a655635c3c843d40bd05793406fea9c6 | [
"MIT"
] | 165 | 2020-10-03T08:01:11.000Z | 2022-03-31T02:42:08.000Z | Hackerrank_problems/day_of_the_programmer/solution.py | gbrls/CompetitiveCode | b6f1b817a655635c3c843d40bd05793406fea9c6 | [
"MIT"
] | 383 | 2020-10-03T07:39:11.000Z | 2021-11-20T07:06:35.000Z | Hackerrank_problems/day_of_the_programmer/solution.py | gbrls/CompetitiveCode | b6f1b817a655635c3c843d40bd05793406fea9c6 | [
"MIT"
] | 380 | 2020-10-03T08:05:04.000Z | 2022-03-19T06:56:59.000Z | #!/bin/python3
import math
import os
import random
import re
import sys
# LOGIC
# First we check if the year is 1918 the return 26.09.1918
# The if it not so then if year is (less then 1917 and divisible by 4) or (year greater then 1918 and divisible by 400
# or year divisible by 4 and not by 100 the the date will be... | 31 | 118 | 0.634126 |
9339a93f47eef2114943eb8af2c57de2f6620562 | 1,345 | py | Python | ppyt/mixins.py | yusukemurayama/ppytrading | 9804d0de870d77bf8a1c847736a636b1342d4600 | [
"MIT"
] | 4 | 2016-08-16T07:47:15.000Z | 2017-12-11T10:08:47.000Z | ppyt/mixins.py | yusukemurayama/ppytrading | 9804d0de870d77bf8a1c847736a636b1342d4600 | [
"MIT"
] | null | null | null | ppyt/mixins.py | yusukemurayama/ppytrading | 9804d0de870d77bf8a1c847736a636b1342d4600 | [
"MIT"
] | 2 | 2018-06-15T04:43:15.000Z | 2020-05-02T07:47:15.000Z | # coding: utf-8
import logging
logger = logging.getLogger(__name__)
class FinderMixin(object):
"""SimpleFinderクラスで検索できるようにするためのMixinです。"""
# 検索の際に使うキー
_findkey = '継承したクラスで定義してください。'
@classmethod
def get_key(self):
"""キーを取得します。"""
return self._findkey
class SingletonMixin(objec... | 23.189655 | 90 | 0.59777 |
87b87d1763a328310465408479971477ae20f28a | 141 | py | Python | data_tests/saved__backend__/cython/assign_func_boost.py | fluiddyn/transonic | a460e9f6d1139f79b668cb3306d1e8a7e190b72d | [
"BSD-3-Clause"
] | 88 | 2019-01-08T16:39:08.000Z | 2022-02-06T14:19:23.000Z | data_tests/saved__backend__/cython/assign_func_boost.py | fluiddyn/transonic | a460e9f6d1139f79b668cb3306d1e8a7e190b72d | [
"BSD-3-Clause"
] | 13 | 2019-06-20T15:53:10.000Z | 2021-02-09T11:03:29.000Z | data_tests/saved__backend__py3.9/cython/assign_func_boost.py | fluiddyn/transonic | a460e9f6d1139f79b668cb3306d1e8a7e190b72d | [
"BSD-3-Clause"
] | 1 | 2019-11-05T03:03:14.000Z | 2019-11-05T03:03:14.000Z | try:
import cython
except ImportError:
from transonic_cl import cython
def func(x):
return x ** 2
__transonic__ = ("0.3.3",)
| 11.75 | 35 | 0.652482 |
575b6ef0bbc6c4edd86b70af2c7678237d881e01 | 932 | py | Python | 2-resources/__CHEAT-SHEETS/cheatsheets-master/cheatsheets-master/dynamodb/python/conditional_put.py | eengineergz/Lambda | 1fe511f7ef550aed998b75c18a432abf6ab41c5f | [
"MIT"
] | 103 | 2019-08-30T10:04:40.000Z | 2022-03-30T22:14:44.000Z | 2-resources/__CHEAT-SHEETS/cheatsheets-master/cheatsheets-master/dynamodb/python/conditional_put.py | eengineergz/Lambda | 1fe511f7ef550aed998b75c18a432abf6ab41c5f | [
"MIT"
] | 6 | 2021-04-08T08:36:27.000Z | 2021-10-01T07:47:17.000Z | 2-resources/__CHEAT-SHEETS/cheatsheets-master/cheatsheets-master/dynamodb/python/conditional_put.py | eengineergz/Lambda | 1fe511f7ef550aed998b75c18a432abf6ab41c5f | [
"MIT"
] | 51 | 2019-06-10T06:11:46.000Z | 2022-03-30T16:33:05.000Z | import boto3
from botocore import exceptions
import time
client = boto3.Session(region_name='eu-west-1').client('dynamodb', aws_access_key_id='', aws_secret_access_key='', endpoint_url='http://localhost:4567')
try:
response = client.put_item(
TableName='gamescores',
Item={
'event': {'S... | 33.285714 | 152 | 0.571888 |
1076a69eb9b60999600a99815afd28cce01dd113 | 456 | py | Python | assets/udk/python/samples/swritercompclient.py | brnnnfx/openoffice-org | 8b1023c59fd9c7a58d108bb0b01dd1f8884c9163 | [
"Apache-2.0"
] | 5 | 2019-10-14T23:00:48.000Z | 2021-11-06T22:21:06.000Z | assets/udk/python/samples/swritercompclient.py | brnnnfx/openoffice-org | 8b1023c59fd9c7a58d108bb0b01dd1f8884c9163 | [
"Apache-2.0"
] | 31 | 2020-11-14T09:27:16.000Z | 2022-03-08T17:09:15.000Z | assets/udk/python/samples/swritercompclient.py | brnnnfx/openoffice-org | 8b1023c59fd9c7a58d108bb0b01dd1f8884c9163 | [
"Apache-2.0"
] | 15 | 2020-11-10T17:04:25.000Z | 2022-01-31T12:12:48.000Z | # instantiating
import uno
localContext = uno.getComponentContext()
resolver = localContext.ServiceManager.createInstanceWithContext(
"com.sun.star.bridge.UnoUrlResolver", localContext )
remoteContext = resolver.resolve( "uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext" )
remoteSmgr = remoteCon... | 32.571429 | 105 | 0.807018 |
d80e8c3acf4a628eafd56577e10ce6f8106f7a38 | 2,139 | py | Python | DataStructures/Queues/Zero.py | baby5/HackerRank | 1e68a85f40499adb9b52a4da16936f85ac231233 | [
"MIT"
] | null | null | null | DataStructures/Queues/Zero.py | baby5/HackerRank | 1e68a85f40499adb9b52a4da16936f85ac231233 | [
"MIT"
] | null | null | null | DataStructures/Queues/Zero.py | baby5/HackerRank | 1e68a85f40499adb9b52a4da16936f85ac231233 | [
"MIT"
] | null | null | null | #coding:utf-8
from collections import deque
import pdb
import time
Q = int(raw_input())
#BFS,真的好
for _ in xrange(Q):
N = int(raw_input())
queue = deque([(N, 0)])
factor_set = set()
while queue:
pdb.set_trace()
N, move = queue.popleft()
if N == 0:
print move
... | 23.25 | 73 | 0.519402 |
d818a9297d5b4eaf6922243040ecd24a8e61e3dd | 4,624 | py | Python | suds/mx/encoded.py | emad70/interactive-tutorials | 2cd4f6ed2c7d292f01be64d132c2ff4ffb4715ff | [
"Apache-2.0"
] | 2,750 | 2015-01-02T03:23:19.000Z | 2022-03-31T00:31:35.000Z | suds/mx/encoded.py | guiireal/interactive-tutorials | 9ca384d0f78ac36f963ab0ab65c7746b7f9f7db0 | [
"Apache-2.0"
] | 196 | 2015-01-22T06:33:34.000Z | 2022-03-27T23:26:23.000Z | suds/mx/encoded.py | guiireal/interactive-tutorials | 9ca384d0f78ac36f963ab0ab65c7746b7f9f7db0 | [
"Apache-2.0"
] | 2,271 | 2015-01-05T14:14:34.000Z | 2022-03-31T02:17:43.000Z | # This program is free software; you can redistribute it and/or modify
# it under the terms of the (LGPL) GNU Lesser General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will b... | 34.251852 | 78 | 0.595588 |
dc43dd3c9145b49df0127668dafd0b28adc0b2a8 | 14,264 | py | Python | abfahrt/Stationlist.py | Team-Zugig-zum-Erfolg/InformatiCup | 788076ac38bf6d8f462465b7fb96db14d13bed30 | [
"MIT"
] | 1 | 2022-01-30T14:30:02.000Z | 2022-01-30T14:30:02.000Z | abfahrt/Stationlist.py | Team-Zugig-zum-Erfolg/InformatiCup | 788076ac38bf6d8f462465b7fb96db14d13bed30 | [
"MIT"
] | null | null | null | abfahrt/Stationlist.py | Team-Zugig-zum-Erfolg/InformatiCup | 788076ac38bf6d8f462465b7fb96db14d13bed30 | [
"MIT"
] | null | null | null | """
This is Stationlist for managing the stations
"""
import sys
# This module provides access to some variables used or maintained by the interpreter and to functions that interact strongly with the interpreter. (https://docs.python.org/3/library/sys.html)
from typing import List
# This module provides runtime su... | 43.754601 | 301 | 0.600042 |
f4f970ce66d7772739fb8f156724413d502a308b | 664 | py | Python | api/tests/test_auth.py | scholaronroad/guts_2021_hackathon | 482b7b59317b67fc37f67f1ccfeaadbf811c00ca | [
"MIT"
] | 1 | 2021-02-05T15:58:02.000Z | 2021-02-05T15:58:02.000Z | api/tests/test_auth.py | nathanwelsh8/guts_2021_hackathon | d875000051a423db4a4bb1a8df35d6d9a9e9db63 | [
"MIT"
] | 2 | 2021-02-06T13:54:45.000Z | 2021-02-06T20:05:18.000Z | api/tests/test_auth.py | scholaronroad/guts_2021_hackathon | 482b7b59317b67fc37f67f1ccfeaadbf811c00ca | [
"MIT"
] | 2 | 2021-02-05T20:27:48.000Z | 2021-03-31T19:58:07.000Z | from django.test import TestCase
from rest_framework.test import APIClient
class TestToken(TestCase):
fixtures = ["users"]
def setUp(self):
self.client = APIClient()
def test_token_success(self):
resp = self.client.post(
"/token/", {"username": "jeff", "password": "sifjo12390... | 27.666667 | 78 | 0.611446 |
52919483f8e4fd4e8764d6bb82f1e913f9840a08 | 1,032 | py | Python | Problems/Dynamic Programming/Medium/MaxSubArraySumOneDeletion/max_sub_array_delete_one.py | dolong2110/Algorithm-By-Problems-Python | 31ecc7367aaabdd2b0ac0af7f63ca5796d70c730 | [
"MIT"
] | 1 | 2021-08-16T14:52:05.000Z | 2021-08-16T14:52:05.000Z | Problems/Dynamic Programming/Medium/MaxSubArraySumOneDeletion/max_sub_array_delete_one.py | dolong2110/Algorithm-By-Problems-Python | 31ecc7367aaabdd2b0ac0af7f63ca5796d70c730 | [
"MIT"
] | null | null | null | Problems/Dynamic Programming/Medium/MaxSubArraySumOneDeletion/max_sub_array_delete_one.py | dolong2110/Algorithm-By-Problems-Python | 31ecc7367aaabdd2b0ac0af7f63ca5796d70c730 | [
"MIT"
] | null | null | null | from typing import List
def maximumSum(arr: List[int]) -> int:
n = len(arr)
if n == 1:
return arr[0]
forward, backward, max_sum = [i for i in arr], [i for i in arr], arr[0]
for i in range(1, n):
if forward[i - 1] > 0:
forward[i] += forward[i - 1]
max_sum = max(max_s... | 33.290323 | 121 | 0.590116 |
8725316f927f9b7886a915e4397775f665bf0182 | 417 | py | Python | leetcode/345-Reverse-Vowels-of-a-String/ReverseVowelsofaString.py | cc13ny/all-in | bc0b01e44e121ea68724da16f25f7e24386c53de | [
"MIT"
] | 1 | 2017-05-18T06:11:02.000Z | 2017-05-18T06:11:02.000Z | leetcode/345-Reverse-Vowels-of-a-String/ReverseVowelsofaString.py | cc13ny/all-in | bc0b01e44e121ea68724da16f25f7e24386c53de | [
"MIT"
] | 1 | 2016-02-09T06:00:07.000Z | 2016-02-09T07:20:13.000Z | leetcode/345-Reverse-Vowels-of-a-String/ReverseVowelsofaString.py | cc13ny/all-in | bc0b01e44e121ea68724da16f25f7e24386c53de | [
"MIT"
] | 2 | 2019-06-27T09:07:26.000Z | 2019-07-01T04:40:13.000Z | class Solution(object):
def reverseVowels(self, s):
"""
:type s: str
:rtype: str
"""
vowels = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']
ls = list(s)
idx = [i for i in xrange(len(s)) if s[i] in vowels]
for i in xrange(len(idx) / 2):
... | 26.0625 | 67 | 0.395683 |
872677c797844295cf5a86c1d71caf21842d8edb | 1,783 | py | Python | zencad/examples/4.Assemble/manual-control.py | Spiritdude/zencad | 4e63b1a6306dd235f4daa2791b10249f7546c95b | [
"MIT"
] | 5 | 2018-04-11T14:11:40.000Z | 2018-09-12T19:03:36.000Z | zencad/examples/4.Assemble/manual-control.py | Spiritdude/zencad | 4e63b1a6306dd235f4daa2791b10249f7546c95b | [
"MIT"
] | null | null | null | zencad/examples/4.Assemble/manual-control.py | Spiritdude/zencad | 4e63b1a6306dd235f4daa2791b10249f7546c95b | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
"""
ZenCad example: manual-control
We can control current object position in real time.
In that example we create special widget to change link`s positions by sliders.
"""
from zencad import *
import zencad.assemble
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui impo... | 22.858974 | 105 | 0.639372 |
5e815bdaec1a3e9418959960b1ea1fa3dadbe370 | 516 | py | Python | INBa/2015/Semyenov_A_N/task_6_24.py | YukkaSarasti/pythonintask | eadf4245abb65f4400a3bae30a4256b4658e009c | [
"Apache-2.0"
] | null | null | null | INBa/2015/Semyenov_A_N/task_6_24.py | YukkaSarasti/pythonintask | eadf4245abb65f4400a3bae30a4256b4658e009c | [
"Apache-2.0"
] | null | null | null | INBa/2015/Semyenov_A_N/task_6_24.py | YukkaSarasti/pythonintask | eadf4245abb65f4400a3bae30a4256b4658e009c | [
"Apache-2.0"
] | null | null | null | #Задача 6. Вариант 24
#Создайте игру, в которой компьютер загадывает название одной из четырех основных мастей лошадей, а игрок должен его угадать.
#Semyenov A.N.
#30.03.2016
print('Угадайте название одной из четырех основных мастей лошадей, которую загадал компьютер')
import random
a = random.choice(['гнедая', 'рыжая... | 30.352941 | 125 | 0.697674 |
0d8617f0eccfa369ae84f29f65adfc12be441e73 | 504 | py | Python | 942-di-string-match/942-di-string-match.py | hyeseonko/LeetCode | 48dfc93f1638e13041d8ce1420517a886abbdc77 | [
"MIT"
] | 2 | 2021-12-05T14:29:06.000Z | 2022-01-01T05:46:13.000Z | 942-di-string-match/942-di-string-match.py | hyeseonko/LeetCode | 48dfc93f1638e13041d8ce1420517a886abbdc77 | [
"MIT"
] | null | null | null | 942-di-string-match/942-di-string-match.py | hyeseonko/LeetCode | 48dfc93f1638e13041d8ce1420517a886abbdc77 | [
"MIT"
] | null | null | null | class Solution:
def diStringMatch(self, s: str) -> List[int]:
lens = len(s)
numset = [_ for _ in range(lens+1)]
output=[]
left_pointer=0
right_pointer=lens
for each in s:
if each == "I":
output.append(numset[left_pointer])
l... | 31.5 | 52 | 0.519841 |
635385078823fa3390a52f4968f1d520382ff312 | 3,101 | py | Python | research/cv/AttGAN/src/utils.py | leelige/mindspore | 5199e05ba3888963473f2b07da3f7bca5b9ef6dc | [
"Apache-2.0"
] | 77 | 2021-10-15T08:32:37.000Z | 2022-03-30T13:09:11.000Z | research/cv/AttGAN/src/utils.py | leelige/mindspore | 5199e05ba3888963473f2b07da3f7bca5b9ef6dc | [
"Apache-2.0"
] | 3 | 2021-10-30T14:44:57.000Z | 2022-02-14T06:57:57.000Z | research/cv/AttGAN/src/utils.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... | 37.361446 | 104 | 0.66011 |
63afc70d57fc91e27e1df9b16684375e858a385e | 3,121 | py | Python | update_avatars.py | codeforffm/codefor.de | 0a4e941b8527808e8f647b73aabb0b072f576927 | [
"MIT"
] | null | null | null | update_avatars.py | codeforffm/codefor.de | 0a4e941b8527808e8f647b73aabb0b072f576927 | [
"MIT"
] | null | null | null | update_avatars.py | codeforffm/codefor.de | 0a4e941b8527808e8f647b73aabb0b072f576927 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
"""
This script updates all the avatars for the lab members.
If you want to re-download all images, you need to create a personal access token on github and add to both http
requests using basic auth. Otherwise you'll be stopped half-way by github's rate limits.
"""
import glob
import os
import l... | 33.55914 | 117 | 0.651394 |
63b7b6e0a1435eda29772922d491196640dfc4a3 | 1,687 | py | Python | pytestDemo/testcases/api_test/test_01_get_info.py | lthinktime/testdemo | 509656d62535ed06e222c08671db11e31d9b3162 | [
"Apache-2.0"
] | null | null | null | pytestDemo/testcases/api_test/test_01_get_info.py | lthinktime/testdemo | 509656d62535ed06e222c08671db11e31d9b3162 | [
"Apache-2.0"
] | null | null | null | pytestDemo/testcases/api_test/test_01_get_info.py | lthinktime/testdemo | 509656d62535ed06e222c08671db11e31d9b3162 | [
"Apache-2.0"
] | null | null | null | import pytest
import allure
from testcases.conftest import api_data
from common.logger import logger
import requests
import jsonschema
import jsonpath
from common.json_schema import get_schema_from_file
@allure.step("步骤1 ==>> 获取所有用户信息")
def step_1():
logger.info("步骤1 ==>> 获取所有用户信息")
@allure.step("步骤1 ==>> 获取某个用... | 32.442308 | 96 | 0.634855 |
f694ec0f7973f903f3f66217075b1884f79c2a62 | 4,189 | py | Python | marsyas-vamp/marsyas/src/marsyas_python/bello2000ismir.py | jaouahbi/VampPlugins | 27c2248d1c717417fe4d448cdfb4cb882a8a336a | [
"Apache-2.0"
] | null | null | null | marsyas-vamp/marsyas/src/marsyas_python/bello2000ismir.py | jaouahbi/VampPlugins | 27c2248d1c717417fe4d448cdfb4cb882a8a336a | [
"Apache-2.0"
] | null | null | null | marsyas-vamp/marsyas/src/marsyas_python/bello2000ismir.py | jaouahbi/VampPlugins | 27c2248d1c717417fe4d448cdfb4cb882a8a336a | [
"Apache-2.0"
] | null | null | null |
# Proof-of-concept implementation of the monophonic transcription
# system described by Bello, Monti and Sandler in ISMIR 2000.
#!/usr/bin/evn python
from pylab import *
import marsyas
import sys
msm = marsyas.MarSystemManager()
# create a MarSystem from a recursive list specification
def create(net):
composite... | 28.114094 | 128 | 0.603247 |
1008605b19b680df4b83946f22f6326096310ad3 | 8,796 | py | Python | Packs/QualysFIM/Integrations/QualysFIM/QualysFIM_test.py | diCagri/content | c532c50b213e6dddb8ae6a378d6d09198e08fc9f | [
"MIT"
] | 799 | 2016-08-02T06:43:14.000Z | 2022-03-31T11:10:11.000Z | Packs/QualysFIM/Integrations/QualysFIM/QualysFIM_test.py | diCagri/content | c532c50b213e6dddb8ae6a378d6d09198e08fc9f | [
"MIT"
] | 9,317 | 2016-08-07T19:00:51.000Z | 2022-03-31T21:56:04.000Z | Packs/QualysFIM/Integrations/QualysFIM/QualysFIM_test.py | diCagri/content | c532c50b213e6dddb8ae6a378d6d09198e08fc9f | [
"MIT"
] | 1,297 | 2016-08-04T13:59:00.000Z | 2022-03-31T23:43:06.000Z | import json
import io
BASE_URL = 'https://gateway.qg2.apps.qualys.eu/'
DATE_FORMAT = '%Y-%m-%dT%H:%M:%S.%fZ'
def load_mock_response(file_name: str) -> dict:
"""
Load one of the mock responses to be used for assertion.
Args:
file_name (str): Name of the mock response JSON file to return.
"""
... | 39.443946 | 86 | 0.674511 |
63f29078bfc785c4aeb828fd93e62abc4369d907 | 7,005 | py | Python | src/onegov/org/elements.py | politbuero-kampagnen/onegov-cloud | 20148bf321b71f617b64376fe7249b2b9b9c4aa9 | [
"MIT"
] | null | null | null | src/onegov/org/elements.py | politbuero-kampagnen/onegov-cloud | 20148bf321b71f617b64376fe7249b2b9b9c4aa9 | [
"MIT"
] | null | null | null | src/onegov/org/elements.py | politbuero-kampagnen/onegov-cloud | 20148bf321b71f617b64376fe7249b2b9b9c4aa9 | [
"MIT"
] | null | null | null | """ Contains small helper classes used as abstraction for various templating
macros.
"""
from random import choice
from lxml.html import builder, tostring
from onegov.core.elements import Element
from onegov.org import _
from purl import URL
class AccessMixin(object):
@property
def access(self):
"... | 28.13253 | 79 | 0.560885 |
63fe59fb0d01bc1fc16f4695f476fe6820b2c92a | 6,876 | py | Python | tests/api/insert_sample_data.py | akgunkel/sawtooth-next-directory | a88833033ab30e9091479a38947f04c5e396ca46 | [
"Apache-2.0"
] | null | null | null | tests/api/insert_sample_data.py | akgunkel/sawtooth-next-directory | a88833033ab30e9091479a38947f04c5e396ca46 | [
"Apache-2.0"
] | 1 | 2019-07-08T22:32:43.000Z | 2019-07-08T22:32:43.000Z | tests/api/insert_sample_data.py | akgunkel/sawtooth-next-directory | a88833033ab30e9091479a38947f04c5e396ca46 | [
"Apache-2.0"
] | null | null | null | # Copyright 2019 Contributors to Hyperledger Sawtooth
#
# 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 ... | 34.552764 | 84 | 0.665067 |
1216f4a990ee1c65a9385d3ec4b4fbca2d1a914a | 1,258 | py | Python | spangle/error_handler.py | tkamenoko/spangle | 068479660a03239aa69c935d7ca0418c491d92da | [
"MIT"
] | 2 | 2019-11-17T06:38:56.000Z | 2019-12-01T15:32:03.000Z | spangle/error_handler.py | tkamenoko/spangle | 068479660a03239aa69c935d7ca0418c491d92da | [
"MIT"
] | null | null | null | spangle/error_handler.py | tkamenoko/spangle | 068479660a03239aa69c935d7ca0418c491d92da | [
"MIT"
] | null | null | null | """
Application blueprint for `Exception`.
"""
from __future__ import annotations
from collections.abc import Callable
from .handler_protocols import ErrorHandlerProtocol
__all__ = ["ErrorHandler"]
class ErrorHandler:
"""
When exceptions are raised, `spangle.api.Api` calls registered view.
"""
__... | 24.666667 | 88 | 0.597774 |
0d52e45804389650cfc4a7cab3b6769bc9aaa243 | 1,084 | py | Python | python/course/leetcode/1~27/9. Palindrome Number.py | TimVan1596/ACM-ICPC | 07f7d728db1ecd09c5a3d0f05521930b14eb9883 | [
"Apache-2.0"
] | 1 | 2019-05-22T07:12:34.000Z | 2019-05-22T07:12:34.000Z | python/course/leetcode/1~27/9. Palindrome Number.py | TimVan1596/ACM-ICPC | 07f7d728db1ecd09c5a3d0f05521930b14eb9883 | [
"Apache-2.0"
] | 3 | 2021-12-10T01:13:54.000Z | 2021-12-14T21:18:42.000Z | python/course/leetcode/1~27/9. Palindrome Number.py | TimVan1596/ACM-ICPC | 07f7d728db1ecd09c5a3d0f05521930b14eb9883 | [
"Apache-2.0"
] | null | null | null | # -*- coding:utf-8 -*-
# @Time:2020/6/19 11:53
# @Author:TimVan
# @File:9. Palindrome Number.py
# @Software:PyCharm
# Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
#
# Example 1:
# Input: 121
# Output: true
# Example 2:
# Input: -121
# Output: fal... | 24.636364 | 118 | 0.605166 |
b49b95bedd4bd2d95586421162a3c182a04391ec | 3,698 | py | Python | packages/watchmen-rest-doll/src/watchmen_rest_doll/meta_import/validator.py | Indexical-Metrics-Measure-Advisory/watchmen | c54ec54d9f91034a38e51fd339ba66453d2c7a6d | [
"MIT"
] | null | null | null | packages/watchmen-rest-doll/src/watchmen_rest_doll/meta_import/validator.py | Indexical-Metrics-Measure-Advisory/watchmen | c54ec54d9f91034a38e51fd339ba66453d2c7a6d | [
"MIT"
] | null | null | null | packages/watchmen-rest-doll/src/watchmen_rest_doll/meta_import/validator.py | Indexical-Metrics-Measure-Advisory/watchmen | c54ec54d9f91034a38e51fd339ba66453d2c7a6d | [
"MIT"
] | null | null | null | from typing import List, Optional, Union
from watchmen_auth import PrincipalService
from watchmen_meta.admin import UserService
from watchmen_meta.common import StorageService
from watchmen_meta.system import TenantService
from watchmen_model.admin import User
from watchmen_model.common import TenantBasedTuple, UserBa... | 35.902913 | 115 | 0.790157 |
d364fb8e3ef05b69d4060732226270237c8f2544 | 1,537 | py | Python | quark_core_api/core/application.py | arcticle/Quark | 17aa5b5869a9e9c7a04c1a371fef5998f33dc319 | [
"MIT"
] | null | null | null | quark_core_api/core/application.py | arcticle/Quark | 17aa5b5869a9e9c7a04c1a371fef5998f33dc319 | [
"MIT"
] | null | null | null | quark_core_api/core/application.py | arcticle/Quark | 17aa5b5869a9e9c7a04c1a371fef5998f33dc319 | [
"MIT"
] | null | null | null | import os
from datetime import datetime
from quark_core_api.context import ApplicationContext, WorkspaceContext
from quark_core_api.common import ContextInitializer
from quark_core_api.core import QuarkWorkspace
from quark_core_api.exceptions import InvalidContextException
class QuarkApplication(object):
def __in... | 30.74 | 75 | 0.669486 |
9f2300f018aa10f8ecc673902a93e30b2aac9049 | 460 | py | Python | Packs/CommonScripts/Scripts/LoadJSON/LoadJSON.py | diCagri/content | c532c50b213e6dddb8ae6a378d6d09198e08fc9f | [
"MIT"
] | 799 | 2016-08-02T06:43:14.000Z | 2022-03-31T11:10:11.000Z | Packs/CommonScripts/Scripts/LoadJSON/LoadJSON.py | diCagri/content | c532c50b213e6dddb8ae6a378d6d09198e08fc9f | [
"MIT"
] | 9,317 | 2016-08-07T19:00:51.000Z | 2022-03-31T21:56:04.000Z | Packs/CommonScripts/Scripts/LoadJSON/LoadJSON.py | diCagri/content | c532c50b213e6dddb8ae6a378d6d09198e08fc9f | [
"MIT"
] | 1,297 | 2016-08-04T13:59:00.000Z | 2022-03-31T23:43:06.000Z | import demistomock as demisto
from CommonServerPython import *
import json
def load_json(args):
json_str = args['input']
obj = json.loads(json_str, strict=False)
return {
"EntryContext": {"JsonObject": obj},
"Type": entryTypes['note'],
"ContentsFormat": formats['json'],
"... | 20.909091 | 55 | 0.634783 |
4c7e664aa4a355f327405e0ad55c649b8efc501b | 301 | py | Python | src/onegov/ballot/models/vote/__init__.py | politbuero-kampagnen/onegov-cloud | 20148bf321b71f617b64376fe7249b2b9b9c4aa9 | [
"MIT"
] | null | null | null | src/onegov/ballot/models/vote/__init__.py | politbuero-kampagnen/onegov-cloud | 20148bf321b71f617b64376fe7249b2b9b9c4aa9 | [
"MIT"
] | null | null | null | src/onegov/ballot/models/vote/__init__.py | politbuero-kampagnen/onegov-cloud | 20148bf321b71f617b64376fe7249b2b9b9c4aa9 | [
"MIT"
] | null | null | null | from onegov.ballot.models.vote.ballot import Ballot
from onegov.ballot.models.vote.ballot import BallotResult
from onegov.ballot.models.vote.complex_vote import ComplexVote
from onegov.ballot.models.vote.vote import Vote
__all__ = [
'Ballot',
'BallotResult',
'ComplexVote',
'Vote',
]
| 25.083333 | 62 | 0.760797 |
2c8548078d83db95a9d1cb680d04fe04dd9599b1 | 1,092 | py | Python | verto/processors/RemoveTitlePreprocessor.py | uccser/verto | d36aa88b208f1700fafc033679bd1e9775496d25 | [
"MIT"
] | 4 | 2017-04-10T06:09:54.000Z | 2019-05-04T02:07:40.000Z | verto/processors/RemoveTitlePreprocessor.py | uccser/verto | d36aa88b208f1700fafc033679bd1e9775496d25 | [
"MIT"
] | 268 | 2017-04-03T20:40:46.000Z | 2022-02-04T20:10:08.000Z | verto/processors/RemoveTitlePreprocessor.py | uccser/kordac | d36aa88b208f1700fafc033679bd1e9775496d25 | [
"MIT"
] | 1 | 2019-01-07T15:46:31.000Z | 2019-01-07T15:46:31.000Z | from markdown.preprocessors import Preprocessor
import re
class RemoveTitlePreprocessor(Preprocessor):
'''Removes the first found title from the given document.
'''
def __init__(self, ext, *args, **kwargs):
'''
Args:
ext: An instance of the VertoExtension.
'''
... | 26 | 73 | 0.57326 |
2c9ab2b931dbce395e5a5fe006191ce0b572f0a3 | 1,004 | py | Python | elements/python/10/7/soln.py | mmcloughlin/problems | 6095842ffe007a12ec8c2093850515aa4e046616 | [
"MIT"
] | 11 | 2019-02-08T06:54:34.000Z | 2021-08-07T18:57:39.000Z | elements/python/10/7/soln.py | mmcloughlin/problems | 6095842ffe007a12ec8c2093850515aa4e046616 | [
"MIT"
] | 1 | 2019-05-21T08:14:10.000Z | 2019-05-21T08:14:10.000Z | elements/python/10/7/soln.py | mmcloughlin/problems | 6095842ffe007a12ec8c2093850515aa4e046616 | [
"MIT"
] | null | null | null | class Node(object):
def __init__(self, v, l=None, r=None):
self.value = v
self.left = l
self.right = r
def has_path_with_sum(n, target):
if n is None:
return target == 0
target -= n.value
return has_path_with_sum(n.left, target) or has_path_with_sum(n.right, target)
d... | 19.307692 | 82 | 0.538845 |
1a64bef334798408d215667559993f73723e31be | 7,888 | py | Python | Packs/Armorblox/Integrations/Armorblox/Armorblox.py | diCagri/content | c532c50b213e6dddb8ae6a378d6d09198e08fc9f | [
"MIT"
] | 799 | 2016-08-02T06:43:14.000Z | 2022-03-31T11:10:11.000Z | Packs/Armorblox/Integrations/Armorblox/Armorblox.py | diCagri/content | c532c50b213e6dddb8ae6a378d6d09198e08fc9f | [
"MIT"
] | 9,317 | 2016-08-07T19:00:51.000Z | 2022-03-31T21:56:04.000Z | Packs/Armorblox/Integrations/Armorblox/Armorblox.py | diCagri/content | c532c50b213e6dddb8ae6a378d6d09198e08fc9f | [
"MIT"
] | 1,297 | 2016-08-04T13:59:00.000Z | 2022-03-31T23:43:06.000Z | import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
import dateparser
import requests
import json
import collections
# disable insecure warnings
requests.packages.urllib3.disable_warnings()
DATE_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
MAX_INCIDENTS_TO_FETCH = demisto.params().get('max_fet... | 35.531532 | 126 | 0.67609 |
203004290cf61c41b876d198237a5b552f1d4ffb | 95 | py | Python | Bibliothek/apps.py | wmles/scholarium.at | d2356b3e475df772382e035ddcb839fc7dae4305 | [
"MIT"
] | 1 | 2017-07-24T10:19:36.000Z | 2017-07-24T10:19:36.000Z | Bibliothek/apps.py | valuehack/scholarium.at | b81220ab18ae6db057132ae2cc43afc22545e5e6 | [
"MIT"
] | 135 | 2017-07-31T20:11:59.000Z | 2022-03-11T23:16:37.000Z | Bibliothek/apps.py | valuehack/scholarium.at | b81220ab18ae6db057132ae2cc43afc22545e5e6 | [
"MIT"
] | 4 | 2017-11-20T12:10:50.000Z | 2018-03-12T10:51:12.000Z | from django.apps import AppConfig
class BibliothekConfig(AppConfig):
name = 'Bibliothek'
| 15.833333 | 34 | 0.768421 |
64bfc1b5ab6d3bce2f0c51305b52168a81dd95a2 | 445 | py | Python | ais3-pre-exam-2022-writeup/Crypto/Fast Cipher/cipher.py | Jimmy01240397/balsn-2021-writeup | 91b71dfbddc1c214552280b12979a82ee1c3cb7e | [
"MIT"
] | null | null | null | ais3-pre-exam-2022-writeup/Crypto/Fast Cipher/cipher.py | Jimmy01240397/balsn-2021-writeup | 91b71dfbddc1c214552280b12979a82ee1c3cb7e | [
"MIT"
] | null | null | null | ais3-pre-exam-2022-writeup/Crypto/Fast Cipher/cipher.py | Jimmy01240397/balsn-2021-writeup | 91b71dfbddc1c214552280b12979a82ee1c3cb7e | [
"MIT"
] | null | null | null | from secrets import randbelow
M = 2**1024
def f(x):
# this is a *fast* function
return (
4 * x**4 + 8 * x**8 + 7 * x**7 + 6 * x**6 + 3 * x**3 + 0x48763
) % M
def encrypt(pt, key):
ct = []
for c in pt:
ct.append(c ^ (key & 0xFF))
key = f(key)
return bytes(ct)
if __n... | 17.8 | 70 | 0.496629 |
80932184765c7e3564ccb848d6557f631079ec4e | 1,473 | py | Python | RasPi/main.py | Jugendhackt/SMocket | 6aa495f3052c85f503ebf0e81b3ee5799cea37b2 | [
"MIT"
] | null | null | null | RasPi/main.py | Jugendhackt/SMocket | 6aa495f3052c85f503ebf0e81b3ee5799cea37b2 | [
"MIT"
] | null | null | null | RasPi/main.py | Jugendhackt/SMocket | 6aa495f3052c85f503ebf0e81b3ee5799cea37b2 | [
"MIT"
] | null | null | null | import network
import requests
import sched, time
URL = "http://localhost/switch.php"
devicesTurnedOn = False
#Timer
s = sched.scheduler(time.time, time.sleep)
#Speicher der Daten
status = [3,0,0]
def loop():
print("Loop runs again ...")
userIstAnwesend = network.recognize()
if userIstAnwesend == 1:
print("U... | 18.884615 | 55 | 0.696538 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.