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 |
|---|---|---|---|---|---|---|
Algo and DSA/LeetCode-Solutions-master/Python/intersection-of-two-linked-lists.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 52300 | # Time: O(m + n)
# Space: O(1)
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
# @param two ListNodes
# @return the intersected ListNode
def getIntersectionNode(self, headA, headB):
curA, curB = headA, headB
while cu... | 3.515625 | 4 |
example/example/urls.py | AI-App/Django-Browser-Reload | 0 | 52301 | from django.urls import include, path
from example.core import views as core_views
urlpatterns = [
path("", core_views.index_django),
path("jinja/", core_views.index_jinja),
path("__reload__/", include("django_browser_reload.urls")),
]
| 1.71875 | 2 |
SpriteTRY2.py | RouSage/magistrprog | 0 | 52302 | from random import randint
import pygame
pygame.init()
pygame.time.set_timer(pygame.USEREVENT, 3000)
W = 400
H = 400
WHITE = (255, 255, 255)
CARS = ('sp_humans/Walk0000.png', 'sp_humans/Walk0001.png', 'sp_humans/Walk0005.png')
CARS_SURF = [] # для хранения готовых машин-поверхностей
# надо установить видео режим д... | 3.203125 | 3 |
graffan/cli/analyse.py | SimonBoothroyd/graffan | 2 | 52303 | import click
from graffan.library.analysis.targets import analyze_targets
from graffan.library.models.analysis import AnalysedIteration
from graffan.utilities.forcebalance import (
extract_target_parameters,
load_fb_force_field,
)
@click.command("analyse", help="Analyzes the output of a ForceBalance iteratio... | 2.484375 | 2 |
tests/test_wikipedia.py | cauliyang/test-poetry | 0 | 52304 | from test_poetry import wikipedia
def test_random_page_use_given_language(mock_requests_get):
wikipedia.random_page(language="de")
| 1.875 | 2 |
response/core/util.py | ojno/response | 1,408 | 52305 | import bleach
import bleach_whitelist
from django.conf import settings
from rest_framework.pagination import PageNumberPagination
def sanitize(string):
# bleach doesn't handle None so let's not pass it
if string and getattr(settings, "RESPONSE_SANITIZE_USER_INPUT", True):
return bleach.clean(
... | 2.234375 | 2 |
tests/r/test_lost_letter.py | hajime9652/observations | 199 | 52306 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.lost_letter import lost_letter
def test_lost_letter():
"""Test module lost_letter.py by downloading
lost_letter.csv and testing shape of
e... | 2.421875 | 2 |
pyBrematic/devices/brennenstuhl/__init__.py | d-Rickyy-b/Brematic-Controller | 11 | 52307 | # -*- coding: utf-8 -*-
from .RCR1000N import RCR1000N
from .RCS1000N import RCS1000N
__all__ = ["RCR1000N", "RCS1000N"]
| 0.996094 | 1 |
generated-libraries/python/netapp/lun/fcp_down_hba_info.py | radekg/netapp-ontap-lib-get | 2 | 52308 | <reponame>radekg/netapp-ontap-lib-get<filename>generated-libraries/python/netapp/lun/fcp_down_hba_info.py
from netapp.netapp_object import NetAppObject
class FcpDownHbaInfo(NetAppObject):
"""
Information about a down FCP HBA
"""
_adapter = None
@property
def adapter(self):
"""
... | 2.234375 | 2 |
ParameterFinder.py | NicoBenndorf/CarND-Advanced-Lane-Lines | 0 | 52309 | #importing some useful packages
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import cv2
import os
import pickle
import glob
import sys
class ParameterFinder:
def __init__(self, image, _h_channel_low=0, _h_channel_high=255, _l_channel_low=0, _l_channel_high=255,
... | 2.359375 | 2 |
smartRemotes/nodes/hassioNode/zones/masterBedroom.py | HeadHodge/smartHome | 1 | 52310 | <reponame>HeadHodge/smartHome
#############################################
## hassioNode commandWord map
#############################################
print('Load hassioNode masterBedroom commandWord map')
wordMap = {
"Media": {
"Louder": [
{"id": 0, "type": "call_service", "domain": "me... | 1.867188 | 2 |
setup.py | ourlink/dash_subsidy | 0 | 52311 | <reponame>ourlink/dash_subsidy
from distutils.core import setup, Extension
dash_subsidy_module = Extension('dash_subsidy', sources = ['dash_subsidy.cpp'])
setup (name = 'dash_subsidy',
version = '1.3',
description = 'Subsidy function for Dash',
ext_modules = [dash_subsidy_module])
| 1.320313 | 1 |
backend/api/avrae/cogs5e/models/initiative.py | XoriensLair/XoriensLair.github.io | 0 | 52312 | <gh_stars>0
import cachetools
from api.avrae.cogs5e.funcs.dice import roll
from api.avrae.cogs5e.models.errors import ChannelInCombat, CombatChannelNotFound, CombatException, CombatNotFound, \
InvalidArgument, NoCharacter, NoCombatants, RequiresContext
from api.avrae.cogs5e.models.monster import MonsterCastableSpe... | 1.90625 | 2 |
plugins/Operations/Encoding/unicode_format_dialog.py | nmantani/FileInsight-plugins | 120 | 52313 | #
# Unicode escape format setting dialog for the following plugins:
# Unicode escape
# Unicode unescape
#
# Copyright (c) 2020, <NAME>
# 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.617188 | 2 |
.modules/.recon-ng/modules/recon/hosts-hosts/resolve.py | termux-one/EasY_HaCk | 1,103 | 52314 | <filename>.modules/.recon-ng/modules/recon/hosts-hosts/resolve.py
from recon.core.module import BaseModule
from recon.mixins.resolver import ResolverMixin
import dns.resolver
class Module(BaseModule, ResolverMixin):
meta = {
'name': 'Hostname Resolver',
'author': '<NAME> (@LaNMaSteR53)',
'... | 2.34375 | 2 |
pixelpuncher/player/migrations/0024_auto_20160906_0234.py | ej2/pixelpuncher | 0 | 52315 | # -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-09-06 02:34
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import django_extensions.db.fields
class Migration(migrations.Migration):
dependencies = [
('item', '0018_auto_20160906_... | 1.648438 | 2 |
aztk/spark/models/plugins/spark_ui_proxy/configuration.py | Geims83/aztk | 161 | 52316 | import os
from aztk.models.plugins.plugin_configuration import PluginConfiguration, PluginPort, PluginTargetRole
from aztk.models.plugins.plugin_file import PluginFile
dir_path = os.path.dirname(os.path.realpath(__file__))
class SparkUIProxyPlugin(PluginConfiguration):
def __init__(self):
super().__init_... | 1.835938 | 2 |
flaml/tune/__init__.py | wuchihsu/FLAML | 1,747 | 52317 | <filename>flaml/tune/__init__.py
try:
from ray import __version__ as ray_version
assert ray_version >= '1.0.0'
from ray.tune import (uniform, quniform, choice, randint, qrandint, randn,
qrandn, loguniform, qloguniform, lograndint, qlograndint)
except (ImportError, AssertionErr... | 1.90625 | 2 |
dhs-gene-proximity.py | bmajoros/BIGGER | 0 | 52318 | #!/usr/bin/env python
#=========================================================================
# This is OPEN SOURCE SOFTWARE governed by the Gnu General Public
# License (GPL) version 3, as described at www.opensource.org.
# Copyright (C)2021 <NAME> <<EMAIL>>
#========================================================... | 2.4375 | 2 |
recognizeface.py | btashton/puppyface | 0 | 52319 | <gh_stars>0
import argparse
import json
import cv2
def recognize(model, image, threshold):
emodel = cv2.createEigenFaceRecognizer(threshold=threshold)
emodel.load(model)
simg = cv2.imread(image, cv2.IMREAD_GRAYSCALE)
simg = cv2.resize(simg, (256,256))
[p_label, p_confidence] = emodel.predict(simg... | 2.546875 | 3 |
pycatia/mec_mod_interfaces/vertex.py | evereux/catia_python | 90 | 52320 | #! usr/bin/python3.6
"""
Module initially auto generated using V5Automation files from CATIA V5 R28 on 2020-06-11 12:40:47.360445
.. warning::
The notes denoted "CAA V5 Visual Basic Help" are to be used as reference only.
They are there as a guide as to how the visual basic / catscript function... | 2.71875 | 3 |
tests/utils.py | dribia/driconfig | 17 | 52321 | """Utility functions for the testing module.
Dribia 2021/08/04, irene <<EMAIL>>
"""
| 0.949219 | 1 |
Templates/StopSignDetection.py | benji1123/modelE | 0 | 52322 | from picamera.array import PiRGBArray
from picamera import PiCamera
import time
import cv2
import numpy as np
#setting up picamera
camera = PiCamera()
camera.resolution = (640, 480)
camera.framerate = 24
rawCapture = PiRGBArray(camera, size=(640, 480))
time.sleep(0.1)
template = cv2.imread("assets/stop_sign.jpg",... | 2.828125 | 3 |
costurero/pytest/test_math.py | tonper19/PythonDemos | 0 | 52323 | <reponame>tonper19/PythonDemos
def add(x, y):
return x + y
def subtract(x, y):
return x - y
def inc(x):
return x + 1
def test_add():
assert add(1, 2) == 3
def test_subtract():
assert subtract(2, 1) == 1
def test_inc():
assert inc(1) == 2
| 3.625 | 4 |
oceanex_py3/personal.py | laalaguer/oceanex_py3 | 3 | 52324 | <reponame>laalaguer/oceanex_py3
'''
Personal API methods of Oceanex. Requires authentication.
See https://api.oceanex.pro/doc/v1/
'''
import jwt
import requests
URL = 'https://api.oceanex.cc/v1'
TIMEOUT = 15 # 15 seconds
class Personal:
def __init__(self, uid, apikey_id, private_key_location):
self.uid ... | 2.671875 | 3 |
src/repnano/models/helper.py | organic-chemistry/RepNano | 5 | 52325 | class lrd:
def __init__(self, waiting_time, start_lr, min_lr, factor):
self.waiting_time = waiting_time
self.start_lr = start_lr
self.min_lr = min_lr
self.factor = factor
self.min_value = 10000000000000000000
self.waited = 0
self.actual_lr = self.start_lr
... | 3.25 | 3 |
forensics/smells_like_nice_challenge/files/generate_challenge.py | PWrWhiteHats/BtS-CTF-Challenges-03-2021 | 7 | 52326 | <reponame>PWrWhiteHats/BtS-CTF-Challenges-03-2021
import wave
import dotenv
dotenv.load('resources/challenge.env')
SSTV_FILE = dotenv.get('SSTV_FILE') or 'flag.wav'
SONG_FILE = dotenv.get('SONG_FILE') or 'resources/nirvana.wav'
CHALLENGE_FILE = dotenv.get('CHALLENGE_FILE') or 'challenge.wav'
# Read wave song audio fi... | 2.6875 | 3 |
python/utir/visitor/__init__.py | ChanTsune/Unit-Test-IR | 2 | 52327 | <filename>python/utir/visitor/__init__.py
from utir.ast import *
def iter_fields(node):
"""
Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields``
that is present on *node*.
"""
for field in node._fields:
try:
yield field, getattr(node, field)
except... | 2.890625 | 3 |
cflearn/models/cv/gan/protocol.py | carefree0910/carefree-learn | 400 | 52328 | import torch
import random
import torch.nn as nn
from abc import abstractmethod
from abc import ABCMeta
from torch import Tensor
from typing import Any
from typing import Dict
from typing import List
from typing import Tuple
from typing import Optional
from .losses import GANLoss
from .losses import GANTarget
from .... | 1.859375 | 2 |
6th_semester/NumMethods/3_lab/task5.py | mehakun/Labs | 3 | 52329 | import numpy as np
def rectangles(interval, f, h):
a, b = interval
x = np.linspace(a, b, int((b - a) / h + 1))
integral = h * np.sum([f((i + j) / 2) for i, j in zip(x, x[1:])])
return integral
def trapezium(interval, f, h):
a, b = interval
x = np.linspace(a, b, int((b - a) / h + 1))
y ... | 2.84375 | 3 |
prometheus_ecs_discoverer/__init__.py | broadcastplatforms/prometheus-ecs-discoverer | 12 | 52330 | import os
from dynaconf import Dynaconf # type: ignore
current_directory = os.path.dirname(os.path.realpath(__file__))
settings = Dynaconf(
envvar_prefix="PROMED",
settings_files=[
f"{current_directory}/settings.toml",
],
)
settings["DEBUG"] = True if settings.LOG_LEVEL == "DEBUG" else False
... | 1.765625 | 2 |
avalon/max_/pipeline.py | MoonShineVFX/avalon-core | 6 | 52331 | import os
import sys
import errno
import importlib
import contextlib
# print("prepare Avalon Max Pipeline")
from pyblish import api as pyblish
from . import lib, workio
from ..lib import logger
from .. import api, io, schema, Session
from ..vendor import six
from ..vendor.Qt import QtCore, QtWidgets
from ..pipeline i... | 1.828125 | 2 |
Exam 01/exam01.py | JessicaHamilton/PHYS-3210 | 0 | 52332 | <filename>Exam 01/exam01.py
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 23 21:13:00 2019
@author: hamil
"""
import numpy as np
import matplotlib.pyplot as plt
import numpy.random as rand
#first function for old version of game
def old_cherry(N):
#initialize values for tree,basket, and turns
Cherry_tree = ... | 3.890625 | 4 |
tests/cfngin/lookups/handlers/test_hook_data.py | cmilam87/runway | 0 | 52333 | <gh_stars>0
"""Tests for runway.cfngin.lookups.handlers.hook_data."""
import unittest
from runway.cfngin.context import Context
from runway.cfngin.lookups.handlers.hook_data import HookDataLookup
class TestHookDataLookup(unittest.TestCase):
"""Tests for runway.cfngin.lookups.handlers.hook_data.HookDataLookup."""... | 2.671875 | 3 |
Aron/Day5/answer.py | coolafabbe/AdventOfCode2021 | 0 | 52334 | <gh_stars>0
import time, sys
GREEN = '\033[92m'
GRAY = '\033[90m'
END_COLOR = '\033[0m'
CLR = '\x1B[0K'
g=100
def print_graph(graph, graph_dim, visualize):
danger_points = 0
for y in range(len(graph)):
for x in range(len(graph[0])):
if graph[x][y] == 0:
if visualize:
... | 3.3125 | 3 |
Modules/pred/classes.py | iheb-brini/fitness-lab | 0 | 52335 | <reponame>iheb-brini/fitness-lab
from abc import ABC, abstractmethod
class AbstractPredictor(ABC):
@abstractmethod
def predict(self, model, x, **kwargs):
pass
class Prediction:
predictor: AbstractPredictor
def __init__(self, predictor: AbstractPredictor) -> None:
self.predictor = p... | 2.6875 | 3 |
butterwire/ingestor.py | ringhiera/butterwire | 0 | 52336 | # -*- coding: utf-8 -*-
import logging
import sys
import requests
import backoff
import quandl
from ingestionDao import IngestionDaoItf
class IngestorItf( object ):
"""Abstract base class for ingestors,
the class provides a prototypical get data, and no fringes."""
def get_data( self ):
raise ... | 2.46875 | 2 |
apps/UDPCountToLeds/receiver.py | csiro-wsn/tinyos-main-wsn-course | 0 | 52337 | from socket import *
from struct import unpack
UDPSock = socket(AF_INET6,SOCK_DGRAM)
UDPSock.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)
UDPSock.bind(("",1234))
#UDPSock.bind(("fd00:c2b6:b24b:be67:2827:688d:e6a1:6a3b",1234))
while True:
data,addr = UDPSock.recvfrom(1024)
if not data:
print "Client has ... | 2.75 | 3 |
hard-gists/2344345/snippet.py | jjhenkel/dockerizeme | 21 | 52338 | <reponame>jjhenkel/dockerizeme
"""
DrupalPasswordHasher
To use, put this in any app and add to your settings.py, something like this:
PASSWORD_HASHERS = (
'django.contrib.auth.hashers.PBKDF2PasswordHasher',
'myproject.myapp.drupal_hasher.DrupalPasswordHasher',
'django.contrib.auth.hashers.PBKDF2SHA1Passwo... | 2.25 | 2 |
emrtd_face_access/face_compare.py | vaibhavantil2/eMRTD_face_access | 6 | 52339 | #!/usr/bin/env python3
# Copyright (c) 2021 <NAME>
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
"""This module does comparison of two images"""
import argparse
import os
from io import BytesIO
from typing import Union, List, Tuple
from pathlib import Path
import numpy a... | 2.640625 | 3 |
hudeven/P007.py | hudeven/algorithms | 0 | 52340 | class Solution(object):
def reverse(self, x):
"""
:type x: int
:rtype: int
"""
MAX_INT = (1 << 31) - 1
MIN_INT = -MAX_INT - 1
if x == MIN_INT: return 0
res = 0
p = x if x >= 0 else -x
while p != 0:
digit = p % 10
... | 3.3125 | 3 |
run.py | serre-lab/KuraNet | 1 | 52341 | <reponame>serre-lab/KuraNet
import subprocess
import argparse
from distutils.util import strtobool
import os
from data import make_data
from configparser import ConfigParser
import torch
# Use this script to train multiple experiments at once.
argparser = argparse.ArgumentParser()
argparser.add_argument('--experime... | 2.140625 | 2 |
covid19.py | emanuel2718/Covid-19-Scrapper | 1 | 52342 | #!/usr/bin/env python
# Author: by <NAME> on March 15, 2020
# Date: March 15, 2020
from matplotlib import pyplot
from pydoc import pager
from time import sleep
import argparse
import datetime as dt
import json
import matplotlib
import pandas as pd
import requests
import seaborn
import sys
import yaml
def main():
... | 2.96875 | 3 |
AMAO/apps/Avaliacao/Questao/models/filtro_questao.py | arruda/amao | 2 | 52343 | <filename>AMAO/apps/Avaliacao/Questao/models/filtro_questao.py
# -*- coding: utf-8 -*-
from django.db import models
from tipo_questao import TipoQuestao
from questao import Questao
#from libs.uniqifiers_benchmark import f11 as uniqifier
class FiltroQuestao(models.Model):
"""
Classe que ira gerar uma questao(Q... | 2.515625 | 3 |
archive/2021-03-7/tools/debugging.py | CambridgeSemiticsLab/BH_time_collocations | 5 | 52344 | import sys
class Debugger(object):
"""Display debugging messages if toggled"""
def __init__(self, boolean):
self.report = boolean
self.indent = 0
def say(self, msg, indent=0, end='\n'):
self.indent = indent or self.indent
if self.report:
indent = self.indent * '\... | 3.125 | 3 |
euler/four.py | GhostofGoes/machine-learning | 2 | 52345 | <gh_stars>1-10
#!/usr/bin/env python3
def check_palindrome(num):
num = str(num)
for i in range(0, int((len(num) + 1) / 2)):
if num[i] != num[-i]:
return False
return True
def simple_palindrome(num):
num = str(num)
return num == num[::-1]
biggest = 0
for i in ... | 3.8125 | 4 |
tools/extract_features.py | LogoRecognition/Detector | 0 | 52346 | import _init_paths
import tensorflow as tf
from fast_rcnn.config import cfg
from fast_rcnn.test import im_detect
from fast_rcnn.nms_wrapper import nms
from utils.timer import Timer
#import matplotlib
#matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import os, sys, cv2
import argparse
from netwo... | 2.09375 | 2 |
exercices/atbash-cipher/atbash_cipher.py | gkaeso/exercism-python | 0 | 52347 | from string import ascii_lowercase
BLOCK_SIZE = 5
def _cipher(text):
translation_table = str.maketrans(ascii_lowercase, ascii_lowercase[::-1])
return ''.join([c.translate(translation_table) for c in text.replace(' ', '').lower() if c.isalnum()])
def encode(plain_text):
encoded = _cipher(plain_text)
... | 3.78125 | 4 |
cifra/encoding/reverse.py | dante-signal31/cifra | 0 | 52348 | """
Reverse encoding functions.
Reverse encoding is the simplest of encoding methods. It just reverses order of
text characters.
"""
def encode(text: str) -> str:
"""
Reverse order of given text characters.
:param text: Text to reverse.
:return: Reversed text.
"""
reversed_text = "".join(cha... | 4.59375 | 5 |
old/strip_hefesto2.py | ScottHull/Exoplanet-Pocketknife | 0 | 52349 | import os
import pandas as pd
if __name__ == "__main__":
print("In what directory shall we parse?")
to_dir = input(">>> ")
for root, dirs, files in os.walk(os.getcwd() + "/" + to_dir, topdown=False):
operating_dir = root
if "fort.58" in str(root):
if "strip_hefe... | 2.59375 | 3 |
populate_cones.py | peytondmurray/jdh2020 | 1 | 52350 | <reponame>peytondmurray/jdh2020
"""Generate the array of cones representing the magnetization at each simulation cell. Then, animate
the cones to orient in the direction of the magnetization; also animate the material color of each cone
to map the z-component of the orientation to colors using Matplotlib's RdBu_r color... | 3.265625 | 3 |
dvc/prompt.py | amjadsaadeh/dvc | 0 | 52351 | import sys
from dvc.progress import progress
try:
# NOTE: in Python3 raw_input() was renamed to input()
input = raw_input
except NameError:
pass
class Prompt(object):
def __init__(self):
self.default = None
def prompt(self, msg, default=False): # pragma: no cover
if self.defaul... | 2.84375 | 3 |
app.py | sasidharpunna/CRMFBot | 0 | 52352 | from flask import Flask, render_template, request
from chatterbot import ChatBot
import pypyodbc as odbc
import re
app = Flask(__name__)
CRMFBot = ChatBot("Chatterbot", storage_adapter="chatterbot.storage.SQLStorageAdapter")
@app.route("/")
def home():
return render_template("index.html")
@app.route("/get")
def g... | 2.6875 | 3 |
app.py | qiaojianjunjojo/Easy-Api-Python3.7-Flask | 1 | 52353 | <filename>app.py<gh_stars>1-10
from flask import Flask,redirect,url_for
from flask_cors import CORS
from flasgger import Swagger
from flask_limiter import Limiter
from flask_limiter.util import get_remote_address
app = Flask(__name__)
CORS(app) #跨域问题
Swagger(app) #api 文档生成工具swagger
limiter = Limiter(
app,
ke... | 2.28125 | 2 |
scratchai/attacks/attacks/semantic.py | iArunava/scratchai | 101 | 52354 | """
Semantic adversarial Examples
"""
__all__ = ['semantic', 'Semantic']
def semantic(x, center:bool=True, max_val:float=1.):
"""
Semantic adversarial examples.
https://arxiv.org/abs/1703.06857
Note: data must either be centered (so that the negative image can be
made by simple negation) or must be in t... | 3.78125 | 4 |
snoo.py | EthanC/Snoopy | 1 | 52355 | import logging
from os import path
from sys import exit
from typing import Any, Dict, List, Optional, Tuple, Union
import coloredlogs
import httpx
import praw
from util import Utility
log: logging.Logger = logging.getLogger(__name__)
coloredlogs.install(level="INFO", fmt="[%(asctime)s] %(message)s", datefmt="%I:%M:%... | 2.640625 | 3 |
Day-48/Wiki_Interaction/interaction.py | MihirMore/100daysofcode-Python | 4 | 52356 | <reponame>MihirMore/100daysofcode-Python
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
chrome_driver_path = "C:\Program Files\chromedriver_win32\chromedriver.exe"
driver = webdriver.Chrome(executable_path=chrome_driver_path)
driver.get("http://secure-retreat-92358.herokuapp.com/")
num... | 3.046875 | 3 |
src/ska_tango_examples/teams/CalendarClock.py | ska-telescope/tango-example | 2 | 52357 | # pylint: disable=C0103
# pylint: disable=unnecessary-lambda
"""
This module illustates the humble object principal
whereby the business logic is
seperated from the external interfaces.
class CalendarClockDevice
This class is an implementation of a Tango Device.
No business logic exists in this class.
class C... | 2.625 | 3 |
textadapter/tests/data/benchmarks.py | ContinuumIO/TextAdapter | 22 | 52358 | import timeit
import os
def timeFunction(function, setup):
print 'timing', function
t = timeit.Timer(stmt=function, setup=setup)
times = []
for i in range(0,3):
os.system('sudo sh -c "sync; echo 3 > /proc/sys/vm/drop_caches"')
times.append(str(t.timeit(number=1)))
return min(times)... | 2.796875 | 3 |
code/prediction/methods.py | philipversteeg/validation-yeast | 1 | 52359 | """Methods that predict a causal effect.
Instantiate class and call fit method.
"""
# stdlib
import os
import time
import abc
from functools import wraps
import tempfile
from subprocess import check_call
# math stats ml
import numpy as np
from scipy.stats import kendalltau, spearmanr
from scipy.spatial.distance impor... | 2.640625 | 3 |
o/soft_robot/derivation_of_dynamics/kinematics_mac2.py | YoshimitsuMatsutaIe/ctrlab2021_soudan | 0 | 52360 | """運動学関係
2次のマクローリン展開
"""
import sympy as sy
from sympy import sqrt
import sumi_maclaurin_2.P_0 as P_0
import sumi_maclaurin_2.P_1 as P_1
import sumi_maclaurin_2.P_2 as P_2
import sumi_maclaurin_2.R_0_0 as R_0_0
import sumi_maclaurin_2.R_0_1 as R_0_1
import sumi_maclaurin_2.R_0_2 as R_0_2
import sumi_maclaurin_2.R_0... | 3.40625 | 3 |
IMLearn/learners/classifiers/linear_discriminant_analysis.py | TomeRozen/IML.HUJI | 0 | 52361 | from typing import NoReturn
from ...base import BaseEstimator
import numpy as np
from numpy.linalg import det, inv
from scipy.stats import multivariate_normal
class LDA(BaseEstimator):
"""
Linear Discriminant Analysis (LDA) classifier
Attributes
----------
self.classes_ : np.ndarray of shape (n_c... | 2.921875 | 3 |
benchmarks/function_benchmarks/convolve_ztz.py | sophiaas/alphacsc | 89 | 52362 | <gh_stars>10-100
import time
import numba
import numpy as np
import pandas as pd
from joblib import Memory
import matplotlib.pyplot as plt
from scipy.stats.mstats import gmean
memory = Memory(location='', verbose=0)
@numba.jit((numba.float64[:, :, :], numba.float64[:, :]), cache=True)
def numpy_convolve_uv(ztz, uv... | 2.25 | 2 |
punctuation/visualisation/visualisation.py | alex-darmon/punctuation-stylometry | 1 | 52363 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 1 08:04:50 2019
@author: alexandradarmon
"""
import random
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from punctuation.config import options
from punctuation.visualisation.heatmap_functions import heatmap, annotate_he... | 2.546875 | 3 |
Client.py | jdacode/Multi-Client-Server-Communication | 0 | 52364 | '''# *************************************************************
# 2018
# *************************************************************
#
# CLIENT
#
# *************************************************************'''
# Import function from socket module
#... | 3.109375 | 3 |
mzmembership/mzmembership/doctype/membership/membership.py | nabeelnajeeb1/membership_ | 0 | 52365 | # Copyright (c) 2021, M20Zero and contributors
# For license information, please see license.txt
import frappe
from frappe.model.document import Document
class Membership(Document):
def on_submit(self):
self.make_invoice()
def make_invoice(self):
self.invoice_entry(self.name,self.member,self.... | 2.125 | 2 |
RMC/prepare_augmented_data.py | jfc43/eval-transductive-robustness | 0 | 52366 | import argparse
import os
import numpy as np
import torch
import torch.optim as optim
from torch.utils.data import DataLoader, TensorDataset
from torchvision import transforms
from torchvision import datasets
from utils.lib import *
from utils.pgd_attack import *
from models.resnet import ResNet
def test(model, data... | 2.21875 | 2 |
lime/lime_tabular.py | vinoth654321/LIME | 0 | 52367 | """
Functions for explaining classifiers that use tabular data (matrices).
"""
import collections
import json
import copy
import numpy as np
import sklearn
import sklearn.preprocessing
from . import lime_base
from . import explanation
class TableDomainMapper(explanation.DomainMapper):
"""Maps feature ids to names,... | 3.296875 | 3 |
py_pdf_term/candidates/_candidates/filters/__init__.py | kumachan-mis/py-pdf-term | 0 | 52368 | <gh_stars>0
from .combiner import FilterCombiner
from .term import (
BaseCandidateTermFilter,
EnglishConcatenationFilter,
EnglishNumericFilter,
EnglishProperNounFilter,
EnglishSymbolLikeFilter,
JapaneseConcatenationFilter,
JapaneseNumericFilter,
JapaneseProperNounFilter,
JapaneseSymb... | 1.507813 | 2 |
calibrate.py | darcy-buttrose/raspipool | 0 | 52369 | #!/usr/bin/python
import math
import time
import sys
import fcntl
from AtlasI2C import (
AtlasI2C
)
TIMEOUT = 60
def get_devices():
device = AtlasI2C()
device_address_list = device.list_i2c_devices()
device_list = []
for i in device_address_list:
device.set_i2c_address(i)
try... | 2.875 | 3 |
Algorithms/Long Pressed Name.py | KushRabadia/Leetcode | 0 | 52370 | <reponame>KushRabadia/Leetcode
class Solution(object):
def isLongPressedName(self, name, typed):
"""
:type name: str
:type typed: str
:rtype: bool
"""
if name == typed:
return True
for c in name:
try:
index = ty... | 3.390625 | 3 |
Source/FaceRecognition/Agents/SystemAgent.py | robertkarol/ReDe-Multiagent-Face-Recognition-System | 0 | 52371 | from Utils.Logging import LoggingMixin
from spade.agent import Agent
from spade.behaviour import CyclicBehaviour
from spade.message import Message
class SystemAgent(Agent, LoggingMixin):
class MessageReceiverBehavior(CyclicBehaviour):
def __init__(self, outer_ref):
super().__init__()
... | 2.296875 | 2 |
rtmp/Message.py | hirokikana/rtmp-client | 2 | 52372 | <gh_stars>1-10
#-*- coding: utf-8 -*-
import random
import time
import struct
class AMF0():
def __init__(self, message_type, message):
self.type_mapping = {
'string' : 2,
'number' : 0,
'object' : 3
}
self.message_type = message_type
self.message =... | 2.5625 | 3 |
catpy/xl/master_sheet.py | svortega/catpy | 0 | 52373 | # Copyright (c) 2021 CatPy
#
# Python stdlib imports
from typing import NamedTuple
#
# package imports
#import xlwings as xw
#from openpyxl import load_workbook
#
#
class RiserData(NamedTuple):
"""Riser data"""
name:str
length_upper:float
length_lower:float
unit_weight:float
diam... | 2.46875 | 2 |
CA.py | schroedtert/dynamic-waiting | 1 | 52374 | <filename>CA.py
from numpy.random import choice
from floorfield import *
from plotting import *
from IO import save_floor_field
class CA:
""" Simulator for waiting pedestrians with a CA.
:param static_ff: The underlying static floor field for all pedestrians
:param simulation_parameters: The used simula... | 3 | 3 |
predict_main.py | kashifcap/image_captioning | 0 | 52375 | <reponame>kashifcap/image_captioning
# %%
# Importing generic python libraries
import string
import os
import math
import glob
import numpy as np
from numpy import array
import pandas as pd
import matplotlib.pyplot as plt
from time import time
# Importing libraries for image manipulation, deep-learning and pickling
f... | 2.359375 | 2 |
comet.py | eggfly/pycomet | 0 | 52376 | <reponame>eggfly/pycomet<gh_stars>0
#! /usr/bin/env python3
from conf import HOST
import urllib.request
import time
URL_ASYNC = HOST + "async"
def get_loop_url(channel_id):
return "%s/loop/%s" % (HOST, channel_id)
def request(url):
t = time.time()
while True:
print("before open")
fp = u... | 2.546875 | 3 |
src/world.py | integeruser/networld | 1 | 52377 | import copy
import logging
import threading
import entities as e
import networking as n
import physics as p
logger = logging.getLogger(__name__)
lock = threading.RLock()
class World:
ADD = 0x1
DELETE = 0x2
DIFF = 0x3
@staticmethod
def dummy():
return World()
@staticmethod
def ... | 2.65625 | 3 |
Interface/Widgets/PlayerCharacterInventoryTreeWidget.py | Snackhole/PyFifth | 0 | 52378 | from decimal import Decimal
from PyQt5 import QtCore
from PyQt5.QtWidgets import QTreeWidget, QTreeWidgetItem, QHeaderView
class PlayerCharacterInventoryTreeWidget(QTreeWidget):
def __init__(self, CharacterWindow):
super().__init__()
# Store Parameters
self.CharacterWindow = CharacterWin... | 2.734375 | 3 |
api/tests/helper_dbtestdata.py | Fitperf/fitperf-api | 0 | 52379 | #! /usr/bin/env python3
# coding: utf-8
from datetime import datetime
from django.contrib.auth.models import User
from ..models import Training, Exercise, MovementsPerExercise, Movement, MovementSettings, Equipment, MovementSettingsPerMovementsPerExercise
class TestDatabase:
@staticmethod
def create():
... | 2.1875 | 2 |
D2MT.pyw | DivineEnder/D2MT | 0 | 52380 | #Used to log errors to a text file
import sys
sys.stderr = open("errlog.txt", "w")
try:
#Imports several custom functions in different files
from authorization import get_service
from matches import clear_duplicate_events
from matches import get_GosuGamer_matches
from matches import add_events
... | 2.65625 | 3 |
blogger_cli/converter/md_to_html.py | Himanshu-singhal-creator/blogger-cli | 427 | 52381 | import os
from shutil import SameFileError, copyfile
from urllib.request import Request, urlopen
import markdown
from bs4 import BeautifulSoup as BS
from blogger_cli.converter.extractor import (
extract_and_write_static,
extract_main_and_meta_from_md,
get_summary_limit,
extract_topic,
replace_ext,... | 2.53125 | 3 |
Using Python to Access Web Data/Problem 2_Using urllib.py | Karoline0097/University-of-Michigan-Python-for-Everybody | 0 | 52382 | <reponame>Karoline0097/University-of-Michigan-Python-for-Everybody<gh_stars>0
## Problem: Using the urllib library
import urllib.request, urllib.parse, urllib.error
# treat data from web page http://data.pr4e.org/romeo.txt like file
file_handle = urllib.request.urlopen('http://data.pr4e.org/romeo.txt')
# create word ... | 2.984375 | 3 |
apps/gridportal/base/Grid/.macros/wiki/eventgauge/1_eventgauge.py | Jumpscale/jumpscale_portal8 | 0 | 52383 | import datetime
import time
def main(j, args, params, tags, tasklet):
doc = args.doc
id = args.getTag('id')
width = args.getTag('width')
height = args.getTag('height')
result = "{{jgauge width:%(width)s id:%(id)s height:%(height)s val:%(last24h)s start:0 end:%(total)s}}"
now = datetime.datetime... | 2.625 | 3 |
accounts/tests/tests_signup.py | oratosquilla-oratoria/django-blog | 0 | 52384 | from django.contrib.auth.models import User
from django.test import TestCase
from django.urls import resolve, reverse
from ..forms import SignUpForm
from ..views import SignUpView
class SignUpFormTest(TestCase):
def test_form_has_fields(self):
"""Tests if the form contains all the necessary fields"""
... | 2.734375 | 3 |
jqfpy/loading/rec.py | podhmo/jqfpy | 13 | 52385 | def consume_rec(xs, fn, n=0):
if n <= 0:
fn(xs)
else:
for x in xs:
consume_rec(x, fn, n=n - 1)
| 2.859375 | 3 |
ntc_rosetta/yang/__init__.py | steinzi/ntc-rosetta | 95 | 52386 | <filename>ntc_rosetta/yang/__init__.py
import pathlib
from yangson.datamodel import DataModel
_DATAMODELS = {"openconfig": None, "ntc": None}
BASEPATH = pathlib.Path(__file__).parent
OPENCONFIG_LIB = f"{BASEPATH}/openconfig.json"
OPENCONFIG_PATH = [
BASEPATH.joinpath("YangModels/standard/ietf/RFC"),
BASEPATH... | 2.1875 | 2 |
omniglot/omniglot_train_few_shot.py | achbogga/LearningToCompare_FSL | 0 | 52387 | <gh_stars>0
#-------------------------------------
# Project: Learning to Compare: Relation Network for Few-Shot Learning
# Date: 2017.9.21
# Author: <NAME>
# All Rights Reserved
#-------------------------------------
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variab... | 2.15625 | 2 |
predix/admin/eventhub.py | BLaurent/predixpy | 28 | 52388 | <gh_stars>10-100
import os
import predix.config
import predix.security.uaa
import predix.admin.service
import predix.data.eventhub
class EventHub(object):
"""
Event Hub is a publisher/subscriber framework for getting information in, out and around the predix cloud
"""
def __init__(self, plan_name=Non... | 2.4375 | 2 |
the_scraper/spiders/test.py | emaribeyodn/the-scraper | 0 | 52389 | <gh_stars>0
from scrapy.spiders import Spider
from the_scraper.items import TrainingSetItem
class TrainingSetSpider(Spider):
name = "trset"
allowed_domains = ["senego.com"]
start_urls = ["https://www.senego.com/"]
custom_settings = {"CLOSESPIDER_PAGECOUNT": 120}
def parse(self, response):
... | 2.890625 | 3 |
property.py | benjamins5335/St-Andrews-Property-Monitor | 0 | 52390 | import threading
import fb
import json
import time
import requests
from bs4 import BeautifulSoup as bs
webhook = "https://discordapp.com/api/webhooks/<KEY>"
# bradburne (website)
# alba (fb)
# inchdairnie (email subscription)
# delmor (fb)
# premier let (email sub)
# braemore
with open('config.json') as data:
da... | 2.5625 | 3 |
8. md_main.py | PuneethKouloorkar/SPC-Water-Model | 0 | 52391 | <reponame>PuneethKouloorkar/SPC-Water-Model
import numpy as np
from md_sim import *
import matplotlib.pyplot as plt
# notes on input file format : col 0 = molecule number, col 1 = mass, col 2= molecule number, col 3-5 = positions
def main():
<<<<<<< HEAD
if timestep % dump_frequency == 0:
total_energy, t... | 2.671875 | 3 |
remove_overlap.py | BD2KGenomics/falseTandemDupFinder | 1 | 52392 | #!/usr/bin/env python
"""
Remove overlap (+ extra if desired) from tandem duplications
around scaffold gaps.
"""
import sys
from argparse import ArgumentParser
from collections import defaultdict, namedtuple
from sonLib.bioio import fastaRead, fastaWrite
FalseDup = namedtuple('FalseDup', ['gapStart', 'gapEnd', 'dupSi... | 2.84375 | 3 |
check-tms.py | vikoivun/sensu-plugins-apicheck | 0 | 52393 | #!/usr/bin/env python
#
# check-tms
#
# DESCRIPTION:
# Plugin to test the old, but still used, TMS map tile API for basic
# functionality. Loads several tiles around the given centerpoint
# and verifies that they loaded OK.
#
# OUTPUT:
# plain text describing the abnormal condition encountered
#
# PLATFORMS:
... | 2.1875 | 2 |
3week/test_car_fuelling.py | gypsyx/algos-toolbox | 0 | 52394 | from car_fueling_3 import *
def test_compute_min_refills():
stops = [200, 375, 550, 750]
assert compute_min_refills(950, 400, stops) == 2
stops = [1, 2, 5, 9]
assert compute_min_refills(10, 3, stops) == -1
stops = [100, 150]
assert compute_min_refills(200, 250, stops) == 0
stops = [100, ... | 2.671875 | 3 |
tsundoku/kitsu/manager.py | fossabot/Tsundoku | 0 | 52395 | from __future__ import annotations
import aiohttp
import datetime
import logging
from typing import Optional
from quart import current_app as app
logger = logging.getLogger("tsundoku")
class KitsuManager:
API_URL = "https://kitsu.io/api/edge/anime"
HEADERS = {
"Accept": "application/vnd.api+json",
... | 2.5 | 2 |
rstextras/shellblock.py | avoceteditors/rstextras | 0 | 52396 | # Copyright (c) 2018, <NAME> <<EMAIL>>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and ... | 1.664063 | 2 |
story.py | jonodrew/story_generator_p | 0 | 52397 | from flask import Flask
from faker import Faker
from faker.providers import company, job, person, geo
app = Flask(__name__)
@app.route('/')
def story():
fake = Faker()
mystory = "<html><body><p>In a(n) " + fake.company()
mystory = mystory + " a young "
mystory = mystory + fake.language_name()
... | 3.015625 | 3 |
setup.py | ThinkingStudio/microsoftgraph-python | 0 | 52398 | import os
from setuptools import setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(name='ts-microsoftgraph-python',
version='0.2.2',
description='API wrapper for Microsoft Graph written in Python',
long_description=read('README.md'),
url='htt... | 1.695313 | 2 |
SWIM-Executables/Windows/pyinstaller-2.0 for windows/buildtests/import/relimp/relimp/relimp2.py | alexsigaras/SWIM | 47 | 52399 |
from __future__ import absolute_import
name = 'relimp.relimp.relimp2'
from . import relimp3
assert relimp3.name == 'relimp.relimp.relimp3'
from .. import relimp
assert relimp.name == 'relimp.relimp'
import relimp
assert relimp.name == 'relimp'
import relimp.relimp2
assert relimp.relimp2.name == 'relimp.relimp2'
... | 1.84375 | 2 |