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 |
|---|---|---|---|---|---|---|
code/improved method/SpatialColumnDetection.py | astrob3rry/spatial-data-profiling | 0 | 40300 | <filename>code/improved method/SpatialColumnDetection.py
import pandas as pd
import sys, os
import numpy as np
from snapy import MinHash, LSH
from fuzzywuzzy import fuzz
from fuzzywuzzy import process
import random
import re
import Settings as Settings
from pyspark.sql import SparkSession
spark = SparkSession.builder... | 2.453125 | 2 |
tenable/cs/containers.py | widnyana/pyTenable | 1 | 40301 | <reponame>widnyana/pyTenable
from .base import CSEndpoint
class ContainersAPI(CSEndpoint):
def list(self):
'''
`container-security-containers: list-containers <https://cloud.tenable.com/api#/resources/container-security-containers/list-containers>`_
Returns:
list: List of conta... | 2.515625 | 3 |
morpheus_core/tests/test_fits_helper.py | morpheus-project/morpheus-framework | 0 | 40302 | # MIT License
# Copyright 2020 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, di... | 1.75 | 2 |
src/eduid_webapp/actions/actions/mfa.py | SUNET/eduid-webapp | 0 | 40303 | #
# Copyright (c) 2017 NORDUnet A/S
# Copyright (c) 2018 SUNET
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
# conditions are met:
#
# 1. Redistributions of source code must retain the above copyright
# ... | 1.210938 | 1 |
elvis/modeling/models/layers/transformer.py | seo-95/elvis | 1 | 40304 | <filename>elvis/modeling/models/layers/transformer.py
import math
import pdb
import torch
import torch.nn as nn
from torch.nn import functional as F
from .fully_connected import MLP
class TRMMHAttention(nn.Module):
def __init__(self, n_heads, d_model, dropout_p=0.):
super(TRMMHAttention, self).__init__(... | 2.65625 | 3 |
conceptParser.py | Eyon42/InteractiveConceptMapGenerator | 0 | 40305 | import networkx as nx
import markdown as md
def parse_concepts(filename):
"""Takes a markdown file with with a certain structure
and parses it to separate the concept and the relations
between the concepts.
Structure:
# [Title]
## [Concept]
[Some text]
[Even Latex math]
### [A... | 3.40625 | 3 |
urls/pdfapi.py | nguyenhuong791123/api | 0 | 40306 | # -*- coding: UTF-8 -*-
from flask import Blueprint, Flask, jsonify, request, make_response
import pdfkit
from utils.cm.utils import is_exist
from utils.cm.files import delete_dir
from utils.pdf.pdfkits import *
app = Blueprint('pdfapi', __name__)
# curl -v -H "Content-type: application/json" -X POST http://192.168.1... | 2.375 | 2 |
stixy/accounting/migrations/0009_auto_20200513_0905.py | AnthonyKenny98/Stixy | 0 | 40307 | <reponame>AnthonyKenny98/Stixy
# Generated by Django 3.0.6 on 2020-05-13 09:05
# flake8: noqa
import accounting.models
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('accounting', '0008_auto_20200512_1021'),
]
op... | 1.65625 | 2 |
renovation_core/install/after_migrate.py | Abadulrehman/renovation_core | 18 | 40308 | import frappe
def after_migrate():
set_default_otp_template()
def set_default_otp_template():
if not frappe.db.get_value("System Settings", None, "email_otp_template"):
if frappe.db.exists("Email Template", "Default Email OTP Template"):
# should exists via fixtures
frappe.db.set_value("System Set... | 2.171875 | 2 |
reo/migrations/0116_auto_20210818_2124.py | NREL/REopt_Lite_API | 41 | 40309 | # Generated by Django 3.1.12 on 2021-08-18 21:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('reo', '0115_auto_20210810_1550'),
]
operations = [
migrations.AddField(
model_name='chpmodel',
name='supplementary_... | 1.4375 | 1 |
label_funcs_with_no_xrefs.py | Flygend/IDAPythonEmbeddedToolkit | 4 | 40310 | <gh_stars>1-10
##############################################################################################
# Copyright 2017 The Johns Hopkins University Applied Physics Laboratory LLC
# All rights reserved.
# Permission is hereby granted, free of charge, to any person obtaining a copy of this
# software and ass... | 1.5625 | 2 |
hknweb/candidate/migrations/0001_initial.py | yuji3w/hknweb | 20 | 40311 | <reponame>yuji3w/hknweb
# Generated by Django 2.1.5 on 2019-02-04 21:30
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('hknweb', '0006_profile_email'),
]
operations = [
migrations.Cre... | 1.679688 | 2 |
netbox/virtualization/migrations/0009_custom_tag_models.py | BrnoPCmaniak/netbox | 6 | 40312 | # Generated by Django 2.1.4 on 2019-02-20 06:56
from django.db import migrations
import taggit.managers
class Migration(migrations.Migration):
dependencies = [
('virtualization', '0008_virtualmachine_local_context_data'),
('extras', '0019_tag_taggeditem'),
]
operations = [
migra... | 1.4375 | 1 |
stats-backend/yapapi/yapapi/executor/utils.py | cryptobench/golem-stats-backend | 0 | 40313 | <gh_stars>0
"""Utility functions and classes used within the `yapapi.executor` package."""
import asyncio
import logging
from typing import Callable, Optional
logger = logging.getLogger(__name__)
class AsyncWrapper:
"""Wraps a given callable to provide asynchronous calls.
Example usage:
with AsyncWr... | 2.90625 | 3 |
artgens/voice2txt.py | mark-nick-o/AIML_SoundArtsProject | 0 | 40314 | <filename>artgens/voice2txt.py
#
# This python takes either a microphone or sound file as an input
# and tries to decipher the vocal message into text
#
#
import os
import sys
# python -m pip install --upgrade pip
# sudo -H pip3 install SpeechRecognition pydub
import speech_recognition as sr
# sudo apt-get install p... | 3.46875 | 3 |
core/tests/factories.py | TechFrederick/ship | 14 | 40315 | import factory
class ServiceCategoryFactory(factory.django.DjangoModelFactory):
class Meta:
model = "core.ServiceCategory"
name = factory.Sequence(lambda n: f"Service Category {n}")
slug = factory.Sequence(lambda n: f"service-category-{n}")
description = factory.Faker("sentence")
icon = "... | 2.203125 | 2 |
key_word/key_w.py | Den613/Vigeneur-encryption | 0 | 40316 | <reponame>Den613/Vigeneur-encryption
import codecs
alphabet = '<KEY>ХхЬьЪъЫыЭэЮюЯяΨ&Ǻλ∆0123456789!•−⋅→.—"‘±’,/\?%#@^$*+-_– №:;©‐[]=|(){}<>«»\r\n\ufeff\t'
filename = "hello.txt"
file_alphabet = "alphabet.txt"
m = []
word_mass = []
word_size = []
index_word = []
index_key = []
secret = []
secret_word = []
... | 3.0625 | 3 |
pingdom.py | SamJC-FG/microblog-ipset-builder-examples | 0 | 40317 | import urllib.request
IPSET = []
IPLISTLINK = "https://my.pingdom.com/probes/ipv4"
IPLIST = urllib.request.urlopen(IPLISTLINK)
for ADDRESS in IPLIST:
IPSETENTRY = (ADDRESS.decode().rstrip() + '/32') #Tack on a '/32' to the entry, and append it to the list
IPSET.append(IPSETENTRY) | 2.96875 | 3 |
transformer/archs/constants.py | adriens63/transformer_for_translation | 0 | 40318 | # Globales
import tensorflow as tf
AUTOTUNE = tf.data.AUTOTUNE
BATCH_SIZE = 32
BUFFER_SIZE = 20000
EMBEDDING_DIM = 512
MAX_SEQ_LENGTH = 200
INPUT_VOCAB_SIZE = 8500
TARGET_VOCAB_SIZE = 8000
EPS_LAYERNORM = 1e-6 | 1.25 | 1 |
coursera/a_7_1_reading_file.py | polde-live/learnpython | 0 | 40319 | <filename>coursera/a_7_1_reading_file.py<gh_stars>0
# Use words.txt as the file name
fname = raw_input("Enter file name: ")
f = open(fname, 'r')
for line in f:
print line.upper().strip()
f.close() | 4.15625 | 4 |
nxos_config_import/migrations/0010_objectconfigurationstatus_post_url.py | j-sulliman/acici | 4 | 40320 | # Generated by Django 2.1.7 on 2019-03-22 01:36
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('nxos_config_import', '0009_auto_20190322_1408'),
]
operations = [
migrations.AddField(
model_name='objectconfigurationstatus',
... | 1.664063 | 2 |
zadanie1.py | Rostislav9821/Lab_21 | 0 | 40321 | <filename>zadanie1.py
#!/usr/bin/env python3
# -*- config: utf-8 -*-
from tkinter import *
def add():
a = Toplevel()
a.geometry('120x130')
a.resizable(0, 0)
Label(a, text="x1").grid(row=0, column=0)
ent1 = Entry(a, width=5)
ent1.grid(row=0, column=1)
Label(a, text="x2").g... | 3.421875 | 3 |
test/db_retriable.py | Galeria-Kaufhof/private-postgres-rds | 7 | 40322 | import logging
import psycopg2
import psycopg2.extras
import socket
import sys
import time
from cluster_under_test import *
class DbRetriable:
"""
Wrapper around psycopg2, which offers convenient retry functionality.
If connection to postgres is lost during query execution or between
queries, retry wi... | 2.734375 | 3 |
confgen/merge_xdconf_ini.py | gaps-closure/HAL | 0 | 40323 | #!/usr/bin/python3
import json
from argparse import ArgumentParser
def get_args():
p = ArgumentParser(description='Merge CLOSURE xdconf.ini files')
p.add_argument('-f', '--files', required=True, type=str, help='Input files')
p.add_argument('-o', '--outfile', required=False, type=str, default='xdconf.ini',... | 3.0625 | 3 |
vidaug/augmentors/__init__.py | redzhepdx/vidaug | 1 | 40324 | from __future__ import absolute_import
from .affine import *
from .crop import *
from .flip import *
from .geometric import *
from .group import *
from .intensity import *
from .temporal import *
| 1.046875 | 1 |
tests/runtime/rpc/device/conftest.py | fixstars/arachne | 3 | 40325 | <filename>tests/runtime/rpc/device/conftest.py
import pytest
def pytest_addoption(parser):
parser.addoption(
"--edgetest",
action="store_true",
default=False,
help="run edge tests: rpc server should be launched on the edge device in advance",
)
parser.addoption(
"--... | 2.234375 | 2 |
servers/python/coweb/auth/ini.py | opencoweb/coweb | 83 | 40326 | '''
Copyright (c) The Dojo Foundation 2011. All Rights Reserved.
Copyright (c) IBM Corporation 2008, 2011. All Rights Reserved.
'''
# std lib
import ConfigParser
# tornado
import tornado.web
from base import AuthBase
class IniAuth(AuthBase):
cookieName = 'coweb.auth.ini.username'
def __init__(self, container, ... | 2.125 | 2 |
administrator/controller/loginController.py | augustoberwaldt/skin-system | 2 | 40327 | <gh_stars>1-10
from django.shortcuts import render, redirect
from django.contrib.auth import authenticate, login, logout
from administrator.formsModel import FormUser
from django.contrib import messages
import json
def do_login(request):
if request.method == 'POST' :
username = request.POST['username']
... | 2.1875 | 2 |
Implementation/between_two_sets.py | osamadel/Hacker-Rank | 0 | 40328 | <reponame>osamadel/Hacker-Rank<gh_stars>0
import os
import sys
from math import gcd
from functools import reduce
#
# Complete the getTotalX function below.
#
def lcm(a, b):
a = int(a)
b = int(b)
return a * b / gcd(a,b)
def lcms(numbers):
return reduce(lcm, numbers)
def dividedByB(b, factor):
for ... | 2.890625 | 3 |
contentcuration/contentcuration/viewsets/task.py | rgaudin/studio | 1 | 40329 | from django.conf import settings
from django_filters.rest_framework import DjangoFilterBackend
from django_filters.rest_framework import UUIDFilter
from rest_framework.permissions import IsAuthenticated
from contentcuration.celery import app
from contentcuration.models import Channel
from contentcuration.models import... | 1.992188 | 2 |
server_py/flatgov/events/views.py | aih/BillMap | 2 | 40330 | from django.shortcuts import render
from django.http import HttpResponse, JsonResponse
from django.core import serializers
from .models import Event
from .serializers import EventSerializer
from django.db.models import Q
import datetime
def get_events(request):
startDate = request.GET.get('start')
endDate = r... | 2.0625 | 2 |
setup.py | vicrsp/rto | 0 | 40331 | <reponame>vicrsp/rto
from setuptools import setup, find_packages
setup(
name='rtotools',
version='0.1.0',
description='Real-Time Optimization Tools',
url='https://github.com/vicrsp/rto',
author='<NAME>',
author_email='<EMAIL>',
license='MIT',
package_dir={"": "src"},
packages=fi... | 1.296875 | 1 |
sdk/keyvault/azure-keyvault-certificates/tests/_test_case.py | GoWang/azure-sdk-for-python | 1 | 40332 | # ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
from azure.keyvault.certificates._shared import HttpChallengeCache
from azure.keyvault.certificates._shared.client_base import DEFAULT_VERSION
from devtools_testutils im... | 1.914063 | 2 |
BeamlineStatusLogger/logger.py | DESY-P02-1/BeamlineStatusLogger | 0 | 40333 | <reponame>DESY-P02-1/BeamlineStatusLogger
from collections import Iterable
def as_iterable(object):
if isinstance(object, Iterable):
return object
else:
return [object]
class Logger:
def __init__(self, source, processors, sink, timer):
self.source = source
self.processors... | 2.671875 | 3 |
chapter-04/exercise005.py | krastin/pp-cs3.0 | 0 | 40334 | x = 3
y = 12.5
print('The rabbit is ', x, '.', sep='')
print('The rabbit is', x, 'years old.')
print(y, 'is average.')
print(y, ' * ', x, '.', sep='')
print(y, ' * ', x, ' is ', x*y, '.', sep='') | 3.90625 | 4 |
tdigest/__init__.py | kpdemetriou/tdigest-cffi | 2 | 40335 | <reponame>kpdemetriou/tdigest-cffi
from collections import namedtuple
from readerwriterlock.rwlock import RWLockWrite
from ._tdigest import lib as _lib
DEFAULT_COMPRESSION = 400
Centroid = namedtuple("Centroid", ("weight", "mean"))
class RawTDigest:
def __init__(self, compression=DEFAULT_COMPRESSION):
i... | 2.203125 | 2 |
Crunchyroll_Keypad/Crunchyroll_Keypad.py | Benjamin-Valderrama/Arduino | 0 | 40336 | <reponame>Benjamin-Valderrama/Arduino
#Things to add:
#
#
import pyautogui as pag
import time
import webbrowser as wb
import serial
# Instructions
instructions = ''' Select one of the followings : \n
\t 0 : Lunching the app
\t 1 : Previous Chapter
\t 2 : Next Chapter
\t 3 : Saving the current Chapter
\t 4 : Saving th... | 3.28125 | 3 |
fishfood/tmp_leds.py | fberlinger/BlueSwarm | 1 | 40337 | <gh_stars>1-10
import RPi.GPIO as GPIO
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
import time
from lib_utils import *
from lib_leds import LEDS
leds = LEDS()
leds.on()
time.sleep(30)
leds.off() | 2.34375 | 2 |
fitness-backend/tests/test_instructors.py | cuappdev/archives | 0 | 40338 | <filename>fitness-backend/tests/test_instructors.py
from tests.test_case import *
from app.dao import instructors_dao as insd
class InstructorsTestCase(TestCase):
def test_instructor_methods(self):
test_inst = insd.create_instructor("test1")[1]
self.assertEquals(test_inst.id, insd.get_instructor_by_name("tes... | 2.5 | 2 |
ConsulClient/__init__.py | miguel-callejas-coderoad-com/consul-client | 0 | 40339 | name = 'ConsulClient'
__author__ = '<NAME> / <EMAIL>'
__version__ = '0.1.0'
__log__ = 'Consul api client for python'
| 1.203125 | 1 |
Manager/modules/ud.py | lakshaysharmadehi/Manager | 17 | 40340 | <gh_stars>10-100
import requests
from telegram import Update, Bot, ParseMode
from telegram.ext import run_async
from Manager import dispatcher
from Manager.modules.disable import DisableAbleCommandHandler
@run_async
def ud(bot: Bot, update: Update):
message = update.effective_message
text = message.text[len(... | 2.5625 | 3 |
tetris/utils.py | janmaltel/pytetris | 2 | 40341 | from numba import njit
@njit
def print_board_to_string(state):
string = "\n"
for row_ix in range(state.representation.shape[0]):
# Start from top
row_ix = state.num_rows - row_ix - 1
string += "|"
for col_ix in range(state.num_columns):
if state.representation[row_i... | 3.40625 | 3 |
main/migrations/0017_auto_20200608_1908.py | eugenek45/project-review | 0 | 40342 | <filename>main/migrations/0017_auto_20200608_1908.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2020-06-08 16:08
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
import django.utils.timezone
from django.utils.timezone import utc
class Migration(migrations.Mi... | 1.554688 | 2 |
tests/test_ClusterItemService.py | xclemence/pykube-switch | 0 | 40343 | <filename>tests/test_ClusterItemService.py<gh_stars>0
from pathlib import Path
from unittest import mock
from Services.ClusterItemService import ClusterItemService
from DataModels.Cluster import Cluster
def test_create_cluster(mocker):
class ConfigurationServiceMock(mock.Mock):
def add_file(self, file_... | 2.75 | 3 |
selftest/dir2/skipsome.py | depp/idiotest | 1 | 40344 | # Copyright 2012 <NAME> <<EMAIL>>
# See LICENSE.txt for details.
@test
def skip_this():
skip()
@test
def pass_this():
pass
@test
def skip_rest():
skip_module()
@test
def fail_this():
fail("shouldn't get here")
| 1.476563 | 1 |
pyramid_rest_route/view.py | rickmak/pyramid_resources | 0 | 40345 | import logging
from pyramid.httpexceptions import HTTPNotImplemented
from pyramid.renderers import render, render_to_response
log = logging.getLogger(__name__)
class RestView(object):
renderers = {}
def __init__(self, request):
self.request = request
self.params = request.params
se... | 2.40625 | 2 |
algorithm/codility.com/20160330/longest_0_binary_gap.py | leonard-sxy/algorithm-practice | 1 | 40346 | def solution(N):
str = '{0:b}'.format(N)
counter = prev_counter = 0
for c in str:
if c is '0':
counter += 1
else:
if prev_counter == 0 or counter > prev_counter:
prev_counter = counter
counter = 0
return prev_counter if prev_counter > counter else counter
| 3.46875 | 3 |
tpDcc/libs/qt/widgets/lightbox.py | tpDcc/tpQtLib | 3 | 40347 | <gh_stars>1-10
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
Module that contains lightbox widets
"""
from __future__ import print_function, division, absolute_import
from Qt.QtCore import Signal, QEvent
from Qt.QtWidgets import QWidget, QFrame
from tpDcc.libs.qt.core import animation
from tpDcc.libs.qt.widget... | 2.015625 | 2 |
m06_classes/misc_types.py | zkamel/learn-python | 80 | 40348 | class TransportType:
NAPALM = "napalm"
NCCLIENT = "ncclient"
NETMIKO = "netmiko"
class DeviceType:
IOS = "ios"
NXOS = "nxos"
NXOS_SSH = "nxos_ssh"
NEXUS = "nexus"
CISCO_NXOS = "cisco_nxos"
| 1.296875 | 1 |
gen_histograms.py | tobycmurray/wordle-fun | 0 | 40349 | <gh_stars>0
import sys
# buckets[0] reserved for '0'
# buckets[i] for i > 0 is for values in range (i-1)*binsize+1 .. i*binsize
buckets={}
binsize=1000
maxbucket=0
def read_bucket(bucket):
global buckets
if bucket not in buckets.keys():
buckets[bucket] = 0
return buckets[bucket]
def add_to_bucke... | 3.28125 | 3 |
bts/utilities/dbMaker_fixedLoc.py | ellisgeek/Burn-the-Subs | 10 | 40350 | # Let's make an database
#
# this is like the worst code ever
#
# just to make an test DB for burn the subs
import time
from datetime import datetime
from bts.dataBaseClass import Sub
def main():
fileName = open("subscriberListTest.txt")
print("making:")
for entry in fileName:
en... | 2.890625 | 3 |
test/drafts/2016-10-17_1931 Context Integration/a01 first rough draft.py | friedrichromstedt/upy | 3 | 40351 | <reponame>friedrichromstedt/upy<filename>test/drafts/2016-10-17_1931 Context Integration/a01 first rough draft.py<gh_stars>1-10
import upy2
from upy2.typesetting.scientific import ScientificTypesetter
a = upy2.undarray(10, 2)
with ScientificTypesetter(2, 3):
print a
print a
| 1.59375 | 2 |
main.py | schochastics/icwsm2021 | 1 | 40352 | <gh_stars>1-10
# pylint: disable=global-statement,redefined-outer-name
import argparse
import csv
import glob
import json
import os
import yaml
from flask import Flask, jsonify, redirect, render_template, send_from_directory
from flask_frozen import Freezer
from flaskext.markdown import Markdown
# ------------- SERVE... | 2.40625 | 2 |
handler.py | priyank9320/logo_lambda | 1 | 40353 | <filename>handler.py
import json
#import requests
import boto3
from boto3.dynamodb.conditions import Key
import random
import tldextract
from bs4 import BeautifulSoup
from googlesearch import search
import time
import re
from requests import Session # trying to create a session, might provide some improvement
requests ... | 2.4375 | 2 |
flatpages/bootstrap.py | amol-/tgapp-flatpages | 0 | 40354 | <gh_stars>0
# -*- coding: utf-8 -*-
"""Setup the flatpages application"""
from __future__ import print_function
from flatpages import model
from tgext.pluggable import app_model
import logging
log = logging.getLogger(__name__)
def bootstrap(command, conf, vars):
log.info('Bootstrapping flatpages...')
# cre... | 1.828125 | 2 |
models/infection/infection_demo/infection_demo.py | mit-quest/COVID19-campus-modeling | 0 | 40355 | <filename>models/infection/infection_demo/infection_demo.py
import os
import json
import random
import numpy as np
import pandas as pd
from pathlib import Path
from datetime import datetime
from models.common.model import Model
def type_of_day(date):
if pd.to_datetime(date).weekday() <= 4:
return 'weekd... | 2.65625 | 3 |
Olympiad Solutions/DMOJ/boolean.py | p1yush/code-DS-ALGO | 36 | 40356 | <filename>Olympiad Solutions/DMOJ/boolean.py
# <NAME>
# Solution to https://dmoj.ca/problem/boolean
#!/usr/bin/env python2.7
# -*- coding : utf-8 -*-
a = raw_input()
print eval(a) | 2.171875 | 2 |
src/integration/clients.py | syncopated/resum.me | 10 | 40357 | <filename>src/integration/clients.py
from .mixins import (IntegrationMixin, JsonResponseIntegrationMixin,
HtmlResponseIntegrationMixin)
class TreehouseIntegration(JsonResponseIntegrationMixin, IntegrationMixin):
integration_url = 'https://www.teamtreehouse.com/{username}.json'
@staticmeth... | 2.25 | 2 |
app/routers/vote.py | SatyamSuraj/fastapi | 0 | 40358 | <reponame>SatyamSuraj/fastapi
from fastapi import status, HTTPException, status, HTTPException, APIRouter
from fastapi.param_functions import Depends
from sqlalchemy.orm.session import Session
from ..database import get_db
from .. import models, schemas, oauth2
router = APIRouter(prefix="/vote", tags=["Vote"])
@rout... | 2.578125 | 3 |
blog/migrations/0010_auto_20201206_2106.py | gabrielstonedelza/connectdjango | 0 | 40359 | <reponame>gabrielstonedelza/connectdjango<filename>blog/migrations/0010_auto_20201206_2106.py
# Generated by Django 3.1.1 on 2020-12-06 21:06
import blog.validator
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0009_remove_chatroom_allow_any'),... | 1.640625 | 2 |
class7/ex7_nxapi_xml.py | sbyount/pyaut3 | 1 | 40360 | from getpass import getpass
from nxapi_plumbing import Device
from lxml import etree
from pprint import pprint as pp
# Disable Self-signed Certificate Warnings
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
'''... | 2.9375 | 3 |
backend/factories/__init__.py | heidal/apollo | 2 | 40361 | from .elections import * # no qa
from .users import * # no qa
| 1.007813 | 1 |
migrations/versions/dd503a5987b5_.py | atwh0405/miniblog | 0 | 40362 | <reponame>atwh0405/miniblog
"""empty message
Revision ID: dd503a5987b5
Revises: <KEY>
Create Date: 2016-08-30 16:48:54.954000
"""
# revision identifiers, used by Alembic.
revision = 'dd503a5987b5'
down_revision = '<KEY>'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated... | 1.492188 | 1 |
sols/1207.py | Paul11100/LeetCode | 0 | 40363 | <filename>sols/1207.py
from collections import Counter
class Solution:
# Counter (Accepted + Top Voted), O(n) time and space
def uniqueOccurrences(self, arr: List[int]) -> bool:
cnt = Counter(arr)
return len(set(cnt.values())) == len(cnt)
| 2.921875 | 3 |
abstract_rendering/numeric.py | detrout/python-abstract-rendering | 0 | 40364 | <reponame>detrout/python-abstract-rendering
from __future__ import print_function, division, absolute_import
from six.moves import reduce
import numpy as np
import math
import abstract_rendering.core as core
import abstract_rendering.util as util
# ----------- Aggregators -----------
class Count(core.GlyphAggregator... | 2.28125 | 2 |
docs/server/server.py | p-koscielniak/hexagonjs | 61 | 40365 | import os
import os.path
import webapp2
import logging
from webapp2 import WSGIApplication, Route
from google.appengine.api import users
# hack until we can make this public
cache = dict()
class Content(webapp2.RequestHandler):
def get(self, *args, **kwargs):
urlPath = args[0]
root = os.path.split(__file__... | 2.625 | 3 |
lib/crypto/webpay.py | oremj/zamboni | 0 | 40366 | <reponame>oremj/zamboni
import hashlib
import uuid
from django.conf import settings
import commonware.log
from moz_inapp_pay.verify import verify_claims, verify_keys
import jwt
log = commonware.log.getLogger('z.crypto')
secret = settings.APP_PURCHASE_SECRET
class InvalidSender(Exception):
pass
def get_uuid... | 2.046875 | 2 |
pipeline_student.py | wmpauli/knowledge_distillation | 10 | 40367 | # This file is used to define an AML pipeline for training the teacher on new labeled data
import json
import shutil
import os
from azureml.core import Workspace, Run, Experiment, Datastore
from azureml.data.data_reference import DataReference
from azureml.pipeline.core.schedule import ScheduleRecurrence, Schedule
fr... | 1.976563 | 2 |
pymtl3/stdlib/rtl/queues.py | hsqforfun/pymtl3 | 1 | 40368 | """
-------------------------------------------------------------------------
Library of RTL queues
-------------------------------------------------------------------------
Author : <NAME>
Date : Mar 23, 2019
"""
from pymtl3 import *
from pymtl3.stdlib.ifcs import DeqIfcRTL, EnqIfcRTL
from pymtl3.stdlib.rtl impor... | 2.28125 | 2 |
zucker.py | p0sitive/Zucker | 79 | 40369 | # coding=utf-8
#
# Copyright Zucker
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | 2.765625 | 3 |
fastapi-master-api/app/api/models/machine.py | SionAbes/fullstack-porfolio | 1 | 40370 | <gh_stars>1-10
# coding: utf-8
from __future__ import annotations
import re # noqa: F401
from datetime import date, datetime # noqa: F401
from typing import Any, Dict, List, Optional # noqa: F401
from pydantic import AnyUrl, BaseModel, EmailStr, validator # noqa: F401
class Machine(BaseModel):
"""NOTE: Thi... | 2.390625 | 2 |
daemon/lib/traceroute.py | shawnduong/CyberTrace | 2 | 40371 | <reponame>shawnduong/CyberTrace
import subprocess
def traceroute(dest: str) -> dict:
"""
Trace the route to some destination IP and return a dict of intermediates.
In order to prevent the daemon itself from needing to run with elevated
privileges, this is primarily handled by the system's traceroute utility.
"""
... | 3.3125 | 3 |
tests/providers/amazon/aws/links/test_base.py | holly-evans/airflow | 3 | 40372 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 1.796875 | 2 |
nematus/lm.py | thompsonb/DL4MT | 22 | 40373 | import kenlm
import os
import pickle
import tempfile
import zipfile
from config import KENLM_PATH
from pyro_utils import BGProc
from config import PORT_NUMBER, TEMP_DIR
import time
import subprocess
import shlex
def _unzip_to_tempdir(model_zip_path):
# temp folder (automatically deleted on exit)
tmpdir = te... | 2.390625 | 2 |
comments/models.py | ansuleymanova/comment_tree | 0 | 40374 | from django.db import models
from articles.models import Article
from users.models import User
class Comment(models.Model):
id = models.IntegerField(primary_key=True,
editable=False,
auto_created=True)
author = models.ForeignKey(User,
... | 2.21875 | 2 |
Dijkstra/Python/Dijkstra.py | DorAzaria/Problems-on-Algorithms-2 | 7 | 40375 | inf = 100000
def dijkstra(src, dest, graph: list[list], matrix: list[list]):
number_of_nodes = len(matrix)
visitors = [0 for i in range(len(matrix))]
previous = [-1 for i in range(len(matrix))]
distances = [inf for i in range(len(matrix))]
distances[src] = 0
current_node = getPriority(distan... | 3.53125 | 4 |
tests/test_controls_loki.py | chaostoolkit-incubator/chaostoolkit-grafana | 0 | 40376 | # -*- coding: utf-8 -*-
import requests_mock
from chaoslib.run import EventHandlerRegistry
from logzero import logger
from chaosgrafana.controls.loki import configure_control
def test_sending_to_loki():
with requests_mock.Mocker() as m:
m.post("http://localhost.test:3100/loki/api/v1/push", status_code=20... | 2.109375 | 2 |
LianJiaWangModel.py | stonewin540/python-web-spider | 0 | 40377 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""数据模型"""
__author__ = 'stone'
import re
import LianJiaWangConfig
class LianJiaWangModel(object):
def __init__(self):
self.title = ''
self.des = ''
self.time = ''
"""命名 bottom 是为了跟 HTML 代码中的名字保持一致并方便批量赋值;但其实的意义是 features"""
... | 2.78125 | 3 |
src/mmciad/utils/postprocessing.py | bjtho08/mmciad | 0 | 40378 | <filename>src/mmciad/utils/postprocessing.py
import numpy as np
def find_contrast_min_and_max(img):
AUTO_THRESHOLD = 5000
pixcount = img.size
limit = pixcount/10
threshold = pixcount/AUTO_THRESHOLD
n_bins = 256
values, _ = np.histogram(img, n_bins)
i = -1
found = False
count = 0
... | 2.609375 | 3 |
scripts/simRun.py | taoenkh/resilientdb | 0 | 40379 | <gh_stars>0
#!/usr/bin/python
#
# Command line arguments:
# [1] -- Number of server nodes
# [2] -- Name of result file
import os,sys,datetime,re
import shlex
import subprocess
import itertools
from sys import argv
from hostnames import *
home_directory="/home/expo"
PATH=os.getcwd()
#result_dir = PATH + "/results/"
res... | 2.109375 | 2 |
lib/cloud/cloudflare.py | GonzaloAlvarez/py-ga-sysadmin | 2 | 40380 | <reponame>GonzaloAlvarez/py-ga-sysadmin
from pyflare import PyflareClient
from lib.exceptions import RemoteOperationExecutionException, UnknownHostException
class CloudFlare:
def __init__(self, api_email, api_key):
self.cf = PyflareClient(api_email, api_key)
def updateDnsRecord(self, domain, host, ip)... | 2.3125 | 2 |
src/tts_interface.py | yDon96/pepper_assistant | 0 | 40381 | #!/usr/bin/env python3
from xmlrpc.client import Boolean
from sqlalchemy import false, true
import yaml
import os
import rospy
from ros_pepper_pkg.srv import *
from std_msgs.msg import String
from std_msgs.msg import Bool
def callback(message, tts_service, publisher):
"""
Topic callback.
Parameters
--... | 2.203125 | 2 |
images/326_power_of_three.py | FireinDark/leetcode_practice | 2 | 40382 | <gh_stars>1-10
# -*- coding: utf-8 -*-
__author__ = 'yi.liu'
class Solution(object):
# 递归
def isPowerOfThree(self, n):
"""
:type n: int
:rtype: bool
"""
if int(n) - n != 0:
return False
if n <= 0:
return False
if n == 1:
... | 3.6875 | 4 |
enaml_data/qt/qt_abstract_item.py | ulricheck/enaml_data | 0 | 40383 | <reponame>ulricheck/enaml_data<gh_stars>0
# -*- coding: utf-8 -*-
"""
Copyright (c) 2015, <NAME>.
Distributed under the terms of the MIT License.
The full license is in the file COPYING.txt, distributed with this software.
Created on Aug 24, 2015
"""
from atom.api import Instance, ForwardInstance, Bool
from enaml.core.... | 1.476563 | 1 |
alpha_amd/distances/__init__.py | Noodles-321/RegistrationEval | 14 | 40384 | <filename>alpha_amd/distances/__init__.py
from distances.q_image import QuantizedImage
from distances.alpha_amd import AlphaAMD
from distances.symmetric_amd_distance import SymmetricAMDDistance
import distances.sdt
import distances.jaccard
| 1.15625 | 1 |
pythondata_cpu_blackparrot/system_verilog/black-parrot/external/basejump_stl/testing/bsg_cache/regression_non_blocking/test_block_ld.py | litex-hub/pythondata-cpu-blackparrot | 3 | 40385 | import sys
import random
from test_base import *
class TestBlockLD(TestBase):
def generate(self):
self.clear_tag()
for n in range(50000):
store_not_load = random.randint(0,1)
tag = random.randint(0, 15)
index = random.randint(0,self.sets_p-1)
taddr = self.get_addr(tag,index)
... | 2.46875 | 2 |
easytoken/blob.py | sayanmondal2098/tokenizer | 3 | 40386 | import sys
import json
import nltk
import nltk
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize, sent_tokenize
class Partsofspeech():
def pos(txt):
tokens = nltk.word_tokenize(txt)
return (nltk.pos_tag(tokens))
# stop_words = set(stopwords.words('english')) | 2.921875 | 3 |
src/cihpc/common/utils/progress.py | janhybs/ci-hpi | 1 | 40387 | #!/bin/python3
# author: <NAME>
import sys
import time
basic_format = '{desc} {n:02d}/{total:02d} [{elapsed}/{remaining}] [{item_duration}/item]'
reverse_format = '{n:02d}/{total:02d} {desc} [{elapsed}/{remaining}] [{item_duration}/item]'
class Line(object):
def __init__(self, iterable=None, total=None, format=... | 2.96875 | 3 |
supermario/supermario 1118/mygame.py | Kimmiryeong/2DGP_GameProject | 0 | 40388 | import game_framework
import pico2d
import start_state
pico2d.open_canvas()
game_framework.run(start_state)
pico2d.close_canvas()
| 1.523438 | 2 |
leetcode/coding/editor.py | chishui/terminal-leetcode | 254 | 40389 | import os
import subprocess
from pathlib import Path
from ..views.viewhelper import delay_refresh_detail
from ..helper.config import config
def edit(filepath: Path, loop):
if isinstance(filepath, str):
filepath = Path(filepath)
editor = os.environ.get('EDITOR', 'vi').lower()
# vim
if editor ==... | 2.390625 | 2 |
src/mem/__init__.py | LeeChunHei/NXP-MCUBootUtility | 1 | 40390 | #!/usr/bin/env python
import RTxxx_memcore
import RTxxx_memdef
import RTyyyy_memcore
import RTyyyy_memdef
import memcore
import memdef
__all__ = ["RTxxx_memcore", "RTxxx_memdef", "RTyyyy_memcore", "RTyyyy_memdef", "memcore", "memdef"]
| 1.085938 | 1 |
website/scripts/update_product_list.py | zckoh/ecommerce-fullstack | 1 | 40391 | import json
import sys
import os
from algoliasearch.search_client import SearchClient
# This script updates the product list in products/data/product_list.json
# This is done by downloading the data from algolia index and replacing the product_list.json with the new content.
def main():
product_list_filepa... | 2.65625 | 3 |
pycftboot/sdpb/sdpb_docker.py | alepiazza/pycftboot | 0 | 40392 | <gh_stars>0
import os
from subprocess import CompletedProcess
import docker
from .sdpb import Sdpb
class SdpbDocker(Sdpb):
"""Interface for running ``SDPB`` and related software in docker container
Warning:
To use this interface docker must be installed and has to be able to pull
the specifi... | 2.609375 | 3 |
setup.py | nad2000/swagger_to_uml | 190 | 40393 | <gh_stars>100-1000
from setuptools import setup, find_packages
requires = [
'PyYAML==5.1'
]
setup(
name='swagger_to_uml',
version='0.1',
description='swagger_to_uml',
classifiers=[
"Programming Language :: Python"
],
author='<NAME>',
author_email='<EMAIL>',
license='MIT',
... | 1.148438 | 1 |
output/models/nist_data/atomic/unsigned_int/schema_instance/nistschema_sv_iv_atomic_unsigned_int_min_exclusive_1_xsd/__init__.py | tefra/xsdata-w3c-tests | 1 | 40394 | from output.models.nist_data.atomic.unsigned_int.schema_instance.nistschema_sv_iv_atomic_unsigned_int_min_exclusive_1_xsd.nistschema_sv_iv_atomic_unsigned_int_min_exclusive_1 import NistschemaSvIvAtomicUnsignedIntMinExclusive1
__all__ = [
"NistschemaSvIvAtomicUnsignedIntMinExclusive1",
]
| 1.007813 | 1 |
merge_CDR3.py | maxchang/IMGT-subsets | 0 | 40395 | <filename>merge_CDR3.py
#!/usr/bin/env python
import os
import sys
import pandas
SUBSET_POSITION = -3
def merge_CDR3_summaries(filename_list):
df_list = []
for filename in filename_list:
CDR3_df = pandas.read_csv(filename)
subset_name = os.path.abspath(filename).split(os.sep)[SUBSET_POSITION... | 3.140625 | 3 |
HW4/Q6/Q6.py | markblitz/RU_573_HW | 0 | 40396 | <reponame>markblitz/RU_573_HW<gh_stars>0
#!/usr/bin/env python
# coding: utf-8
# In[13]:
#site: https://www.geeksforgeeks.org/dijkstras-shortest-path-algorithm-greedy-algo-7/
# In[7]:
# Python program for Dijkstra's single
# source shortest path algorithm. The program is
# for adjacency matrix representation o... | 3.8125 | 4 |
docs/examples/viewobspy/serveobspy.py | crotwell/seisplotjs | 26 | 40397 | #!/usr/bin/env python
import asyncio
import io
import http.server
import json
import numpy
import os
import queue
import re
import sys
import threading
import websockets
from obspy.io.quakeml.core import Pickler
from obspy.core.stream import Stream
from obspy.core.utcdatetime import UTCDateTime
from obspy.core.event.... | 2.515625 | 3 |
fluidpythran/for_test_init.py | fluiddyn/fluidpythran | 1 | 40398 | <filename>fluidpythran/for_test_init.py
import numpy as np
# pythran import numpy as np
from fluidpythran import FluidPythran, boost, include, Array, Union
# pythran def func(int, float)
@boost
def func(a, b):
return a + b
@include
def func_tmp(arg):
return arg ** 2
A = Union[int, Array[int, "1d"]]
... | 2.4375 | 2 |
tests/bio_based/test_BBO.py | rishavpramanik/mealpy | 0 | 40399 | #!/usr/bin/env python
# Created by "Thieu" at 00:16, 15/03/2022 ----------%
# Email: <EMAIL> %
# Github: https://github.com/thieu1995 % ... | 2.359375 | 2 |