max_stars_repo_path stringlengths 3 269 | max_stars_repo_name stringlengths 4 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.05M | score float64 0.23 5.13 | int_score int64 0 5 |
|---|---|---|---|---|---|---|
cogs/emojis.py | sah-py/twitch-bot-py | 0 | 12780351 | import discord
import requests
import json
import asyncio
from os import environ
from discord.ext import commands
from io import StringIO
from urllib.request import urlopen
from twitch import TwitchClient
class Emojis:
def __init__(self, bot):
self.bot = bot
self.messages = []
... | 2.640625 | 3 |
alpha_vantage.py | bubelov/market-plots | 3 | 12780352 | from dotenv import load_dotenv
from os.path import join, dirname
from dateutil import parser
from enum import Enum
from typing import List
import os
import urllib.request as url_request
import json
from dataclasses import dataclass
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
dotenv_pa... | 2.546875 | 3 |
AlgoMethod/full_search/double_array_full_serach/01.py | Nishi05/Competitive-programming | 0 | 12780353 | import math
def isprime(x):
if x == 2:
return 1
if x < 2 or x % 2 == 0:
return 0
i = 3
while i <= math.sqrt(x):
if x % i == 0:
return 0
i += 2
return 1
n = int(input())
lst = list(map(int, input().split()))
print(sum([isprime(i) for i in lst]))
| 3.859375 | 4 |
ibsng/handler/user/change_status.py | ParspooyeshFanavar/pyibsng | 6 | 12780354 | """Change user status API method."""
from ibsng.handler.handler import Handler
class changeStatus(Handler):
"""Change user status method class."""
def control(self):
"""Validate inputs after setup method.
:return: None
:rtype: None
"""
self.is_valid(self.user_id, int)... | 2.8125 | 3 |
record.py | kpgx/sensor_Tag | 0 | 12780355 | <filename>record.py
import time
import os
from threading import Thread
from bluepy.btle import BTLEException
from bluepy.sensortag import SensorTag
IR_TEMP = "ir_temp"
ACCELEROMETER = "accelerometer"
HUMIDITY = "humidity"
MAGNETOMETER = "magnetometer"
BAROMETER = "barometer"
GYROSCOPE = "gyroscope"
BATTERY = "battery"... | 2.5625 | 3 |
vk_bot/app.py | alexeyqu/2bots | 0 | 12780356 | <filename>vk_bot/app.py
#! /usr/bin/python3
from flask import Flask, request, json
from settings import token, confirmation_token
import vk
from time import sleep
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello from Flask!'
@app.route('/', methods=['POST'])
def processing():
#Распаков... | 2.328125 | 2 |
python/tests/test_product_service.py | gregorriegler/ValidateAndAddProduct-Refactoring-Kata | 12 | 12780357 | from approvaltests import verify
from database import DatabaseAccess
from product_service import validate_and_add
from response import ProductFormData
class FakeDatabase(DatabaseAccess):
def __init__(self):
self.product = None
def store_product(self, product):
self.product = product
... | 2.609375 | 3 |
src/dirbs/cli/listgen.py | a-wakeel/DIRBS-Core | 19 | 12780358 | <reponame>a-wakeel/DIRBS-Core<filename>src/dirbs/cli/listgen.py
"""
DIRBS CLI for list generation (Blacklist, Exception, Notification). Installed as a dirbs-listgen console script.
Copyright (c) 2018-2021 Qualcomm Technologies, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or with... | 1.476563 | 1 |
project/Lagou/Analyzer.py | zhengbomo/python_practice | 2 | 12780359 | #!/usr/bin/python
# -*- coding:utf-8 -*-
from LagouDb import LagouDb
class Analyzer(object):
def __init__(self):
self.db = LagouDb()
# 统计最受欢迎的工作
@staticmethod
def get_popular_jobs(since=None):
if since:
pass
else:
pass
# 统计职位在不同城市的薪资情况
def get_... | 3.109375 | 3 |
contrib/frontends/django/nntpchan/nntpchan/frontend/templatetags/chanup.py | majestrate/nntpchan | 233 | 12780360 | <gh_stars>100-1000
from django import template
from django.template.defaultfilters import stringfilter
from django.utils.html import conditional_escape
from django.utils.safestring import mark_safe
from nntpchan.frontend.models import Newsgroup, Post
import re
from urllib.parse import urlparse
from html import unes... | 2.21875 | 2 |
data/__init__.py | LeileiCao/SFD_Pytorch | 1 | 12780361 | <filename>data/__init__.py
from .wider_face import detection_collate, FACE_CLASSES, FACEDetection, FACEAnnotationTransform
from .data_augment import *
from .config import *
| 1.226563 | 1 |
lib/python2.7/site-packages/tdl/queue/abstractions/response/fatal_error_response.py | DPNT-Sourcecode/CHK-uimw01 | 0 | 12780362 | from tdl.queue.actions.stop_action import StopAction
class FatalErrorResponse:
def __init__(self, message):
self._message = message
self.client_action = StopAction
def get_audit_text(self):
return 'error = "{0}"'.format(self._message)
| 2.328125 | 2 |
explore/tests/test_ContCont.py | idc9/explore | 0 | 12780363 | <gh_stars>0
import numpy as np
import pandas as pd
from itertools import product
from explore.ContCont import ContCont
def data_iter():
n = 20
a = np.random.normal(size=n)
b = np.random.normal(size=n)
yield a, b
a = pd.Series(a, index=np.arange(n).astype(str))
b = pd.Series(b, index=np.ara... | 2.46875 | 2 |
data_as_code/__main__.py | Mikuana/data_as_code | 2 | 12780364 | <reponame>Mikuana/data_as_code
from data_as_code._commands import menu
if __name__ == '__main__':
menu()
| 1.164063 | 1 |
test/test_extract.py | ta-assistant/Admin-CLI | 1 | 12780365 | <filename>test/test_extract.py
import unittest
import os,sys,inspect
import zipfile
import json
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0,parentdir)
from lib.file_management.file_management_lib import FileEditor, D... | 2.921875 | 3 |
random_search/synthetic_environment.py | shercklo/LMRS | 38 | 12780366 | <filename>random_search/synthetic_environment.py<gh_stars>10-100
import torch
import torch.nn as nn
import torch.nn.functional as F
class SyntheticFunction(nn.Module):
def __init__(self, input_dim, hidden_dim, output_dim, noise_level):
super(SyntheticFunction, self).__init__()
self.fc1 = nn.Linear... | 2.515625 | 3 |
sdk/yapily/models/overdraft_overdraft_tier_band.py | bs-yapily/yapily-sdk-python | 0 | 12780367 | <filename>sdk/yapily/models/overdraft_overdraft_tier_band.py
# coding: utf-8
"""
Yapily API
To access endpoints that require authentication, use your application key and secret created in the Dashboard (https://dashboard.yapily.com) # noqa: E501
OpenAPI spec version: 0.0.155
Generated by: https... | 1.859375 | 2 |
mqtt2kasa/const.py | johnjones4/mqtt2kasa | 12 | 12780368 | <reponame>johnjones4/mqtt2kasa
#!/usr/bin/env python
MQTT_DEFAULT_CLIENT_ID = "mqtt2kasa"
MQTT_DEFAULT_CLIENT_TOPIC_FORMAT = "/kasa/device/{}"
MQTT_DEFAULT_BROKER_IP = "192.168.10.238"
MQTT_DEFAULT_RECONNECT_INTERVAL = 13 # [seconds]
KASA_DEFAULT_POLL_INTERVAL = 10 # [seconds]
KEEP_ALIVE_DEFAULT_TASK_INTERVAL = 1.5 ... | 1.28125 | 1 |
formulario/migrations/0005_auto_20200910_2123.py | giuliocc/censo-querido-diario | 40 | 12780369 | # Generated by Django 3.1.1 on 2020-09-10 21:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('formulario', '0004_auto_20200909_2313'),
]
operations = [
migrations.RemoveField(
model_name='mapeamento',
name='lin... | 1.414063 | 1 |
dragon/python/_api/io/__init__.py | seetaresearch/Dragon | 81 | 12780370 | <filename>dragon/python/_api/io/__init__.py
# ------------------------------------------------------------
# Copyright (c) 2017-present, SeetaTech, Co.,Ltd.
#
# Licensed under the BSD 2-Clause License.
# You should have received a copy of the BSD 2-Clause License
# along with the software. If not, See,
#
# <https:/... | 1.960938 | 2 |
python/38041857/dict_count.py | jeyoor/stackoverflow-notes | 0 | 12780371 | <filename>python/38041857/dict_count.py
from collections import defaultdict
#https://stackoverflow.com/questions/38041857/checking-if-keys-already-in-dictionary-with-try-except
class SimpleDictCounter:
"""Test counting elements using a dict
Here's a next lines of doc comment"""
def __init__(self):
... | 4 | 4 |
pompy/demos.py | alexliberzonlab/pompy | 12 | 12780372 | # -*- coding: utf-8 -*-
"""Demonstrations of setting up models and visualising outputs."""
from __future__ import division
__authors__ = '<NAME>'
__license__ = 'MIT'
import sys
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from matplotlib.animation import FuncAnimation
import numpy as np
from pompy imp... | 2.796875 | 3 |
genomvar/test/test_variant.py | mikpom/genomvar | 0 | 12780373 | <reponame>mikpom/genomvar
import copy
from pkg_resources import resource_filename as pkg_file
from genomvar import Reference
from genomvar.varset import VariantBase
from genomvar import variant
from genomvar.vcf import VCFReader, VCFWriter
from genomvar.vcf_utils import VCF_FIELDS, VCFRow
from genomvar.variant import G... | 2.0625 | 2 |
tests/filters/test_types.py | SocialFinanceDigitalLabs/sfdata-stream-parser | 1 | 12780374 | <reponame>SocialFinanceDigitalLabs/sfdata-stream-parser<filename>tests/filters/test_types.py
import datetime
from unittest.mock import MagicMock
from sfdata_stream_parser import events
from sfdata_stream_parser.filters.types import integer_converter, float_converter, cell_value_converter, _from_excel, \
date_conve... | 2.5625 | 3 |
refill/pptx.py | trackuity/refill | 0 | 12780375 | from __future__ import annotations
import re
import string
from abc import ABC, abstractmethod
from dataclasses import dataclass
from fnmatch import fnmatchcase
from io import BytesIO
from typing import IO, Dict, List, Optional, Union
from pptx import Presentation
from pptx.chart.data import ChartData
from pptx.enum.... | 2.25 | 2 |
setup.py | CrossNox/symspellpy | 0 | 12780376 | from setuptools import setup, find_packages
setup(
name='symspellpy',
packages=find_packages(exclude=['test']),
package_data={
'symspellpy': ['README.md', 'LICENSE']
},
version='0.9.0',
description='Keyboard layout aware version of SymSpell',
long_description=open('README.md').read(... | 1.054688 | 1 |
tests/runtests.py | pombredanne/reviewboard | 0 | 12780377 | #!/usr/bin/env python3
import sys
import pytest
if __name__ == '__main__':
sys.exit(pytest.main(sys.argv[1:]))
| 1.515625 | 2 |
1071-soma-de-impares-consecutivos-i.py | ErickSimoes/URI-Online-Judge | 0 | 12780378 | <gh_stars>0
#!/usr/bin/env python
# coding: utf-8
# In[19]:
n = int(input())
m = int(input())
total = 0
if n > m:
n, m = m, n
for i in range(n+1, m):
if i%2 != 0:
total += i
print(total)
| 3.484375 | 3 |
pydsdl/_serializable/_serializable.py | bbworld1/pydsdl | 0 | 12780379 | # Copyright (c) 2018 UAVCAN Consortium
# This software is distributed under the terms of the MIT License.
# Author: <NAME> <<EMAIL>>
import abc
from .. import _expression
from .. import _error
from .._bit_length_set import BitLengthSet
class TypeParameterError(_error.InvalidDefinitionError):
pass
class Seriali... | 2.75 | 3 |
generate_titles.py | michaelcapps/arxivTitleGenerator_RNN | 0 | 12780380 | <reponame>michaelcapps/arxivTitleGenerator_RNN<filename>generate_titles.py
# Credit to this structure goes to <NAME>
# https://github.com/martin-gorner/tensorflow-rnn-shakespeare
#
# I used his shakespeare generator as a starting point and tutorial
import tensorflow as tf
import numpy as np
import text_handler as tx
... | 2.625 | 3 |
mistos-backend/src/app/tests/databasetest.py | Maddonix/mistos_2 | 1 | 12780381 | <reponame>Maddonix/mistos_2
from app.database import Base
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
SQLALCHEMY_DATABASE_URL = "sqlite:///./test.db"
engine = create_engine(
SQLALCHEMY_DATABASE_URL, connect_args={"check_same_... | 1.921875 | 2 |
colaboradores/forms.py | lauraziebarth/dispositivos_mercos | 0 | 12780382 | # coding: utf-8
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from django import forms
from colaboradores.enums import AREAS
class FormColaborador(forms.Form):
nome = forms.CharField(max_length=100, required=True)
email = forms.CharField(m... | 2.125 | 2 |
DMOJ/CCC/ART.py | eddiegz/Personal-C | 3 | 12780383 | <reponame>eddiegz/Personal-C
N=float(input())
number=0
list1=[]
while True:
co=float(input())
number+=1
list1.append(co)
if number==N:
break
print(list1)
| 3.515625 | 4 |
EngLearner/mainsys/models.py | jiangyifan123/EngLearner | 0 | 12780384 | from django.db import models
import time
# Create your models here.
class words(models.Model):
word = models.CharField(max_length = 40, default = '', verbose_name = "单词")
symthm = models.CharField(max_length = 40, default = '', verbose_name = "音标")
chinese = models.CharField(max_length = 100, default = '', ... | 2.28125 | 2 |
heartful/apps/core/serializers.py | DeWittmm/Heartful | 2 | 12780385 | from rest_framework import serializers
from .models import *
#MARK: User
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ('googleid', 'name', 'heartrate', 'spO2', 'age',)
class UserDataSetSerializer(serializers.ModelSerializer):
# user = UserSerializer(man... | 2.328125 | 2 |
academia_ai/preprocessing.py | Knuppknou/academia_AI | 4 | 12780386 | import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
import os
from .leafs import leafs
print("Reloaded preprocessing!")
def normalize(dataset):
'''normalize data so that over all imeges the pixels on place (x/y) have mean = 0 and are standart distributed'''
# calculate the mean
mean=np... | 3.125 | 3 |
data_processor/imgs_to_arr.py | BoyuanChen/visual_behavior_modeling | 9 | 12780387 | <gh_stars>1-10
import os
from PIL import Image
import numpy as np
from tqdm import tqdm
def mkdir(folder):
if os.path.exists(folder):
shutil.rmtree(folder)
os.makedirs(folder)
data_filepath = '/home/cml/bo/ToM_Base/sim_tom/rgb/tom_simple_rgb/data_processor/augmented_train_data_imgs/rgb_data_imgs'
t... | 2.40625 | 2 |
examples/affect/affect_mfm.py | kapikantzari/MultiBench | 148 | 12780388 | import torch
import sys
import os
sys.path.append(os.getcwd())
sys.path.append(os.path.dirname(os.path.dirname(os.getcwd())))
from unimodals.MVAE import TSEncoder, TSDecoder # noqa
from utils.helper_modules import Sequential2 # noqa
from objective_functions.objectives_for_supervised_learning import MFM_objective # no... | 1.921875 | 2 |
utils/generation.py | mazzzystar/WaveRNN | 0 | 12780389 | <reponame>mazzzystar/WaveRNN
import hparams as hp
from utils.dsp import *
def gen_testset(model, test_set, samples, batched, target, overlap, save_path) :
k = model.get_step() // 1000
for i, (m, x) in enumerate(test_set, 1):
if i > samples : break
print('\n| Generating: %i/%i' % (i, samples... | 2.3125 | 2 |
.archived/snakecode/0017.py | gearbird/calgo | 4 | 12780390 | <gh_stars>1-10
class Solution:
pad = ['', '', 'abc', 'def', 'ghi', 'jkl', 'mno', 'pqrs', 'tuv', 'wxyz']
def letterCombinations(self, digits: str) -> list[str]:
res: list[str] = []
if not digits:
return res
res.append('')
for d in digits:
newRes: list[str... | 2.96875 | 3 |
clinicadl/tests/test_classify.py | yogeshmj/AD-DL | 112 | 12780391 | <gh_stars>100-1000
# coding: utf8
import pytest
import os
from os.path import join, exists
@pytest.fixture(params=[
'classify_image',
'classify_slice',
'classify_patch'
])
def classify_commands(request):
out_filename = 'fold-0/cnn_classification/best_balanced_accuracy/DB-TEST_image_level_prediction.... | 2.046875 | 2 |
heaps/max-heap.py | neerajp99/algorithms | 1 | 12780392 | <gh_stars>1-10
"""
1. Create a max heap
2. Insert into the max heap
3. Heapify the max heap upwards
4. Heapify the max heap downwards
5. Delete from the max-heap
"""
class MaxHeap:
def __init__(self, capacity):
self.storage = [0] * capacity
self.capacity = capacity
self... | 3.84375 | 4 |
qcloudsdkticket/GetCategoryListRequest.py | f3n9/qcloudcli | 0 | 12780393 | # -*- coding: utf-8 -*-
from qcloudsdkcore.request import Request
class GetCategoryListRequest(Request):
def __init__(self):
super(GetCategoryListRequest, self).__init__(
'ticket', 'qcloudcliV1', 'GetCategoryList', 'ticket.api.qcloud.com')
| 1.59375 | 2 |
fixture/user.py | planofmind/python_training | 0 | 12780394 | <reponame>planofmind/python_training<gh_stars>0
from selenium.webdriver.support.select import Select
class UserHelper:
def __init__(self, app):
self.app = app
def create(self, user):
wd = self.app.wd
wd.find_element_by_link_text("add new").click()
wd.find_element_by_name("firs... | 2.5625 | 3 |
nerblackbox/cli.py | af-ai-center/nerblackbox | 11 | 12780395 | """Command Line Interface of the nerblackbox package."""
import os
import subprocess
from os.path import join
import click
from typing import Dict, Any
from nerblackbox.modules.main import NerBlackBoxMain
################################################################################################################... | 2.5625 | 3 |
system_upper.py | chenmy1903/student3 | 1 | 12780396 | <reponame>chenmy1903/student3<filename>system_upper.py
"""提权组件
解决伽卡他卡使用SYSTEM权限运行的问题, 将破解器提到SYSTEM权限, 就能杀死伽卡他卡
"""
# Copyright 2022 chenmy1903
#
# 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 a... | 2.609375 | 3 |
configs/universenet/ablation/universenet50_2008_nosepc_fp16_4x4_mstrain_480_960_1x_coco.py | Jack-Hu-2001/UniverseNet | 314 | 12780397 | <gh_stars>100-1000
_base_ = [
'../../universenet/models/universenet50_2008.py',
'../../_base_/datasets/coco_detection_mstrain_480_960.py',
'../../_base_/schedules/schedule_1x.py', '../../_base_/default_runtime.py'
]
model = dict(
neck=dict(
_delete_=True,
type='FPN',
in_channels... | 1.3125 | 1 |
src/seq2seq.py | zhihanyang2022/min-char-seq2seq | 0 | 12780398 | <reponame>zhihanyang2022/min-char-seq2seq
import os
import torch
import torch.nn as nn
import torch.optim as optim
import numpy as np
import gin
from networks import Encoder, Decoder, DecoderWithAttention
SEQ_LEN_UPPER_LIM = 100
@gin.configurable(module=__name__)
class Seq2Seq:
"""Implement the sequence-2-se... | 2.375 | 2 |
api/urls.py | CSC301-TTS-Project/TrafficFinderServer | 0 | 12780399 | <gh_stars>0
# pages/urls.py
from django.urls import path
from .views import *
from rest_framework.authtoken import views
urlpatterns = [
path('getRoute', get_route),
path('insertNode', insert_node),
path('modifyNode', modify_node),
path('deleteNode', delete_node),
path('getKeys', get_api_keys),
... | 1.757813 | 2 |
bot.py | forever404/CTFd-Bot | 4 | 12780400 | from config import logininfo
import re,json,time,configparser,logging,sys,os,requests,asyncio
def login(login_url, username, password):
#请求头
my_headers = {
'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36',
'Acce... | 2.59375 | 3 |
.idea/VirtualEnvironment/Lib/site-packages/tests/outcomes/imports/test_import_package_5/random_module/main.py | Vladpetr/NewsPortal | 0 | 12780401 | import in1.in2.main2 as m
import in1.file as f
print(m.x + f.y)
| 1.757813 | 2 |
tools/train_w2v.py | sketscripter/emotional-chatbot-cakechat | 1,608 | 12780402 | <reponame>sketscripter/emotional-chatbot-cakechat
import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from cakechat.utils.text_processing import get_processed_corpus_path, load_processed_dialogs_from_json, \
FileTextLinesIterator, get_dialog_lines_and_conditions, Proc... | 2.265625 | 2 |
biobert_ner/utils_ner.py | rufinob/ehr-relation-extraction | 43 | 12780403 | <filename>biobert_ner/utils_ner.py
import sys
sys.path.append("../")
import logging
import os
from dataclasses import dataclass
from enum import Enum
from typing import List, Optional, Union, Dict
from ehr import HealthRecord
from filelock import FileLock
from transformers import PreTrainedTokenizer
import torch
fro... | 2.53125 | 3 |
BasicModels/TFLinearRegression.py | amingolnari/Deep-Learning-Course | 17 | 12780404 | <filename>BasicModels/TFLinearRegression.py<gh_stars>10-100
"""
github : https://github.com/amingolnari/Deep-Learning-Course
Author : <NAME>
TF Version : 1.12.0
Date : 4/12/2018
TensorFlow Linear Regression
Code 200
"""
import numpy as np
import tensorflow as tf
tf.reset_default_graph() # Reset Graph
import matplotli... | 3.1875 | 3 |
Program_Python_code/IOT_02/request_2.py | skyhigh8591/Learning_Test_Program | 0 | 12780405 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 15 13:52:25 2020
@author: skyhigh
"""
import requests
from bs4 import BeautifulSoup
url_1 = 'http://192.168.1.27:6060/login'
html = requests.get(url_1)
html.encoding='utf-8'
if html.status_code == requests.codes.ok:
print("ok")
print("//////////////... | 2.78125 | 3 |
wrappers/vcfanno/wrapper.py | delvinso/crg2 | 7 | 12780406 | __author__ = "<NAME>"
__copyright__ = "Copyright 2020, <NAME>"
__email__ = "<EMAIL>"
__license__ = "BSD"
from snakemake.shell import shell
from os import path
import shutil
import tempfile
shell.executable("bash")
luascript = snakemake.params.get("lua_script")
if luascript:
luascriptprefix = "-lua {}".format(lu... | 1.84375 | 2 |
meiduo_mall/meiduo_mall/apps/carts/utils.py | devenshxw/meiduo_project | 0 | 12780407 | <filename>meiduo_mall/meiduo_mall/apps/carts/utils.py<gh_stars>0
import pickle, base64
from django_redis import get_redis_connection
def merge_cart_cookie_to_redis(request, user, response):
"""
登录后合并cookie购物车数据到Redis
:param request: 本次请求对象,获取cookie中的数据
:param response: 本次响应对象,清除cookie中的数据
:param u... | 2.359375 | 2 |
novelutils/data/scrapy_settings.py | vtkhang/novelutils-public | 0 | 12780408 | <reponame>vtkhang/novelutils-public<filename>novelutils/data/scrapy_settings.py
"""Store the settings of spider for utils crawler. """
def get_settings():
"""Return the settings of spider.
Returns
-------
dict
Spider settings.
"""
return {
"AUTOTHROTTLE_ENABLED": True,
... | 1.9375 | 2 |
tests/test_euclidean_distance_from_label_centroid_map.py | elsandal/pyclesperanto_prototype | 64 | 12780409 | <filename>tests/test_euclidean_distance_from_label_centroid_map.py
import pyclesperanto_prototype as cle
import numpy as np
def test_euclidean_distance_from_label_centroid_map():
labels = cle.push(np.asarray([
[1, 1, 1, 2],
[1, 1, 1, 2],
[1, 1, 1, 2],
[2, 2, 2, 2]
]))
refe... | 2.53125 | 3 |
Thresholding.py | KR-16/Open-CV | 0 | 12780410 | import cv2 as cv
import numpy as np
image = cv.imread("boy.jpg",cv.IMREAD_COLOR) # we can even read it in grayscale image also
#image is the cv::mat object of the image
# COVERTING THE IMAGE TO GRAY SCLAE USING cvtColor method
gray_scale = cv.cvtColor(image, cv.COLOR_BGR2GRAY)
cv.imshow("Original Image",ima... | 3.578125 | 4 |
star.py | Millmer/Starspot-Model | 0 | 12780411 | import random
import numpy as np
from utils import splitPoly
import matplotlib.patches as patches
import matplotlib.path as path
from matplotlib.transforms import Bbox
import cartopy.crs as ccrs
from spot import Spot
class Star:
# Stellar Radius in RSun, inclincation in degrees
# Limb darkening grid resolution... | 2.4375 | 2 |
gubernator/pb_glance.py | Noahhoetger2001/test-infra | 3,390 | 12780412 | <gh_stars>1000+
#!/usr/bin/env python
# Copyright 2016 The Kubernetes Authors.
#
# 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 re... | 2.40625 | 2 |
alembic/versions/36c44957687f_add_pledge_table.py | minsukkahng/pokr.kr | 76 | 12780413 | <reponame>minsukkahng/pokr.kr
"""Add pledge table
Revision ID: <KEY>
Revises: 3cea1b2cfa
Create Date: 2013-05-07 17:12:20.111941
"""
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '3cea1b2cfa'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.create_table('pledge',
... | 1.265625 | 1 |
DEEP LEARNING/SNAKE GAME/Code/Manual_SnakeGame.py | SushP07/Machine-Learning | 2 | 12780414 | <reponame>SushP07/Machine-Learning
import pygame, random, sys
from pygame.locals import *
def collide(x1, x2, y1, y2, w1, w2, h1, h2):
if x1+w1>x2 and x1<x2+w2 and y1+h1>y2 and y1<y2+h2:
return True
else:
return False
def die(screen, score):
f=pygame.font.SysFont('Arial', 30);t=f.render('Your score was: '+str(s... | 3.4375 | 3 |
lnbits/helpers.py | frennkie/lnbits | 0 | 12780415 | import json
import os
import shortuuid
from typing import List, NamedTuple, Optional
from .settings import LNBITS_PATH
class Extension(NamedTuple):
code: str
is_valid: bool
name: Optional[str] = None
short_description: Optional[str] = None
icon: Optional[str] = None
contributors: Optional[Li... | 2.640625 | 3 |
pgdocs/command/show.py | VEINHORN/pgdocs | 0 | 12780416 | <gh_stars>0
"""
Shows database objects description
"""
import subprocess
import validator
import psqlcmd as psql
def execute(host, port, database, schema, table):
host, port, database = validator.connection_props(host, port, database)
# print("host={}, port={}, schema={}, db={}, table={}".format(
# ho... | 2.5 | 2 |
open_files.py | husmen/DoCA_GUI | 3 | 12780417 | <reponame>husmen/DoCA_GUI<gh_stars>1-10
""" module for opening various types of files """
import os
import json
import time
import shutil
import subprocess
import textract
import pandas as pd
from docx import Document
#from changeOffice import Change
from pptx import Presentation
from odf.opendocument import load
from... | 2.546875 | 3 |
python/dataStructuresAndAlgorithms/arraytest.py | serdarkuyuk/Notes | 1 | 12780418 | <reponame>serdarkuyuk/Notes<gh_stars>1-10
from array import *
my_array = array("i", [1, 2, 3, 4, 5])
for i in my_array:
print(i)
print(my_array[0])
my_array.append(6)
my_array.insert(2, 100)
my_array.extend([3, 2, 1])
templist = [20, 21, 22]
my_array.fromlist(templist)
my_array.remove(1)
my_array.pop()
# ... | 3.640625 | 4 |
evcouplings/utils/summarize.py | thomashopf/EVcouplings-1 | 1 | 12780419 | """
Create summary statistics / plots for runs from
evcouplings app
Authors:
<NAME>
"""
# chose backend for command-line usage
import matplotlib
matplotlib.use("Agg")
from collections import defaultdict
import filelock
import pandas as pd
import click
import matplotlib.pyplot as plt
from evcouplings.utils.system... | 2.375 | 2 |
exercises/en/exc_02_02_02.py | Jette16/spacy-course | 2,085 | 12780420 | <filename>exercises/en/exc_02_02_02.py
from spacy.lang.en import English
nlp = English()
doc = nlp("<NAME> is a PERSON")
# Look up the hash for the string label "PERSON"
person_hash = ____.____.____[____]
print(person_hash)
# Look up the person_hash to get the string
person_string = ____.____.____[____]
print(person... | 3.25 | 3 |
aiida_siesta/calculations/tkdict.py | pfebrer96/aiida_siesta_plugin | 0 | 12780421 | """
Module with implementation of TKDict (translated-keys-dictionary) class.
It is actually a dictionary with 'translation insensitive' keys. For
example, in the FDFDict subclass:
MD.TypeOfRun, md-type-of-run, mdTypeOfRun, mdtypeofrun
all represent the same key in the dictionary. The actual form of the
key return... | 3.0625 | 3 |
tests/test_tokenizer.py | zoonru/diaparser | 38 | 12780422 | import shutil
import os
import argparse
import unittest
import io
from tokenizer.tokenizer import Tokenizer
class TestTokenizer(unittest.TestCase):
MODEL_DIR = os.path.expanduser('~/.cache/diaparser')
def setUp(self):
self.args = {
'lang': 'it',
'verbose': True
}
... | 2.53125 | 3 |
general-practice/Exercises solved/mixed/Exercise28.py | lugabrielbueno/Projeto | 0 | 12780423 | <gh_stars>0
#Tax Calculator - Asks the user to enter a cost and either a country or state sale tax. It then returns the tax plus the total cost with tax.
# List with all states and sale taxes
all_states = [( 'Alaska', 0),
('Alabama',4),
('Arkansas',6.5),
('Arizona',5.6),
('California',7.5),
('Colorado',2.9),
('C... | 3.421875 | 3 |
tests/collectors/app_store_test.py | ecleya/autodot | 0 | 12780424 | <reponame>ecleya/autodot
import os
import shutil
import tempfile
from unittest import TestCase, mock
from collectors import app_store
APPS = b'''
497799835 Xcode (9.2)
425424353 The Unarchiver (3.11.3)
409183694 Keynote (7.3.1)
408981434 iMovie (10.1.8)
'''
class TestProject(TestCase):
@mock.patch('subprocess.... | 2.15625 | 2 |
bridges/east_open_cv_bridge.py | ChristianKitte/Textextraktion-und-Einordnung-mit-Hilfe-neuronaler-Netze | 0 | 12780425 | """
This file contains source code from another GitHub project. The comments made there apply. The source code
was licensed under the MIT License. The license text and a detailed reference can be found in the license
subfolder at models/east_open_cv/license. Many thanks to the author of the code.
For reasons of c... | 2.78125 | 3 |
automated_analysis.py | AfricasVoices/Project-Constitution-Amendment-Ke | 0 | 12780426 | <reponame>AfricasVoices/Project-Constitution-Amendment-Ke
import argparse
import csv
from collections import OrderedDict
import sys
from core_data_modules.analysis.mapping import participation_maps, kenya_mapper
from core_data_modules.cleaners import Codes
from core_data_modules.logging import Logger
from core_data_mo... | 2.171875 | 2 |
Class/cert.py | Ne00n/woodKubernetes | 2 | 12780427 | from Class.rqlite import rqlite
import simple_acme_dns, requests, json, time, sys, os
class Cert(rqlite):
def updateCert(self,data):
print("updating",data[0])
response = self.execute(['UPDATE certs SET fullchain = ?,privkey = ?,updated = ? WHERE domain = ?',data[1],data[2],data[3],data[0]])
... | 2.859375 | 3 |
setup.py | actingthegroat/pyxtf | 27 | 12780428 | from os import path
from setuptools import setup
from tools.generate_pyi import generate_pyi
def main():
# Generate .pyi files
import pyxtf.xtf_ctypes
generate_pyi(pyxtf.xtf_ctypes)
import pyxtf.vendors.kongsberg
generate_pyi(pyxtf.vendors.kongsberg)
# read the contents of README file
thi... | 1.671875 | 2 |
examples/gdl/font.py | simoncozens/pysilfont | 41 | 12780429 | <gh_stars>10-100
#!/usr/bin/env python
'The main font object for GDL creation. Depends on fonttools'
__url__ = 'http://github.com/silnrsi/pysilfont'
__copyright__ = 'Copyright (c) 2012 SIL International (http://www.sil.org)'
__license__ = 'Released under the MIT License (http://opensource.org/licenses/MIT)'
import os,... | 2.484375 | 2 |
internship-qualification/mercari-summer-internship-2017/tests.py | mikoim/funstuff | 0 | 12780430 | <reponame>mikoim/funstuff<filename>internship-qualification/mercari-summer-internship-2017/tests.py<gh_stars>0
import os
import uuid
from unittest import TestCase
import grpc
import grpc._channel
from google.protobuf import json_format as _json_format
import api_pb2
import api_pb2_grpc
def random_id() -> str:
r... | 2.34375 | 2 |
src/pkg/caendr/caendr/models/datastore/user_token.py | AndersenLab/CAENDR | 3 | 12780431 | from caendr.models.datastore import Entity
class UserToken(Entity):
kind = 'user_token'
def __init__(self, *args, **kwargs):
super(UserToken, self).__init__(*args, **kwargs)
self.set_properties(**kwargs)
def set_properties(self, **kwargs):
''' Sets allowed properties for the UserToken instance ... | 2.515625 | 3 |
tests/lib/bes/git/test_git.py | reconstruir/bes | 0 | 12780432 | <reponame>reconstruir/bes
#!/usr/bin/env python
#-*- coding:utf-8; mode:python; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*-
#
import os.path as path, os, unittest
from bes.testing.unit_test import unit_test
from bes.fs.file_util import file_util
from bes.fs.temp_file import temp_file
from bes.archive.ar... | 2.078125 | 2 |
returns/ejemplo_1_return_un_valor.py | Invarato/Jarroba | 2 | 12780433 | <filename>returns/ejemplo_1_return_un_valor.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def dame_un_texto():
return "Texto"
def dame_un_numero():
return 123
def dame_un_booleano():
return True
def dame_un_listado():
return ["A", "B", "C"]
def dame_un_diccionario():
return {
"c... | 3.125 | 3 |
tests/shinytest/commands/test_commands.py | shinymud/ShinyMUD | 35 | 12780434 | from shinytest import ShinyTestCase
# Test all of the general commands!
class TestGeneralCommands(ShinyTestCase):
def test_command_register(self):
from shinymud.models.area import Area
from shinymud.data import config
from shinymud.models.player import Player
from shinymud.commands... | 2.25 | 2 |
vang/misc/wc.py | bjuvensjo/scripts | 6 | 12780435 | #!/usr/bin/env python3
import argparse
from os import walk
from pprint import pprint
from re import fullmatch
from sys import argv
def is_excluded(file, excluded):
return any([fullmatch(ex, file) for ex in excluded])
def is_included(file, included):
return any([fullmatch(ex, file) for ex in included])
def... | 3.203125 | 3 |
test/test_grocy.py | cerebrate/pygrocy | 1 | 12780436 | from unittest import TestCase
from unittest.mock import patch, mock_open
from datetime import datetime
import responses
from pygrocy import Grocy
from pygrocy.grocy import Product
from pygrocy.grocy import Group
from pygrocy.grocy import ShoppingListProduct
from pygrocy.grocy_api_client import CurrentStockResponse, Gro... | 2.53125 | 3 |
langtojson/__init__.py | Ars2014/langtojson | 0 | 12780437 | <reponame>Ars2014/langtojson
"""Top-level package for LangToJson."""
__author__ = """<NAME>"""
__email__ = '<EMAIL>'
__version__ = '0.1.0'
| 0.714844 | 1 |
python3/ltk/actions/reference_action.py | Lingotek/filesystem-connector | 11 | 12780438 | from ltk.actions.action import *
class ReferenceAction(Action):
def __init__(self, path):
Action.__init__(self, path)
def reference_add_action(self, filename, doc_id):
if self._check_filename(filename, doc_id):
material = []
while True:
while True:
... | 2.375 | 2 |
alloy/robot/baxter.py | CMU-TBD/alloy | 0 | 12780439 | # Copyright - Transporation, Bots, and Disability Lab - Carnegie Mellon University
# Released under MIT License
"""
Common Operations/Codes that are re-written on Baxter
"""
import numpy as np
from pyquaternion import Quaternion
from alloy.math import *
__all__ = [
'convert_joint_angles_to_numpy','transform_pose... | 2.53125 | 3 |
scripts/kitty_b64dump.py | SkyLeach/poweruser_tools | 1 | 12780440 | <filename>scripts/kitty_b64dump.py
"""
File: kitty_b64dump.py
Author: SkyLeach
Email: <EMAIL>
Github: https://github.com/skyleach/poweruser_tools
Description: Simple script to dump base64 kitt-encoded text to terminals that can handle the kitty graphic output format.
"""
import sys
from base64 import standard_b... | 2.75 | 3 |
3.2.tree_populating.py | luvalenz/time-series-variability-tree | 1 | 12780441 | <filename>3.2.tree_populating.py
import argparse
import sys
import os
import time_series_utils
from subsequence_tree import SubsequenceTree
from subsequence_tree_2 import BottomUpSubsequenceTree
from subsequence_tree_3 import BottomUpSubsequenceTree as Tree3
from subsequence_tree_4 import KMedioidsSubsequenceTree
impor... | 2.359375 | 2 |
impersonate/urls.py | saifrim/django-impersonate | 8 | 12780442 | from django.conf.urls import url
from .views import impersonate, list_users, search_users, stop_impersonate
try:
# Django <=1.9
from django.conf.urls import patterns
except ImportError:
patterns = None
urlpatterns = [
url(r'^stop/$',
stop_impersonate,
name='impersonate-stop'),
url... | 1.875 | 2 |
bidwire/scrapers/massgov/results_page_scraper.py | RagtagOpen/bidwire | 5 | 12780443 | <filename>bidwire/scrapers/massgov/results_page_scraper.py
from lxml import etree, html
from utils import ensure_absolute_url
SITE_ROOT = 'https://www.mass.gov'
def scrape_results_page(page_str, xpath_list):
"""Scrapes HTML page and returns dictionary of URL => document title
Args:
page_str -- the enti... | 3.078125 | 3 |
rump/router/__init__.py | bninja/rump | 6 | 12780444 | import contextlib
import logging
import re
import pilo
from .. import exc, Request, parser, Rule, Rules, Upstream
logger = logging.getLogger(__name__)
class Dynamic(pilo.Form):
"""
Represents the dynamic components:
- settings and
- selection rules
of a ``rump.Router``.U seful if you want to... | 2.34375 | 2 |
docassemble_base/tests/test3.py | abramsmatthew/adpllc-test | 1 | 12780445 | <reponame>abramsmatthew/adpllc-test<filename>docassemble_base/tests/test3.py<gh_stars>1-10
#! /usr/bin/python
import ast
import sys
mycode = """\
if b < 6:
a = 77
c = 72
else:
a = 66
sys.exit()
"""
mycode = """\
user.foobar.name.last = 77
if b < 6:
a = 77
c = 72
else:
a = 66
"""
class myextract(ast.NodeV... | 2.71875 | 3 |
test/index2.py | ChenWei-python13/python13_001 | 0 | 12780446 | def index2():
return "index3"
| 1.34375 | 1 |
main.py | Alice-OSENSE/feature_err_analysis | 0 | 12780447 | import cv2
import matplotlib.pyplot as plt
import numpy as np
from pathlib import Path
import scipy.io
from scipy import optimize
from feature_func import *
from preprocess import *
from utils import *
def fit_data(gt_count, feature_data, function):
return optimize.curve_fit(function, feature_data, gt_count)
d... | 2.59375 | 3 |
fp_demo/functional2.py | AegirAexx/python-sandbox | 0 | 12780448 | <gh_stars>0
""" Playing around with filter higher order function and lambda expresions. """
from pprint import pprint # Nicer formatting when printing tuples/lists
from scientist import scientists
# Using one lambda in filter.
WINNERS = tuple(filter(lambda x: x.nobel is True, scientists))
print('---- Nobel Winners: ... | 3.40625 | 3 |
batcher.py | charelF/ABM | 0 | 12780449 | # Code for parallelization of the sensitivity analysis.
# This is accompanied by para.sh
import sys
import pandas as pd
from model import RegionModel
def run(i):
'''
performs a single simulation of a system
'''
m = RegionModel(int_trade, *df.iloc[i, 1:7])
for k in range(max_steps):
m.s... | 2.6875 | 3 |
OOP/Exams/Exam_16_august_2020/01. Structure_Skeleton (4)/project/system.py | petel3/Softuni_education | 2 | 12780450 | <reponame>petel3/Softuni_education<gh_stars>1-10
from project.hardware.hardware import Hardware
from project.hardware.heavy_hardware import HeavyHardware
from project.hardware.power_hardware import PowerHardware
from project.software.express_software import ExpressSoftware
from project.software.light_software import Li... | 2.734375 | 3 |