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 |
|---|---|---|---|---|---|---|
TomcatBrute.py | WallbreakerTeam/TomcatBrute | 16 | 12767351 | # encoding: utf-8
'''
Created on 2016-9-9
@author: lynn in WallbreakerTeam
'''
from burp import IBurpExtender, ITab
from javax import swing
from java.lang import Short
class BurpExtender(IBurpExtender, ITab):
'''
get url from proxy history window
'''
def registerExtenderCallbacks(sel... | 1.882813 | 2 |
Drawbotextension/KM-Laser-master/km_box_flexpath.py | fabloch/DrawbotInkscapeExtensions | 0 | 12767352 | <gh_stars>0
#!/usr/bin/env python3
# paths2flex.py
# This is an Inkscape extension to generate boxes with sides as flex which follow a path selected in inkscape
# The Inkscape objects must first be converted to paths (Path > Object to Path).
# Some paths may not work well -- if the curves are too small for example.... | 2.984375 | 3 |
HW4/submission/PART II/code/graph_cut_controller.py | ardaduz/math-cgv | 0 | 12767353 | import numpy as np
import scipy.ndimage as ndimage
import matplotlib.pyplot as plt
from skimage import data, color, img_as_float
from tkinter import *
from PIL import Image
from graph_cut import GraphCut
from graph_cut_gui import GraphCutGui
class GraphCutController:
def __init__(self):
self.__init_view... | 2.96875 | 3 |
notaso/restapiv2/filters.py | jpadilla/notaso | 11 | 12767354 | <gh_stars>10-100
import django_filters
from ..professors.models import Professor
from ..universities.models import University
class UniversityFilter(django_filters.FilterSet):
"""
Filter by University city
"""
class Meta:
model = University
fields = ["name", "city"]
class Professor... | 2.40625 | 2 |
python/test.py | syoyo/eson | 20 | 12767355 | <gh_stars>10-100
import eson
import struct
def packFloatList( floatList ):
return struct.pack( '<%sf' % len( floatList ), *floatList )
d = {}
farr = [1.0, 2.0, 2.1, 3.0, 3.5]
d['aa'] = long(3) # int() is still OK
d['bb'] = float(3)
d['cc'] = packFloatList(farr)
ed = eson.dumps(d)
f = open("test.eson", "wb")... | 2.515625 | 3 |
flo_web/src/wsFactory.py | Rehab-Robotics-Lab/LilFloSystem | 10 | 12767356 | <gh_stars>1-10
#!/usr/bin/env python
# pylint: skip-file
# This file comes copied from a library. There are only a few
# modified lines. Will leave style errors in place.
# Software License Agreement (BSD License)
#
# Copyright (c) 2012, <NAME>, Inc.
# All rights reserved.
#
# Redistribution and use in source and bin... | 1.257813 | 1 |
webchanges/config.py | scottmac/webchanges | 0 | 12767357 | <filename>webchanges/config.py
"""Command-line configuration."""
import argparse
import os
from os import PathLike
from pathlib import Path
from typing import List, Optional, Union
from . import __doc__, __project_name__, __version__
class BaseConfig(object):
"""Base configuration class."""
def __init__(
... | 2.265625 | 2 |
src/superpixels.py | dotimothy/EECS195-Colorization | 2 | 12767358 | # superpixels.py Performs SLIC algorithm #
# Authors: <NAME>, <NAME>, <NAME>, <NAME>``
# import the necessary packages
from skimage.segmentation import slic
from skimage.segmentation import mark_boundaries
from skimage.util import img_as_float
from skimage.util import img_as_ubyte
from skimage import data, io, segment... | 2.59375 | 3 |
skultrafast/tests/test_data_io.py | cZahn/skultrafast | 1 | 12767359 | <gh_stars>1-10
from skultrafast import data_io
from pathlib import Path
def test_load_exmaple():
wl, t, d = data_io.load_example()
assert ((t.shape[0], wl.shape[0]) == d.shape)
def test_path_loader():
p = data_io.get_example_path('sys_response')
assert Path(p).exists()
p = data_io.get_example_pa... | 2.15625 | 2 |
src/aiotk/_testing.py | AndreLouisCaron/aiotk | 5 | 12767360 | # -*- coding: utf-8 -*-
import asyncio
import inspect
import os
import signal as _signal
import sys
import traceback
from asyncio import (
AbstractEventLoop,
StreamReader,
StreamWriter,
)
from asyncio import Queue # noqa: F401
from contextlib import contextmanager
from itertools import count
from unitte... | 2.328125 | 2 |
deuceclient/tests/test_api_project.py | BenjamenMeyer/deuce-client | 0 | 12767361 | """
Tests - Deuce Client - API - Project
"""
from unittest import TestCase
import deuceclient.api as api
import deuceclient.common.errors as errors
import deuceclient.common.validation as val
from deuceclient.tests import *
class ProjectTest(TestCase):
def setUp(self):
super(ProjectTest, self).setUp()
... | 2.75 | 3 |
web_console_v2/api/fedlearner_webconsole/project/apis.py | duanbing/fedlearner | 0 | 12767362 | # Copyright 2020 The FedLearner Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 1.648438 | 2 |
longest_increasing_subsequence/_implementation.py | mCodingLLC/longest_increasing_subsequence | 7 | 12767363 | """Implementation of the longest increasing subsequence algorithm."""
import operator
from bisect import bisect_right, bisect_left
from typing import TypeVar, Optional, List, Any, Iterator, Sequence, Callable
T = TypeVar('T')
def longest_increasing_subsequence(seq: Sequence[T], strict=False, key: Callable = None) ->... | 4.0625 | 4 |
tests/test_common.py | multiplechoice/workplace | 2 | 12767364 | <filename>tests/test_common.py<gh_stars>1-10
from jobs.common import decode_date_string, translate_month
from freezegun import freeze_time
def test_month_lookups():
assert translate_month("jan") == 1
assert translate_month("feb") == 2
assert translate_month("mars") == 3
assert translate_month("apr\u00... | 2.390625 | 2 |
leasing/permissions.py | suutari-ai/mvj | 1 | 12767365 | from rest_framework import permissions
class MvjDjangoModelPermissions(permissions.DjangoModelPermissions):
"""Customized Django REST Framework DjangoModelPermissions
class that includes checking for the "view" permissions too.
"""
perms_map = {
"GET": ["%(app_label)s.view_%(model_name)s"],
... | 2.40625 | 2 |
src/vector2D.py | germtb/PyLight | 0 | 12767366 | from cmath import sqrt
from math import hypot
from utils import near_equal
class Vector2D:
def __init__(self, x, y):
self.x = x
self.y = y
def normalized(self):
modulus = sqrt(self.x * self.x + self.y * self.y)
return Vector2D(self.x / modulus, self.y / modulus)
def dot(s... | 3.4375 | 3 |
maestro/providers/aws/check_existence.py | tunein/Maestro | 12 | 12767367 | #External libs
import boto3
import sys
import json
import os
from botocore.exceptions import ClientError
#Establish our boto resources
client = boto3.client('lambda')
#This is only here for printing pretty colors
class color:
PURPLE = '\033[95m'
CYAN = '\033[96m'
DARKCYAN = '\033[36m'
BLUE = '\033[94m... | 2.625 | 3 |
models/contrastive.py | TheoMoutakanni/TCC-EEG | 0 | 12767368 | <gh_stars>0
import numpy as np
from sklearn.metrics import balanced_accuracy_score
from skorch import NeuralNetClassifier
from skorch.helper import predefined_split
from skorch.callbacks import EpochScoring, ProgressBar, EarlyStopping
import torch
from torch import nn
import torch.nn.functional as F
from utils.skorch ... | 2.203125 | 2 |
mangodb/test.py | 1005281342/learn | 1 | 12767369 | <reponame>1005281342/learn<filename>mangodb/test.py
"""
启动mongodb
mongod --config /usr/local/etc/mongod.conf
"""
import time
from pymongo import MongoClient
conn = MongoClient(host='127.0.0.1', port=27017)
test_db = conn['test']
test_table = test_db['test_table']
# test_table = test_db['test_table_city']
# ... | 2.515625 | 3 |
visualdet3d/networks/detectors/__init__.py | tamnguyenvan/visualdet3d-tf | 0 | 12767370 | <reponame>tamnguyenvan/visualdet3d-tf
from .yolostereo3d_detector import YOLOStereo3DCore | 0.835938 | 1 |
activelearning/utils.py | xiaoqiqi177/DR-segmentation | 2 | 12767371 | import os
import glob
from preprocess import clahe_gridsize
import cv2
train_ratio = 0.7
eval_ratio = 0.3
test_ratio = 0.
def get_images(image_dir, preprocess=False, phase='train', healthy_included=True):
if preprocess:
limit = 2
grid_size = 8
if not os.path.exists(os.path.join(image_dir, ... | 2.359375 | 2 |
src/slu/trainer.py | colincen/coach | 0 | 12767372 |
from src.slu.datareader import domain_set, y1_set, y2_set
from preprocess.gen_embeddings_for_slu import domain2slot
import torch
import torch.nn as nn
import os
from tqdm import tqdm
import numpy as np
import logging
logger = logging.getLogger()
from src.conll2002_metrics import *
class SLUTrainer(object):
def ... | 2.359375 | 2 |
shfl/private/reproducibility.py | joarreg/Sherpa.ai-Federated-Learning-Framework | 2 | 12767373 | import random
import numpy as np
import tensorflow as tf
class Reproducibility:
"""
Singleton class for ensure reproducibility.
You indicates the seed and the execution is the same. The server initialice this class and the clients only
call/get a seed.
Server initialize it with Reproducibility(se... | 3.34375 | 3 |
cephlm/tests/cephmetrics/system/test_hpssacli.py | ArdanaCLM/cephlm | 0 | 12767374 | #!/usr/bin/env python
#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE 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
#
# http://www.apache.org/... | 2.09375 | 2 |
chaos_genius/alerts/utils.py | rsohlot/chaos_genius | 320 | 12767375 | """Common utilities for alerts and alert digests."""
import os
from math import floor, log10
from typing import List, Optional, Union
from jinja2 import Environment, FileSystemLoader, select_autoescape
from chaos_genius.alerts.email import send_static_alert_email
from chaos_genius.core.utils.round import round_numbe... | 2.421875 | 2 |
youtube_transcript_api/__init__.py | crhowell/youtube-transcript-api | 0 | 12767376 | <filename>youtube_transcript_api/__init__.py
from ._api import YouTubeTranscriptApi
from ._transcripts import TranscriptList, Transcript
from ._errors import (
TranscriptsDisabled,
NoTranscriptFound,
CouldNotRetrieveTranscript,
VideoUnavailable,
TooManyRequests,
NotTranslatable,
TranslationL... | 1.351563 | 1 |
utils.py | ERUIHNIYHBKBNF/Digit-Recognition | 0 | 12767377 | <filename>utils.py
import cv2
import numpy as np
import os
def saveimg(img, name):
dirpath = "./train_data"
filepath = os.path.join(dirpath, name)
cv2.imwrite(filepath, img)
def showimg(img):
cv2.namedWindow("Image", 0)
cv2.imshow("Image", img)
cv2.waitKey(0)
def showImgWithCons(img, cons):
cv2.drawCon... | 3.125 | 3 |
src/graph_build/tests/otp_graph_import/conftest.py | hellej/hope-green-path-server | 5 | 12767378 | <filename>src/graph_build/tests/otp_graph_import/conftest.py
import os
import pytest
from graph_build.otp_graph_import.conf import OtpGraphImportConf
conf = OtpGraphImportConf(
node_csv_file = 'graph_build/tests/otp_graph_import/data/test_nodes.csv',
edge_csv_file = 'graph_build/tests/otp_graph_import/data/te... | 1.765625 | 2 |
sso_trial/routing.py | ujjawal01/temporary-repo | 0 | 12767379 | <reponame>ujjawal01/temporary-repo
from channels.routing import ProtocolTypeRouter, URLRouter
from django.conf.urls import url
from channels.http import AsgiHandler
from channels.auth import AuthMiddlewareStack
import news.routing
application = ProtocolTypeRouter({
"websocket": AuthMiddlewareStack(
URLRo... | 1.796875 | 2 |
setup.py | Tinggaard/pathfinding | 0 | 12767380 | <gh_stars>0
from setuptools import setup
setup(
name='pathfinding',
version='0.1.0',
# metadata
author='<NAME>',
author_email='<EMAIL>',
description='Using pathfinding algorithms to solve mazes.',
keywords='pathfinding maze labyrith astar dijkstra breadthfirst depthfirst solving daedalus',... | 1.296875 | 1 |
carpool.py | JackMao981/Carpool | 0 | 12767381 | import numpy as np
import math
from generate_schedule import *
def adjacent(g,node, n):
"""
find all adjacent nodes of input node in g
g: 2D array of numbers, the adjacency matrix
node: int, the node whose neighber you wanna find
return: a list of ints
"""
result = []
for i in range(... | 3.9375 | 4 |
Python-Fundamentals/Dictionaries/statistics.py | Xamaneone/SoftUni-Intro | 0 | 12767382 | data = input()
products = {}
while not data == "statistics":
product, quantity = data.split(": ")
quantity = int(quantity)
if product in products:
products[product] += quantity
else:
products[product] = quantity
data = input()
print("Products in stock:")
for product in products:
... | 3.96875 | 4 |
tracardi_aws_sqs/model/model.py | Tracardi/tracardi-aws-sqs-connector | 0 | 12767383 | from typing import Any
from pydantic import validator, create_model, AnyHttpUrl
from pydantic.main import BaseModel
from tracardi.domain.entity import Entity
class AwsIamAuth(BaseModel):
aws_access_key_id: str
aws_secret_access_key: str
class Content(BaseModel):
content: str
type: str
@validat... | 2.703125 | 3 |
inventory/api/api_views.py | jeff-eng/Commune | 1 | 12767384 | from rest_framework import permissions
from rest_framework.generics import ListAPIView, CreateAPIView, RetrieveUpdateDestroyAPIView
from rest_framework.exceptions import ValidationError
from inventory.api.serializers import AssetSerializer, BorrowerSerializer, CategorySerializer
from inventory.models import Asset, Borr... | 2.171875 | 2 |
envios/api/models.py | serivt/aes-amazoom | 0 | 12767385 | <filename>envios/api/models.py
from django.db import models
class Shipping(models.Model):
product = models.CharField(max_length=2023)
address = models.CharField(max_length=2023)
amount = models.IntegerField()
total_price = models.FloatField()
def __str__(self):
return self.product
@p... | 2.84375 | 3 |
gammapy/time/tests/test_exptest.py | contrera/gammapy | 0 | 12767386 | <gh_stars>0
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import absolute_import, division, print_function, unicode_literals
from numpy.testing import assert_allclose
from astropy.units import Quantity
from ..exptest import exptest
from ..simulate import random_times
def test_exptest... | 1.742188 | 2 |
SpiderNest/core/regexs.py | thomaszdxsn/SpiderNest | 1 | 12767387 | """
author: thomaszdxsn
"""
import re
__all__ = ('RE_DATETIME', 'RE_IMG_SRC', 'RE_DATE', 'RE_UNIT_NUM', 'RE_CHINESE')
RE_DATETIME = re.compile(r'\d{2,4}-\d{1,2}-\d{1,2} \d{1,2}:\d{1,2}:\d{1,2}')
RE_DATE = re.compile(r'\d{2,4}-\d{1,2}-\d{1,2}')
RE_IMG_SRC = re.compile(r'<img\s+src=[\'\"](.*?)[\'\"].*?/?>', flags=re.D... | 2.671875 | 3 |
load-tester/loadTester/loadTester.py | artofimagination/snippets | 2 | 12767388 | <gh_stars>1-10
import time
from locust import HttpUser, task, between
from locust import events
import json
import random
userID = 1
class testUserAdd(HttpUser):
wait_time = between(0.1, 2)
@task(3)
def getUser(self):
self.client.get("/")
pass
@task
def addUser(self):
... | 2.546875 | 3 |
leetcode-1.py | liujiaboy/Suanfa | 0 | 12767389 | <gh_stars>0
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
def createList(l: list) -> ListNode:
header = current = ListNode()
for i in range(0, len(l)):
current.next = current = ListNode(l[i])
return header.next
def printList(l: ListNode):
while l:
p... | 3.75 | 4 |
gql/schema/Media.py | allanwright/media-classifier-api | 1 | 12767390 | <reponame>allanwright/media-classifier-api
import graphene
from .Classification import Classification
from .Entity import Entity
class Media(graphene.ObjectType):
name = graphene.String()
classification = graphene.Field(Classification)
entities = graphene.List(Entity)
@staticmethod
def resolve_cl... | 2.515625 | 3 |
Cogs/Responses.py | camielverdult/CorpBot.py | 0 | 12767391 | <reponame>camielverdult/CorpBot.py<filename>Cogs/Responses.py
import discord
import re
import time
from discord.ext import commands
from Cogs import Settings, DisplayName, Utils, Nullify, PickList
def setup(bot):
# Add the bot and deps
settings = bot.get_cog("Settings")
bot.add_cog(Responses(bot... | 2.265625 | 2 |
PubNubPublishARM/GetUniqueId.py | IDEO-coLAB/demo-vehicle-rec-microservice | 1 | 12767392 | # File : GetUniqueId.py
# Subprogram to generate a unique id for Pubnub message
# Author: <NAME>
import uuid
def GenerateId():
unique_id=uuid.uuid1()
str_id=str(unique_id)
return str_id
| 2.796875 | 3 |
recipes/Python/576957_Asynchronous_subprocess_using/recipe-576957.py | tdiprima/code | 2,023 | 12767393 | <gh_stars>1000+
#!/usr/bin/env python
"""asyncsubproc.py: Asynchronous subprocess communication using asyncore.
The `AsyncPopen` class wraps the I/O pipes from `Popen` in asynchronous
dispatchers, providing asynchronous communication with the subprocess using
`asyncore.loop()` to read and write in parallel with other... | 2.6875 | 3 |
funs.py | sjTaylor/cmd_queue | 0 | 12767394 | <gh_stars>0
import struct
import sys
import select
import codes
import logging
import json
import os
def get_logger(name):
logging.basicConfig(format='%(asctime)s | %(name)s | %(levelname)s | %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p',
level=logging.DEBUG)
log = logging.getLogger(nam... | 2.609375 | 3 |
api/models.py | JavierBarajas552/drf_shoestore_frontend | 0 | 12767395 | <gh_stars>0
from django.db import models
# Create your models here.
class Manufacturer(models.Model):
name = models.CharField(max_length=100)
website = models.URLField()
class ShoeType(models.Model):
style = models.CharField(max_length=20)
class ShoeColor(models.Model):
color_name = models.CharFi... | 2.375 | 2 |
labeller/rectangle-labeler-image.py | EveCharbie/rectangle-labelling | 0 | 12767396 | <reponame>EveCharbie/rectangle-labelling<filename>labeller/rectangle-labeler-image.py<gh_stars>0
import cv2
import numpy as np
from tqdm.notebook import tqdm
import pickle
def draw_points_and_lines():
global points_labels, circle_colors, circle_radius, iFrame, image, clone, active_points, rectangle_color
cl... | 2.34375 | 2 |
Geolocation/Data/Design2a/design2a_11k_test5/pilot.0000/rp_install/lib/python2.7/site-packages/radical/utils/zmq/utils.py | radical-experiments/iceberg_escience | 1 | 12767397 | <reponame>radical-experiments/iceberg_escience
import os
import msgpack
import radical.utils as ru
# ------------------------------------------------------------------------------
#
def get_channel_url(ep_type, channel=None, url=None):
'''
For the given endpoint type, ensure that both channel name and endpo... | 2.515625 | 3 |
ps2000aExamples/ps2000aSigGen.py | joe-jordan/picosdk-python-wrappers | 0 | 12767398 | <filename>ps2000aExamples/ps2000aSigGen.py<gh_stars>0
#
# Copyright (C) 2018 Pico Technology Ltd. See LICENSE file for terms.
#
# PS2000a SIGNAL GENERATOR EXAMPLE
# This example opens a 2000a driver device, sets up the singal generator to produce a sine wave, then a a square wave
# then perform a sweep of a square wave... | 2.46875 | 2 |
src/pytorch_metric_learning/losses/signal_to_noise_ratio_losses.py | wconnell/pytorch-metric-learning | 1 | 12767399 | <reponame>wconnell/pytorch-metric-learning<gh_stars>1-10
from ..utils import common_functions as c_f
from .contrastive_loss import ContrastiveLoss
from ..distances import SNRDistance
class SignalToNoiseRatioContrastiveLoss(ContrastiveLoss):
def __init__(self,**kwargs):
super().__init__(**kwargs)
... | 2.46875 | 2 |
shop/urls.py | sling254/swAPP | 0 | 12767400 | <filename>shop/urls.py
from django.urls import path
from .views import IndexView,ProductsView,CheckoutView,UpdateView,CartView, suppliersView
urlpatterns = [
path('', IndexView, name='index'),
path('products/', ProductsView, name='products'),
path('checkout/', CheckoutView, name='checkout'),
path('supp... | 1.84375 | 2 |
4-static-methods-0.py | Otumian-empire/My-PyClasses | 0 | 12767401 | <reponame>Otumian-empire/My-PyClasses<gh_stars>0
# static methods
# use the staticmethod decorator
class Human:
@staticmethod
def speak():
print("I can speak")
Human().speak()
me = Human()
me.speak() # this line will give error
# expected an error.. but there isn't any
# static methods can be called on an in... | 3.015625 | 3 |
mqtt_broker/main.py | drtinao/KIV-DS-4HW | 0 | 12767402 | <reponame>drtinao/KIV-DS-4HW
from kazoo.client import KazooClient
import time
import sys
import logging
import socket # for working with network con
import subprocess
# constants - START
PARENT_NODE = "mqtt_brokers_list"
NODE_NAME = "mqtt_node"
PARENT_NODE_MQTT_CLIENT = "mqtt_clients_list"
TIMEOUT_CON_ZOOKEEPER = 100... | 2.3125 | 2 |
test/functional/test-framework/log/base_log.py | josehu07/open-cas-linux-mf | 2 | 12767403 | <gh_stars>1-10
#
# Copyright(c) 2019-2020 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
from enum import Enum
from re import sub
class BaseLogResult(Enum):
DEBUG = 10
PASSED = 11
WORKAROUND = 12
WARNING = 13
SKIPPED = 14
FAILED = 15
EXCEPTION = 16
BLOCKED = 17
... | 2.109375 | 2 |
aktools/api_debug/local_debug.py | xiaoguangge/aktools | 1 | 12767404 | # -*- coding:utf-8 -*-
# /usr/bin/env python
"""
Date: 2021/12/9 19:09
Desc: HTTP 测试
"""
import requests
import pandas as pd
url = "http://1172.16.17.32:8080/api/stock_financial_hk_analysis_indicator_em"
params = {
"stock": "00700",
"indicator": "年度"
}
r = requests.get(url, params=params)
temp_df = pd.DataFra... | 3.375 | 3 |
aula7_classes_calculadora2.py | clovisdanielcosta/dio-python | 0 | 12767405 | # Sem passar valores pelo init
class Calculadora:
# def __init__(self):
# pass
def soma(self, valor_a, valor_b):
return valor_a + valor_b
def subtracao(self, valor_a, valor_b):
return valor_a - valor_b
def multiplicacao(self, valor_a, valor_b):
return valor_a * valor_... | 3.734375 | 4 |
skeleton/models.py | l99fiamingo/ioniCup | 1 | 12767406 | from django.db import models
from django.core.validators import MinValueValidator, MaxValueValidator
from django.template.defaultfilters import slugify
# Create your models here.
class Tournament(models.Model):
year = models.CharField(max_length=99)
title = models.CharField(max_length=99, blank=True)
slug... | 2.296875 | 2 |
tests/test_functions.py | rtidatascience/django-postgres-power | 16 | 12767407 | <reponame>rtidatascience/django-postgres-power
from django.test import TestCase
from datetime import datetime
from postgres_stats import DateTrunc, Extract
from .models import Checkin
class TestFunctions(TestCase):
def test_date_trunc(self):
_checkin = Checkin.objects.create(logged_at='2015-11-01 11:14:0... | 2.40625 | 2 |
suvec/vk_api_impl/session/records_managing/records.py | ProtsenkoAI/skady-user-vectorizer | 1 | 12767408 | <reponame>ProtsenkoAI/skady-user-vectorizer
import time
from typing import Optional, List
from abc import abstractmethod, ABC
from .session_types import Proxy, Credentials
from .consts import ResourceStatus, RESOURCE_OK_STATUS
class Record(ABC):
def __init__(self, obj_id: int, status: ResourceStatus = RESOURCE_O... | 2.34375 | 2 |
python_07_function/music.py | lexiaoyuan/PythonCrashCourse | 0 | 12767409 | <reponame>lexiaoyuan/PythonCrashCourse
def make_album(singer, album, numbers=''):
albums = {'singer': singer, 'album': album}
if numbers:
albums['numbers'] = numbers
return albums
print(make_album('张靓颖', '终于等到你'))
print(make_album('邓丽君', '我只在乎你', 20))
print(make_album('汪小敏', '笑看风云'))
while True:
... | 3.859375 | 4 |
setup.py | akrk1986/re-wx | 0 | 12767410 | <gh_stars>0
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="re-wx",
version="0.0.1",
author="<NAME>",
author_email="<EMAIL>",
description="A library for building modern declarative desktop applications in WX",
long_description=long... | 1.492188 | 1 |
ops_challenge/ops_challenge05/classes/malware.py | jinwoov/Ops401 | 0 | 12767411 | <filename>ops_challenge/ops_challenge05/classes/malware.py<gh_stars>0
import os, ctypes, urllib.request, datetime, subprocess, time, win32gui
from .helper_method import *
class Malware:
def __init__(self):
self.user_name = os.path.expanduser("~")
self.ab_path = f"{self.user_name}/Desktop/"
def... | 3.03125 | 3 |
vector_2d/__init__.py | betados/vector_2D | 3 | 12767412 | <reponame>betados/vector_2D<filename>vector_2d/__init__.py
from vector_2d.vector import *
from vector_2d.vectorPolar import *
__all__ = ["vector", "vectorPolar", "VectorPolar", "Vector", "round_vector", "angle", "distance_point_line",
"distance_point_segment"]
| 1.65625 | 2 |
restful_mys/controller/auth.py | YnkDK/restful-mys | 0 | 12767413 | <filename>restful_mys/controller/auth.py
import time
from flask.ext.restful import Resource, reqparse, abort
from flask import jsonify
from ..model.auth import Auth as Model
from restful_mys.controller.secure_resource import SecureResource
class Auth(Resource):
def __init__(self):
"""
Sets up re... | 3.1875 | 3 |
03/spiral_memory.py | redfast00/advent_of_code_2017 | 0 | 12767414 | <gh_stars>0
def get_level(cell):
i = 0
while cell > (2*i+1)**2:
i += 1
return i
def find_coord(cell):
level = get_level(cell)
x = level
y = -level
current = (2*level+1)**2
while x != -level:
if current == cell:
return (x, y)
x-=1
current -= 1
... | 3.453125 | 3 |
runoob/basic_tutorial/for.py | zeroonegit/python | 1 | 12767415 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Filename: for.py
edibles = ['ham', 'spam', 'eggs', 'nuts']
for food in edibles:
if food == 'spam':
print('No more spam please!')
break
print('Great, delicious ' + food)
else:
print('I am so glad: No spam!')
print('Finally, I finished stuffing... | 3.609375 | 4 |
abnormal/Address.py | 89berner/abnormal | 4 | 12767416 | import logging
import json
import re
import time
import os
import traceback
import sys
import Utils
import cv2
import hashlib
from BeautifulSoup import BeautifulSoup
from selenium.webdriver.common.by import By
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities... | 2.515625 | 3 |
aoc2020/day_02/part_2.py | en0/aoc2020 | 0 | 12767417 | <reponame>en0/aoc2020
from .part_1 import Solution as Part1Solution
class Solution(Part1Solution):
expected = 1
@classmethod
def check_pw(cls, line: str):
policy, pw = line.split(': ', 2)
pos, letter = policy.split(' ')
pos1, pos2 = pos.split('-')
return sum([
... | 3.28125 | 3 |
MainWeb.py | leonevo/euao | 2 | 12767418 | #!/usr/bin/env python
#-*- coding: utf-8 -*-
#
# Copyright 2012 <EMAIL>
#
import tornado.httpserver
import tornado.ioloop
from tornadows import soaphandler
from tornadows import webservices
from tornadows import xmltypes
from tornadows.soaphandler import webservice
from time import ctime,sleep
import Comm... | 1.960938 | 2 |
server/opendp_apps/analysis/testing/test_dp_count_spec.py | mikephelan/opendp-ux | 0 | 12767419 | import json
from os.path import abspath, dirname, isfile, join
CURRENT_DIR = dirname(abspath(__file__))
TEST_DATA_DIR = join(dirname(dirname(dirname(CURRENT_DIR))), 'test_data')
from opendp_apps.analysis.testing.base_stat_spec_test import StatSpecTestCase
from opendp_apps.analysis.tools.dp_count_spec import DPCountSp... | 2.09375 | 2 |
tests/test_utils_paths.py | gva-jjoyce/gva_data | 0 | 12767420 | <filename>tests/test_utils_paths.py<gh_stars>0
"""
Tests for paths to ensure the split and join methods
of paths return the expected values for various
stimulus.
"""
import datetime
import sys
import os
sys.path.insert(1, os.path.join(sys.path[0], '..'))
from gva.utils import paths
try:
from rich import ... | 2.71875 | 3 |
github.py | utsengar/GitMetrics | 0 | 12767421 | <gh_stars>0
import heapq
import calendar
import requests
from app import cache, GITHUB_BASE, GITHUB_API_TOKEN, CACHE_TTL
from datetime import datetime
from flask import Response
headers = {"Accept": "application/vnd.github.v3+json", "Authorization" : "token " + GITHUB_API_TOKEN}
def get_from_cache(resource):
data... | 2.453125 | 2 |
bridger/markdown/models.py | intellineers/django-bridger | 2 | 12767422 | <gh_stars>1-10
import pathlib
import uuid
from django.db import models
from django.dispatch import receiver
class Asset(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
file = models.FileField(upload_to="markdown/assets")
content_type = models.CharField(max_len... | 2.21875 | 2 |
rnns/gru.py | anoidgit/zero | 111 | 12767423 | # coding: utf-8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from func import linear
from rnns import cell as cell
class gru(cell.Cell):
"""The Gated Recurrent Unit."""
def __init__(self, d, ln=False, scope='gru'):
... | 2.984375 | 3 |
biostar/apps/planet/models.py | Torres63/biostar | 1 | 12767424 | from django.db import models
from django.conf import settings
import os, urllib, logging, feedparser, datetime
from django.core.urlresolvers import reverse
from django.utils.timezone import utc
from django.contrib import admin
logger = logging.getLogger(__name__)
def now():
return datetime.datetime.utcnow().repla... | 2.25 | 2 |
05-TCP-IP/shelly/shelly_red_flash.py | outsmartit/raspberry-pi-home-automation | 30 | 12767425 | <filename>05-TCP-IP/shelly/shelly_red_flash.py
"""Let a Shelly RGBW2 LED controller flash the LEDs red.
Copyright (C) 2020 <NAME>
License: MIT
"""
import time
import requests
# Define URLs for the Shelly HTTP API
IP = "http://192.168.0.202"
SHELLY = IP + "/shelly"
COLOR = IP + "/color/0/"
DISABLE_EFFECTS = "effect=... | 3.234375 | 3 |
tests/test_remeha.py | TheRikke/remeha_tz | 7 | 12767426 | import json
import os
import tempfile
from unittest import mock
from remeha import read_config, FileLogger
from remeha_core import Frame
from tests.test_base import TestBase
class TestRemeha(TestBase):
raw_test_data = bytearray([0x02, 0x01, 0xfe, 0x06, 0x48, 0x02, 0x01, 0xa2,
0x12,... | 2.21875 | 2 |
common/_webdriver_qa_api/core/selenium_dynamic_elements.py | albalabkin/PyCats | 0 | 12767427 | <reponame>albalabkin/PyCats<filename>common/_webdriver_qa_api/core/selenium_dynamic_elements.py
import logging
from selenium.common.exceptions import NoSuchElementException, StaleElementReferenceException
logger = logging.getLogger(__name__)
class DynamicElement:
def __init__(self, locator_type, locator, driver... | 2.53125 | 3 |
apps/vim/plugins/ultisnips/python_snippets.py | codecat555/codecat555-fidgetingbits_knausj_talon | 1 | 12767428 | from talon import Context
ctx = Context()
ctx.matches = r"""
tag: user.vim_ultisnips
mode: user.python
mode: command
and code.language: python
"""
# spoken name -> snippet name
ultisnips_snippets = {
"header": "#!",
"if main": "ifmain",
"for loop": "for",
"class": "class",
"function": "def",
"m... | 2.3125 | 2 |
analysis_layer/test_permutation.py | tpimentelms/phonotactic-complexity | 5 | 12767429 | <reponame>tpimentelms/phonotactic-complexity
import numpy as np
def paired_permutation_test(art, norm, verbose=True):
diffs = [art[i] - norm[i] for i in range(len(art))]
mu = np.abs(np.mean(diffs))
n = 0
for i in range(2**len(art)):
permut = bin(i)[2:]
permut = [0] * (len(art) - len(p... | 3.140625 | 3 |
DisMail/api/secmail/account.py | heisid/DisMail | 8 | 12767430 | from .classes import Inbox, Stash
from .inbox import get_inbox, read_mail
class SecmailAccount(object):
def __init__(self, email):
self.pagination = 0
self.email = email
self.login, self.domain = email.split('@')
self.inbox = list()
def refresh(self):
inbox = get_inbox(self.login, self.domain)
stashes =... | 2.578125 | 3 |
src/adherent/trajectory_generation/trajectory_generator.py | ami-iit/paper_viceconte_2021_ral_adherent | 6 | 12767431 | <gh_stars>1-10
# SPDX-FileCopyrightText: <NAME> Italiano di Tecnologia
# SPDX-License-Identifier: BSD-3-Clause
# Use tf version 2.3.0 as 1.x
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
import os
import math
import json
import yarp
import numpy as np
from typing import List, Dict
from scenario import ga... | 1.96875 | 2 |
set6/c44_attack_dsa_repeated_nonce.py | kangtastic/cryptopals | 1 | 12767432 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# DSA nonce recovery from repeated nonce
#
# Cryptanalytic MVP award.
#
# This attack (in an elliptic curve group) broke the PS3. It is a great,
# great attack.
#
# In this file:
#
# https://cryptopals.com/static/challenge-data/44.txt
#
# find a collection of DSA-s... | 2.390625 | 2 |
async_dns/core/address.py | gera2ld/async_dns | 59 | 12767433 | import socket
from typing import Union
from urllib.parse import urlparse
from . import types
__all__ = [
'Host',
'Address',
'InvalidHost',
'InvalidIP',
]
class Host:
hostname: str
port: Union[int, None]
username: Union[str, None]
password: Union[str, None]
def __init__(self, net... | 3.28125 | 3 |
skos/__init__.py | alex-ip/vocview | 0 | 12767434 | <gh_stars>0
from rdflib.namespace import RDF, SKOS, DCTERMS, RDFS, OWL, DC
from rdflib import URIRef, Namespace
import markdown
from flask import url_for
from config import Config
from skos.concept_scheme import ConceptScheme, ConceptSchemeRenderer
from skos.concept import Concept, ConceptRenderer
from skos.register i... | 2.125 | 2 |
trac/Lib/site-packages/projectplan-0.93.0-py2.7-patched.egg/projectplan/pptickets.py | thinkbase/PortableTrac | 2 | 12767435 | <reponame>thinkbase/PortableTrac<gh_stars>1-10
# -*- coding: utf-8 -*-
import datetime
import pputil
from trac.util.datefmt import to_datetime, utc
from trac.ticket.model import Ticket
class TSExtensionRegister(object):
'''
TicketSet Extension Register
'''
# TODO: Class for Render/TicketSet Extension, with ... | 2.09375 | 2 |
test/functional/abc_p2p_avalanche_proof_voting.py | johnkuney/bitcoin-abc | 0 | 12767436 | #!/usr/bin/env python3
# Copyright (c) 2021 The Bitcoin developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the resolution of conflicting proofs via avalanche."""
import time
from test_framework.avatools import (
... | 2.0625 | 2 |
quoteline.py | G4me4u/typeformer | 0 | 12767437 | <reponame>G4me4u/typeformer<filename>quoteline.py
class QuoteLine:
def __init__(self, lineText, lineNumber, origin):
self.lineText = lineText
self.lineNumber = lineNumber
self.origin = origin
self.renderedLine = None
def renderLine(self, font, color):
'''
Renders the line using the given font and colo... | 2.53125 | 3 |
tests/integration/__init__.py | JawboneHealth/jhhalchemy | 2 | 12767438 | """
Integration tests
""" | 1.046875 | 1 |
src/max10_generate.py | krtkr/altera_kicad_gen | 0 | 12767439 | # -*- coding: utf-8 -*-
'''
Created on 20 июл. 2017 г.
@author: krtkr
'''
import sys
import getopt
from KicadSymGen.draw import Library
from KicadSymGen.generate import Generator
from KicadSymGen.generate import Layout
from KicadSymGen.parse.altera import Max10Reader
from KicadSymGen.parse.altera import Max10Parser... | 2.234375 | 2 |
utils/ConstantUtils.py | JoeBuzh/DeepWater | 1 | 12767440 | # -*- encoding: utf-8 -*-
'''
@Filename : ConstantUtils.py
@Datetime : 2020/09/27 17:10:12
@Author : Joe-Bu
@version : 1.0
'''
from enum import Enum
class MonitorItem(Enum):
"""
Water Monitoring Items.
"""
ITEMS = ['watertemp', 'pH', 'DO', 'conductivity', 'turbidity']
INDEX = ['cod... | 2.734375 | 3 |
waldren/base/td_db_client.py | waldren/tradekit | 0 | 12767441 | from tda import auth, client
#from tda.orders import EquityOrderBuilder, Duration, Session
import json
import CONFIG as config
import datetime
from datetime import timedelta
import pandas as pd
import os
import sys
import psycopg2
class Client:
def __init__(self, config=config):
self.config = config
... | 2.5 | 2 |
prometheus_adaptive_cards/config/settings_raw.py | trallnag/prometheus-adaptive-cards | 0 | 12767442 | """
Module made to merge and process all configs for PromAC into a single nested
dictionary. Ready to be injected into the settings models that PromAC uses.
Copyright © 2020 <NAME> - Licensed under the Apache License 2.0
"""
import os
from box import Box
from loguru import logger
import prometheus_adaptive_cards.co... | 2.890625 | 3 |
mathgame.py | rg3/mathgame | 0 | 12767443 | #!/usr/bin/env python
# SPDX-FileCopyrightText: 2021 <NAME> <<EMAIL>>
# SPDX-License-Identifier: MIT
import random
import sys
class Operation(object):
def valid (self, a, b):
return True
def result(self, a, b):
raise TypeError
def symbol(self):
raise TypeError
class Addition(Op... | 3.4375 | 3 |
blog/templatetags/blog_tags.py | masod-abbasian/mysite | 2 | 12767444 | <filename>blog/templatetags/blog_tags.py
from django import template
from blog.models import POST,Comment
from blog.models import Category
register = template.Library()
@register.simple_tag(name="totalposts")
def function():
posts = POST.objects.filter(status=1).count()
return posts
@register.simple_tag(name=... | 2.375 | 2 |
sps-auto-utilities.py | 0xBXIII/SPS-Auto-Utilities | 3 | 12767445 | <reponame>0xBXIII/SPS-Auto-Utilities
from beem import Hive
from beem.account import Account
import beemgraphenebase.ecdsasig
from binascii import hexlify
from datetime import datetime
from time import time
import requests
import sys
import yaml
from yaml.loader import SafeLoader
APP_NAME = 'sps-auto-utilities'
def st... | 2.203125 | 2 |
students/tests/test_student_views.py | ovod88/studentsdb | 0 | 12767446 | from datetime import datetime
from django.test import TestCase, Client
from django.urls import reverse
from students.models.students import Student
from students.models.groups import Group
class TestStudentList(TestCase):
def setUp(self):
# create 2 groups
group1, created = Group.objects.get_or... | 2.5625 | 3 |
research/test_singleton.py | FXTD-ODYSSEY/QBinder | 13 | 12767447 | <filename>research/test_singleton.py
# -*- coding: utf-8 -*-
"""
"""
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
__author__ = 'timmyliang'
__email__ = '<EMAIL>'
__date__ = '2020-10-30 19:42:26'
import inspect
import threading
from PySide2 import QtCor... | 2.546875 | 3 |
Python/Programming Fundamentals/Text Processing/13. Substring.py | teodoramilcheva/softuni-software-engineering | 0 | 12767448 | first_str = input()
second_str = input()
while first_str in second_str:
second_str = second_str.replace(first_str, '')
print(second_str) | 3.609375 | 4 |
setup.py | gingerphoenix10/ClockPython | 0 | 12767449 | <filename>setup.py<gh_stars>0
from setuptools import setup
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name='ClockPython',
version='0.0.1',
description='Gets the current 12 or 24 hour time',
py_modules=["clockpython"],
package_dir={'': 'src'},
classifiers=[
"Programming... | 1.5 | 2 |
Supermicro/benchmarks/bert/implementations/pytorch_SYS-420GP-TNAR/unit_test/test_main.py | gglin001/training_results_v1.1 | 27 | 12767450 | # NVIDIA
import unittest
from test_bert_batch_1 import *
#from test_bert_batch_7 import *
from test_embeddings_batch_1 import *
from test_encoders_batch_1 import *
if __name__ == '__main__':
unittest.main(verbosity=2)
| 1.257813 | 1 |