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 |
|---|---|---|---|---|---|---|
OneTimePad.py | divyesh98/SOMeT | 0 | 52000 | <gh_stars>0
import sys
import os
import random
import onetimepad
class OneTimePad():
def __init__(self, string, stego):
self.text = string
self.key = ""
self.all_characters = ['Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P',
'A', 'S', 'D', 'F', 'G... | 3.21875 | 3 |
orion/core/airflow_utils/misctools.py | kstathou/orion | 1 | 52001 | <gh_stars>1-10
"""
A collection of miscellaneous tools.
"""
import configparser
import os
def get_config(file_name, header, path="core/config/"):
"""Get the configuration from a file in the luigi config path
directory, and convert the key-value pairs under the
config :code:`header` into a `dict`.
Par... | 2.78125 | 3 |
ESF.py | ppieczywek/SpecklePy | 3 | 52002 | <gh_stars>1-10
import numpy as np
import sys, traceback
import cv2
device_id = 0
def nothing(x):
pass
cv2.namedWindow('ESF_preview')
cv2.namedWindow('Trackbars')
cv2.createTrackbar('ACC_RATE','Trackbars',80,100,nothing)
cv2.createTrackbar('MIN_GRAY','Trackbars',10,255,nothing)
cv2.createTrackbar('MI... | 2.421875 | 2 |
productive/producer/models/agroindustrial_tools.py | tapiaw38/productive-app | 0 | 52003 | """ Production Agroindustrial Tools """
# Django
from django.db import models
class AgroindustrialTools(models.Model):
""" Modelo Herramientas del la
produccion Agroindustrial """
production_agroindustrial = models.ForeignKey(
"producer.ProductionAgroindustrial",
related_name="agroindus... | 2.171875 | 2 |
Modules/ExposureNotification/exposure_notification_exceptions.py | pvieito/Radar-STATS | 9 | 52004 | class NoKeysFoundException(Exception):
pass
| 1.039063 | 1 |
RWJson/jbn.py | yinliuchr/DC2_sunburst | 0 | 52005 | <filename>RWJson/jbn.py
import json
with open("jbn", 'r') as load_f:
ori = json.load(load_f)
# print(ori)
print
# print()
# print(len(ori))
# a = ori[0]
# print(a)
# print(type(a))
# print(len(a['children']))
# b = str(a['user']) +'__'+ str(a['id'])
# print(type(b))
def dfs(post):
res = {}
if post[... | 2.609375 | 3 |
config/gunicorn.py | Shaffron/qtpie | 0 | 52006 | <gh_stars>0
from os import (
cpu_count,
path
)
PROJECT_DIR = path.abspath(path.dirname(__name__))
proc_name = 'qtpie'
bind = f'unix:{PROJECT_DIR}/run/gunicorn.sock'
worker_class = 'gevent'
workers = cpu_count() * 2 + 1
errorlog = f'/var/log/{proc_name}/gunicorn.error.log'
accesslog = f'/var/log/{proc_name}/gu... | 1.867188 | 2 |
sdk/python/pulumi_aws/appautoscaling/policy.py | pulumi-bot/pulumi-aws | 0 | 52007 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import pulumi
import pulumi.runtime
class Policy(pulumi.CustomResource):
"""
Provides an Application AutoScaling Policy resour... | 1.78125 | 2 |
hello/home/views.py | pratikd2124/Online-Library | 0 | 52008 | from django.shortcuts import render, HttpResponse
from home.models import Contact, Library, category
from datetime import datetime
from django.contrib import messages
# Create your views here.
def index(request):
return render(request, "index.html")
#return HttpResponse("Home page")
def abou... | 2.28125 | 2 |
analysis/notebooks/helper/__init__.py | dpedrosac/DBSgait | 1 | 52009 | from helper import anova
from helper import util | 1.03125 | 1 |
isj_proj04.py | SnasiCze/ISJ | 0 | 52010 | #!/usr/bin/env python3
# Vrátí vstupní položku item, pokud tato může být prvkem množiny v Pythonu, v opačném případě frozenset(item)
#""" Pomocí kontroly datových typů se program větví na 2 části return item a retun frozenset(item) """
def can_be_a_set_member_or_frozenset(item):
""" Pomocí kontroly datových typů se... | 2.828125 | 3 |
src/interview/class_test.py | mketiku/python-tutorials | 1 | 52011 | class A(object):
def go(self):
print("go A go!")
def stop(self):
print("stop A stop!")
def pause(self):
raise Exception("Not Implemented")
class B(A):
def go(self):
super(B, self).go()
print("go B go!")
class C(A):
def go(self):
super(C, self).go()
... | 3.625 | 4 |
bookworm/books/serializers.py | Sm0k3s/bookworm | 0 | 52012 | <reponame>Sm0k3s/bookworm<filename>bookworm/books/serializers.py
from rest_framework import serializers
from django.contrib.auth.models import User
from .models import Book, BookCategory
class UserBookSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Book
fields = (
... | 2.171875 | 2 |
simple_downloader.py | ZubairLK/ka-static | 1 | 52013 | <gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This script basically downloads topictree from khan academy
# Then parses it and creates a temporary folder with files.
# Kept simple on purpose to just see how parsing the topic tree json works in python
import json
import pprint
import inspect
import os
i... | 3.65625 | 4 |
plenum/test/node_request/helper.py | andkononykhin/plenum | 1 | 52014 | import operator
from plenum.test.helper import sdk_send_batches_of_random_and_check
from plenum.test.node_catchup.helper import ensure_all_nodes_have_same_data
def nodes_by_rank(txnPoolNodeSet):
return [t[1] for t in sorted([(node.rank, node)
for node in txnPoolNodeSet],
... | 2.25 | 2 |
src/squad_extract.py | siagholami/zero-shot-open-book-qa | 0 | 52015 | <reponame>siagholami/zero-shot-open-book-qa<filename>src/squad_extract.py
# coding=utf-8
# Copyright 2021 - <NAME>
from utils import *
# squad: https://rajpurkar.github.io/SQuAD-explorer/
logger = gconfig.logger
def squad_json_to_dataframe_train(input_file_path, record_path=['data', 'paragraphs', 'qas', 'answers']... | 2.796875 | 3 |
jython/sixpeaks.py | theturpinator/randomized-optimization-ABAGAIL | 0 | 52016 | import sys
import os
import time
import opt.example.SixPeaksEvaluationFunction as SixPeaksEvaluationFunction
import dist.DiscreteUniformDistribution as DiscreteUniformDistribution
import opt.DiscreteChangeOneNeighbor as DiscreteChangeOneNeighbor
import opt.ga.DiscreteChangeOneMutation as DiscreteChangeOneMutation
impo... | 2.09375 | 2 |
codewof/programming/content/en/full-name/solution.py | taskmaker1/codewof | 3 | 52017 | <reponame>taskmaker1/codewof
def full_name(first_name, last_name):
return first_name + " " + last_name
| 1.703125 | 2 |
granite/generator/md_wrapper.py | codacy-badger/granite | 0 | 52018 | <filename>granite/generator/md_wrapper.py
# External includes
# OS module provides functions for interacting with the operating system
import os
import markdown_generator as mg
from typing import Optional
# Project includes
from granite.generator.output_file_wrapper import OutputFileWrapper
class MarkDownFileWrapper(... | 2.9375 | 3 |
js/__init__.py | DanielJDufour/run-js | 7 | 52019 | import json
import os
import random
import re
import subprocess
import sys
from types import ModuleType
DEBUG_RUN_JS = os.getenv("DEBUG_RUN_JS", False) in [
"TRUE",
"true",
"True",
"T",
"t",
"1",
]
DIR_PATH = os.path.dirname(os.path.realpath(__file__))
CWD = os.getcwd()
class NodeFunction:
... | 2.234375 | 2 |
aulas Zero/IZ Aulas Python.py | haller218/PythonZero | 0 | 52020 | <reponame>haller218/PythonZero<filename>aulas Zero/IZ Aulas Python.py
"""
aula 52
SEE 44
"""
# python ide console online
# https://console.python.org/python-dot-org-console/
# https://github.com/luizdefranca/Curso-Python-IgnoranciaZero
# https://hub.mybinder.org
class Helpers:
def inputIntData ( data = "" ):
... | 3.234375 | 3 |
scripts/process_evidence_SR.py | hollenstein/sourcecode_cdc55 | 0 | 52021 | import os
import max_quant as MQ
# Process the MaxQuant results of the stress response and stress response Hog1
# inhibition experiments
if __name__ == '__main__':
root = '../'
table_dir = os.path.join(root, 'tables')
fasta_path = os.path.join(root, 'yeast_cont_20140324.fasta')
mq_txt_folder = 'MQ_t... | 2.046875 | 2 |
atmcraft/application.py | zzzeek/pycon2014_atmcraft | 0 | 52022 | from pyramid.config import Configurator
from pyramid.events import NewRequest, subscriber
from .model.meta import setup_app, Session
from .util import dumps
from pyramid.renderers import JSON
@subscriber(NewRequest)
def cleanup_sess(event):
"""Listen for new requests and assign a cleanup handler to each."""
d... | 2.1875 | 2 |
src/pyams_security_views/skin/login.py | Py-AMS/pyams-security-views | 0 | 52023 | #
# Copyright (c) 2015-2020 <NAME> <tflorac AT ulthar.net>
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE... | 1.453125 | 1 |
python_examples/scipy_352_ex1.py | ebressert/ScipyNumpy_book_examples | 31 | 52024 | import numpy as np
from scipy.spatial.distance import pdist, squareform
import scipy.cluster.hierarchy as hy
import matplotlib.pyplot as plt
# Creating a cluster of clusters function
def clusters(number=20, cnumber=5, csize=10):
# Note that the way the clusters are positioned is Gaussian randomness.
rnum = np... | 3.046875 | 3 |
sample/main.py | mariciucioan/archive-cracker | 1 | 52025 | import pyzipper
import terminal
from sys import argv
from os import remove
from pyzipper import is_zipfile
if __name__ == "__main__":
argv_count = len(argv)
if argv_count < 3:
terminal.how_to()
else:
my_file = argv[1]
if is_zipfile(my_file):
# noinspection PyBroadExcep... | 3.21875 | 3 |
backend/swpp/tests.py | 2019-swpp-8/swpp | 7 | 52026 | from django.test import TestCase
from django.contrib.auth import get_user_model
from rest_framework.test import APITestCase, APITransactionTestCase
from swpp.apps import SwppConfig
from datetime import datetime, timezone, timedelta
from rest_framework import serializers, status
from swpp.serializers import *
from djang... | 2.25 | 2 |
unifuncnet/Fetchers/Compound_Fetchers/Compound_Fetcher_Rhea.py | PedroMTQ/UniFuncNet | 4 | 52027 |
from unifuncnet.Fetchers.Compound_Fetchers.Compound_Fetcher import *
from unifuncnet.Utils.Rhea_SQLITE_Connector import Rhea_SQLITE_Connector
class Compound_Fetcher_Rhea(Compound_Fetcher,Rhea_SQLITE_Connector):
def __init__(self,compound_id,memory_storage=None):
Compound_Fetcher.__init__( self, compound_... | 2.390625 | 2 |
tools/scripts/sdoget.py | helio-hfc/SDOSS | 0 | 52028 | <reponame>helio-hfc/SDOSS
#!/usr/bin/env python
""" Routines to access a netDRMS system via HTTP and CGI and to fetch
and read data.
These can be used on any Internet connected machine, and fetch data
from a netDRMS site. You must have Python and optionally pyfits to
read the FITS files.
The default is to use the RO... | 2.9375 | 3 |
xc_fasm/xc_fasm.py | chipsalliance/f4pga-xc-fasm | 0 | 52029 | <reponame>chipsalliance/f4pga-xc-fasm
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2017-2022 F4PGA Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.a... | 2.15625 | 2 |
curriculum/07_game_02_circle_clash_2_DAYS/07_game_02_circle_clash_day_1/07_02_02_circle_clash_advanced.py | google/teknowledge | 31 | 52030 | from tkinter import *
# the game data for the initial game state
def init():
data.playerX = 250
data.playerY = 550
data.circleX = 250
data.circleY = 0
data.gameOver = False
# events updating the game data
def keyPressed(event):
if event.keysym == "Right" and data.playerX < 550:... | 4 | 4 |
tests/calculate_with_alfas_test.py | parvex/residual-continual-learning-benchmark | 0 | 52031 | import unittest
import torch
class TensorMultiplying(unittest.TestCase):
def test_tensor_multiplying_last_layer(self):
out = torch.tensor(
[[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 9.0]], [[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 9.0]],
[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], ... | 2.734375 | 3 |
src/modules/antimat/matshowtime.py | slimsevernake/osbb-bot | 9 | 52032 | import time
from random import randint
from threading import Lock
from typing import List, Optional, Tuple
import telegram
from src.config import CONFIG
from src.modules.antimat.antimat import Antimat
from src.utils.cache import pure_cache, TWO_YEARS, cache, MONTH
from src.utils.callback_helpers import get_callback_d... | 2.09375 | 2 |
902.numbers-at-most-n-given-digit-set.py | viewv/leetcode | 2 | 52033 | <gh_stars>1-10
#
# @lc app=leetcode id=902 lang=python3
#
# [902] Numbers At Most N Given Digit Set
#
# @lc code=start
class Solution:
def atMostNGivenDigitSet(self, D: List[str], N: int) -> int:
s = str(N)
n = len(s)
ans = sum(len(D) ** i for i in range(1, n))
for i, c in enumera... | 2.90625 | 3 |
frappe-bench/apps/erpnext/erpnext/accounts/doctype/payment_terms_template/test_payment_terms_template.py | Semicheche/foa_frappe_docker | 1 | 52034 | <reponame>Semicheche/foa_frappe_docker
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
import unittest
import frappe
class TestPaymentTermsTemplate(unittest.TestCase):
def tearDown(self):
frappe.delete_doc('Paym... | 2.03125 | 2 |
Lists/Join.py | obareau/python_travaux_pratiques | 1 | 52035 | <filename>Lists/Join.py
fields = ["one", "two", "three", "four", "five", "six"]
together = ":".join(fields)
print(together) # one:two:three:four:five:six
together = ':'.join(fields)
print(together) # one:two and three:four:five:six
mixed = ' -=<> '.join(fields)
print(mixed) # one -=<> two and three -=<> four -=<> fi... | 3.890625 | 4 |
tests/fixtures/envs/dummy/dummy_discrete_pixel_env.py | fangqyi/garage | 1 | 52036 | from unittest import mock
import gym
import numpy as np
from tests.fixtures.envs.dummy import DummyEnv
class DummyDiscretePixelEnv(DummyEnv):
"""
A dummy discrete pixel environment.
It follows Atari game convention, where actions are 'NOOP', 'FIRE', ...
It also contains self.unwrapped.... | 3.515625 | 4 |
trpg/registration/utility.py | jffifa/trpg | 2 | 52037 | from django.conf import settings
def decrypt(text):
half_len = len(text)//2
return text[half_len:]
| 1.53125 | 2 |
test_extractor.py | luaroncrew/university_agenda_to_apple_calendar | 1 | 52038 | from openpyxl import load_workbook
from extractor import read_agenda
# setting up testing files
wb1 = load_workbook('test_example_1.xlsx', data_only=True)
worksheet_1 = wb1.worksheets[0]
wb2 = load_workbook('test_example_2.xlsx', data_only=True)
worksheet_2 = wb2.worksheets[0]
wb3 = load_workbook('test_example_3.x... | 2.4375 | 2 |
username_books_score.py | ru4488/Book-bot | 0 | 52039 | <reponame>ru4488/Book-bot
import requests
import random
import redis
import time
import json
from fake_useragent import UserAgent
from bs4 import BeautifulSoup
from ratelimit import *
from fake_useragent import UserAgent
from bs4 import BeautifulSoup
from ratelimit import *
def last_page(pages):
soup = Bea... | 2.8125 | 3 |
gpu_kmer_counter/__init__.py | AMR-Hackathon-2021/gpu_kmer_counter | 0 | 52040 | # vim: set fileencoding=<utf-8> :
'''Counting k-mers'''
__version__ = '0.1.0'
| 0.957031 | 1 |
model.py | kdz/pystemm | 0 | 52041 | <reponame>kdz/pystemm<filename>model.py<gh_stars>0
## The Model class is the main class used to build actual PySTEMM models
## It traverses concept types and instances, analyzes, and generates visualizations
## It's main public methods are addClasses, addInstances, and showXYZ
import appscript
K = appscript.k
import ... | 2.53125 | 3 |
theory/8th_sprint/telegram.py | abi83/YaPractice | 3 | 52042 | <gh_stars>1-10
import telegram
def send_message(message, bot):
return bot.send_message(chat_id=CHAT_ID, text=message)
CHAT_ID = '32989550' # добавить chat_id
TELEGRAM_TOKEN = '<KEY>' # добавить токен
bot = telegram.Bot(token=TELEGRAM_TOKEN) # проинициализируйте бота здесь
send_message('hello', bot)
| 2.359375 | 2 |
virfac/get_data.py | NCBI-Hackathons/Virulence_Factor_Characterization | 6 | 52043 | import os
import requests
import string
import xml.etree.ElementTree as xml
from os.path import join as j
from time import sleep
from virfac import data_dir
bad_bugs = """Acinetobacter baumannii ACICU
Aeromonas hydrophila subsp. hydrophila ATCC 7966
Aeromonas salmonicida subsp. salmonicida A449
Aeromonas hydrophila... | 1.796875 | 2 |
simdeblur/utils/registry.py | ljzycmd/SimDeblur | 190 | 52044 | <reponame>ljzycmd/SimDeblur
# Registry Class
# CMD
# Refer this in Detectron2
class Registry:
def __init__(self, name):
self._name = name
self._obj_map = {}
def _do_register(self, name, obj):
assert (name not in self._obj_map), "The object named: {} was already registered in {} re... | 2.84375 | 3 |
cache_fallback/cache.py | gelo-zhukov/django-cache-fallback | 9 | 52045 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
import django
from django.core import signals
from django.core.cache.backends.base import BaseCache
logging.basicConfig()
logger = logging.getLogger(__name__)
def get_cache(backend, **kwargs):
from django.core import cache as dj_cach... | 2.03125 | 2 |
fonty/commands/list.py | jamesssooi/font-cli | 12 | 52046 | <reponame>jamesssooi/font-cli<gh_stars>10-100
'''fonty.commands.list.py: Command-line interface to list user installed fonts.'''
import sys
import timeit
from functools import reduce
from itertools import zip_longest
import click
from ansiwrap import ansilen
from termcolor import colored
from fonty.models.manifest imp... | 2.640625 | 3 |
example/vm-flow.py | cloudmesh/cloudmesh-flow | 1 | 52047 | <reponame>cloudmesh/cloudmesh-flow
from cloudmesh.compute.aws import Provider as AWSProvider
from cloudmesh.compute.azure import AzProvider
from cloudmesh.flow.Flow import Flow
class MyFlow(Flow):
def spawn_aws(self):
pass
def spawn_azure(self):
pass
def ping_aws(self):
pass
... | 1.96875 | 2 |
reefledge/_filesystem_utils.py | Reefledge/reefledge | 1 | 52048 | <filename>reefledge/_filesystem_utils.py
from typing import Final, List, Callable
import sys
import shutil
import os
import stat
import subprocess
import warnings
from zipfile import ZipFile
ON_LINUX: Final[bool] = sys.platform.startswith('linux')
ON_WINDOWS: Final[bool] = sys.platform.startswith('win')
... | 2.453125 | 2 |
perfrunner/workloads/ycsb.py | bochun/perfrunner | 18 | 52049 | from perfrunner.helpers.local import restart_memcached, run_ycsb
from perfrunner.settings import PhaseSettings, TargetSettings
def ycsb_data_load(workload_settings: PhaseSettings,
target: TargetSettings,
timer: int,
instance: int):
soe_params = None
if ... | 1.71875 | 2 |
maskrcnn_benchmark/modeling/backbone/pan.py | Yuliang-Liu/bezier_curve_text_spotting | 423 | 52050 | <reponame>Yuliang-Liu/bezier_curve_text_spotting
import torch.nn as nn
import torch.nn.functional as F
class FPA(nn.Module):
def __init__(self, channels=2048):
"""
Feature Pyramid Attention
:type channels: int
"""
super(FPA, self).__init__()
channels_mid = int(chann... | 2.171875 | 2 |
algorithms/python/344.py | scream7/leetcode | 0 | 52051 | class Solution(object):
def reverseString(self, s):
"""
:type s: str
:rtype: str
"""
res = []
for i in range(len(s)-1,-1,-1):
res.append(s[i])
return ''.join(res)
| 3.46875 | 3 |
UnitTests/Commands/test_remove_command.py | pinventado/Tuffix-2 | 0 | 52052 | <filename>UnitTests/Commands/test_remove_command.py
from Tuffix.Commands import RemoveCommand, AbstractCommand
from Tuffix.Configuration import DEFAULT_BUILD_CONFIG
import unittest
class AddCommandTest(unittest.TestCase):
# NOTE: this test has been done in Commands/test_add_remove_helper.py
def test_init(sel... | 2.5 | 2 |
hubcheck/pageobjects/po_supportneedhelp.py | codedsk/hubcheck | 1 | 52053 | from hubcheck.pageobjects.po_generic_page import GenericPage
class SupportNeedHelpPage(GenericPage):
"""Support Need Help page object"""
def __init__(self,browser,catalog):
super(SupportNeedHelpPage,self).__init__(browser,catalog)
def open(self):
return self.needhelplink.click()
de... | 2.078125 | 2 |
dlrm/nn/mlps.py | henryqin1997/Adalars | 1 | 52054 | <reponame>henryqin1997/Adalars<gh_stars>1-10
# Copyright (c) 2021 NVIDIA CORPORATION. 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/lice... | 2.046875 | 2 |
liquer/pool.py | orest-d/liquer | 3 | 52055 | <filename>liquer/pool.py
import multiprocessing as mp
from multiprocessing.managers import BaseManager
from os import getpid
from time import sleep
from liquer.cache import set_cache, CacheProxy, NoCache
from liquer import *
class PoolManager(BaseManager):
pass
PoolManager.register("CacheProxy", CacheProxy)
_p... | 2.921875 | 3 |
beam_search.py | kouyt5/lightning-asr | 2 | 52056 | import torch
import numpy as np
from ctc_decoders import Scorer, ctc_beam_search_decoder_batch
"""
# 安装语言模型
sudo apt-get install build-essential libboost-all-dev cmake zlib1g-dev libbz2-dev liblzma-dev
git clone https://github.com/NVIDIA/OpenSeq2Seq -b ctc-decoders
mv OpenSeq2Seq/decoders .
rm -rf OpenSeq2Seq
cd decod... | 2.234375 | 2 |
query_stack.py | mccormickmichael/laurel | 1 | 52057 | <gh_stars>1-10
# Query a CloudFormation stack.
# Returns:
# - Build Parameters - the parameters sent to the TemplateBuilder when generating the template
# - Stack Parameters - the parameters sent to CF during stack create or update time.
import argparse
import arguments
import logconfig
import session
from scaffold.c... | 2.359375 | 2 |
tests/libs/test_login.py | BiznetGIO/neo-cli | 10 | 52058 | import pytest
import os
import toml
from tempfile import gettempdir
import neo.libs.login
from neo.libs import login
class TestLogin:
def test_check_env(self, fs):
home = os.path.expanduser("~")
fs.create_file(os.path.join(home, ".neo", "config.toml"))
assert login.check_env()
def fa... | 2.09375 | 2 |
src/service_broker/ssh_communication.py | MehmedGIT/OPERANDI_TestRepo | 8 | 52059 | import os
from SSHLibrary import SSHLibrary
from constants import (
HPC_IP,
HPC_USERNAME,
HPC_KEY_PATH,
HPC_HOME_PATH,
)
# The Service broker will use the SSHCommunication class
# to communicate with the HPC environment
# This is just a dummy implementation
# TODO: Improve the code and implement app... | 2.59375 | 3 |
nacelle/core/utils/encoder.py | paddycarey/nacelle | 0 | 52060 | <gh_stars>0
# stdlib imports
import datetime
import json
# third-party imports
from google.appengine.api import datastore_types
from google.appengine.ext import ndb
class ModelEncoder(json.JSONEncoder):
"""
Custom JSON encoder allowing easy encoding
of appengine ndb entities/queries to JSON.
"""
... | 2.46875 | 2 |
04_bst/Minimum_Absolute_Difference_in_BST.py | llv22/pyalgorithm | 0 | 52061 | <reponame>llv22/pyalgorithm
# ---
# jupyter:
# jupytext:
# formats: ipynb,py:light
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.3'
# jupytext_version: 0.8.2
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ... | 2.953125 | 3 |
DUCTF/crypto/babyrsa/solve.py | UnknownAbyss/CTF-Write-ups | 73 | 52062 | <filename>DUCTF/crypto/babyrsa/solve.py
import math
from Crypto.Util.number import inverse
e = 0x10001
n = 1957420128605912371522163487708522315597262945102057257562624645871519919295008214318390097013384035900792258451690040515492825315640402882041045294672967093037402202573003680635807532542079386635898671944478503... | 2.875 | 3 |
MonopolyDeluxe/MonopolyDeluxe.py | mrajweir/Code | 0 | 52063 | import random
from PIL import Image
def roll_dice():
return random.randint(1, 6)
def potential_moves():
duplicated_moves = []
for i in range(1, 7):
for j in range(1, 7):
duplicated_moves.append(i*j)
valid_moves = sorted(set(duplicated_moves))
return valid_moves
if __name__ ... | 3.796875 | 4 |
recipes/Python/577069_Access_grep_from_python/recipe-577069.py | tdiprima/code | 2,023 | 52064 | <gh_stars>1000+
import subprocess
def grep(filename, arg):
process = subprocess.Popen(['grep', '-n', arg, filename], stdout=subprocess.PIPE)
stdout, stderr = process.communicate()
return stdout, stderr
| 2.234375 | 2 |
setup.py | noralsydmp/icetea | 6 | 52065 | # pylint: disable=no-name-in-module,import-error
"""
Copyright 2017-2018 ARM Limited
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 ... | 1.757813 | 2 |
tests/middlewares/test_default_headers.py | niwinz/anillo | 14 | 52066 | # -*- coding: utf-8 -*-
"""
tests.middlwares.test_session
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tests session middleware
:copyright: (c) 2015 by <NAME>.
:license: BSD, see LICENSE for more details.
"""
from anillo.middlewares.default_headers import wrap_default_headers
from anillo.http.request import Req... | 2.28125 | 2 |
PyFunceble/storage_facility.py | Centaurioun/PyFunceble | 213 | 52067 | <filename>PyFunceble/storage_facility.py
"""
The tool to check the availability or syntax of domain, IP or URL.
::
██████╗ ██╗ ██╗███████╗██╗ ██╗███╗ ██╗ ██████╗███████╗██████╗ ██╗ ███████╗
██╔══██╗╚██╗ ██╔╝██╔════╝██║ ██║████╗ ██║██╔════╝██╔════╝██╔══██╗██║ ██╔════╝
██████╔╝ ╚████╔╝ ███... | 2.09375 | 2 |
ores/ores.py | elukey/ores | 69 | 52068 | <filename>ores/ores.py
"""
This script provides access to a set of utilities for ORES
* precached -- Starts a daemon that requests scores for revisions as they happen
* score_revisions -- Scores a set of revisions using an ORES API
* stress_test -- Scores a large set of revisions at a configurable rate
* test_api -- R... | 2.65625 | 3 |
assignment7.2.py | RakibRyanRemon1/py4e | 0 | 52069 | <reponame>RakibRyanRemon1/py4e<filename>assignment7.2.py
# Use the file name mbox-short.txt as the file name
file_name = input("Enter file name: ")
fh = open(file_name)
count = 0
total = 0
for line in fh:
if not line.startswith("X-DSPAM-Confidence:"):
continue
pos = line.find('0')
total += ... | 3.5 | 4 |
tests/__init__.py | Deltares/QINCM | 0 | 52070 | <reponame>Deltares/QINCM<filename>tests/__init__.py
"""Unit test package for qincm."""
| 1.109375 | 1 |
dashboard/quickstart/views.py | spkuehl/rpm-dash | 0 | 52071 | from .models import Signal
from rest_framework import viewsets
from dashboard.quickstart.serializers import SignalSerializer
from django.utils import timezone
class SignalViewSet(viewsets.ModelViewSet):
"""
API endpoint that allows Signal to be viewed or edited.
"""
queryset = Signal.objects.filter(
... | 2.046875 | 2 |
saver.py | zaouk/contractive_autoencoders | 8 | 52072 | <filename>saver.py
# MIT License
# Copyright (c) 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, mod... | 2.25 | 2 |
getmac.py | Risca/biffboot | 0 | 52073 | #!/usr/bin/env python
import pod
import sys, binascii
from StringIO import StringIO
def ConvertMac(dotted):
if dotted.find(":") == -1:
str = binascii.unhexlify(dotted)
else:
str = "".join([chr(eval("0x"+i)) for i in dotted.split(":")])
if len(str) != 6:
raise ValueError("Not a MAC address")
ret... | 3.03125 | 3 |
Smart calc/calc.py | df2204/training-folder | 0 | 52074 | print("hello")
o= input ("input operation ")
x= int(input ("x = "))
y= int(input ("y = "))
if o == "+":
print (x+y)
elif o == "-":
print (x-y)
elif o == "*" :
print (x*y)
elif o == "/" :
if y==0 :
print ("it's a simple calc, don't be too smart")
else :
print (x/y)
elif o == "//" :... | 4.21875 | 4 |
python-idioms/npi-tuple.py | sdlab-naist/Teddy-plus | 0 | 52075 | <filename>python-idioms/npi-tuple.py
def n48():
list_from_comma_separated_value_file = ['dog', 'Fido', 10]
animal = list_from_comma_separated_value_file[0]
name = list_from_comma_separated_value_file[1]
age = list_from_comma_separated_value_file[2]
def n49():
catherine_info = ['Catherine', 1960, 'A... | 3.375 | 3 |
main.py | abhinavk99/human-simulator | 0 | 52076 | <gh_stars>0
from markovwriter import TwitterWriter
import config
import itertools
import json
import tweepy
# Login to Twitter
auth = tweepy.OAuthHandler(config.consumer_key, config.consumer_secret)
auth.set_access_token(config.access_token, config.access_secret)
api = tweepy.API(auth)
# Create an empty Level 5 Mark... | 2.921875 | 3 |
Modified_data/TrickHLA/TrickHLAAttributeConfig.py | jiajlin/TrickHLA | 18 | 52077 | ##############################################################################
# PURPOSE:
# (This is a python class file used by the top level TrickHLA input
# file interface for specifying a federate object attribute.)
#
# REFERENCE:
# (Trick 17 documentation.)
#
# ASSUMPTIONS AND LIMITATIONS:
# ((Relies ... | 1.90625 | 2 |
Raspberry/client.py | baxtrax/QT-Remote-Control-Client_V2 | 1 | 52078 | import socket
import constants
import serial
import time
from datetime import date, datetime
import errno
import select
from socket import error as socket_error
print("======================================")
print("Setting up Serial between Raspberry Pi and Leonardo.")
ser = serial.Serial(constants.SERIAL_PORT, const... | 2.90625 | 3 |
sr/robot/vision.py | ghalliday/sr-turtle | 2 | 52079 | from collections import namedtuple
# From pyenv.git/pylib/sr/vision.py
MARKER_ARENA, MARKER_ROBOT, MARKER_PEDESTAL, MARKER_TOKEN = range(4)
marker_offsets = {
MARKER_ARENA: 0,
MARKER_ROBOT: 28,
MARKER_PEDESTAL: 32,
MARKER_TOKEN: 41
}
marker_sizes = {
MARKER_ARENA: 0.25 * (10.0/12),
MARKER_ROB... | 2.71875 | 3 |
mosaicer/extraction.py | seongahjo/Mosaicer | 54 | 52080 | <reponame>seongahjo/Mosaicer
import face_recognition
import sys
import cv2
import os
import argparse
from file_util import check_img
def extract(folder, file_name):
"""Extract faces from images
Args:
folder: folder
file_name : filename
"""
if not os.path.exists('result'):
os.m... | 3.203125 | 3 |
Algorithms_hard/0052. N-Queens II.py | VinceW0/Leetcode_Python_solutions | 4 | 52081 | '''
0052. N-Queens II
The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.
Given an integer n, return the number of distinct solutions to the n-queens puzzle.
Example:
Input: 4
Output: 2
Explanation: There are two distinct solutions to the 4-queens puz... | 3.8125 | 4 |
mediawiki_dump/utils.py | e1mo/mediawiki-dump | 0 | 52082 | """
Utility functions
"""
from datetime import datetime, timezone
def parse_date_string(date: str) -> datetime:
"""Converts date as string (e.g. "2004-05-25T02:19:28Z") to UNIX timestamp (uses UTC, always)
"""
# https://docs.python.org/3.6/library/datetime.html#strftime-strptime-behavior
# http://strf... | 3.8125 | 4 |
Utils/obfuscate.py | Xiloe/kino | 0 | 52083 | def obfuscate(utils_path, project_path):
import subprocess
print('Running obfuscator ...')
subprocess.run(f'{utils_path}/confuser/Confuser.CLI.exe {project_path} -n')
| 2.09375 | 2 |
modules/cameraCapture.py | TheRealDeVision/Police_Surveillance_Assistant | 0 | 52084 | <gh_stars>0
import cv2
import numpy as np
import time
cap = cv2.VideoCapture("http://192.168.43.102:4747/mjpegfeed")
while(True):
last_time = time.time()
ret , frame = cap.read()
# RGB -> Grey Conversion (Optional)
#gray_frame = cv2.cvtColor(frame , cv2.COLOR_BGR2GRAY)
cv2.imshow('Grey Self... | 2.625 | 3 |
leo/core/leoTest2.py | thomasbuttler/leo-editor | 1,550 | 52085 | # -*- coding: utf-8 -*-
#@+leo-ver=5-thin
#@+node:ekr.20201129023817.1: * @file leoTest2.py
#@@first
"""
Support for Leo's new unit tests, contained in leo/unittests/test_*.py.
Run these tests using unittest or pytest from the command line.
See g.run_unit_tests and g.run_coverage_tests.
This file also contains classe... | 1.960938 | 2 |
emergency_response.py | secretbetta/Jetbot | 0 | 52086 | '''
Created on Feb 15, 2020
@author: andre
'''
import houndify
import sys
CLIENT_ID = sys.argv[1]
CLIENT_KEY = sys.argv[2]
| 1.4375 | 1 |
backend/gunicorn.conf.py | WhitePrime/tabby-web | 91 | 52087 | <filename>backend/gunicorn.conf.py
wsgi_app = "tabby.wsgi:application"
workers = 4
preload_app = True
sendfile = True
max_requests = 1000
max_requests_jitter = 100
| 1.242188 | 1 |
irctest/scram/exceptions.py | FiskFan1999/ergochat_irctest | 16 | 52088 | <reponame>FiskFan1999/ergochat_irctest<filename>irctest/scram/exceptions.py
class ScramException(Exception):
pass
class BadChallengeException(ScramException):
pass
class ExtraChallengeException(ScramException):
pass
class ServerScramError(ScramException):
pass
class BadSuccessException(ScramExceptio... | 1.328125 | 1 |
bikeshed/t.py | saschanaz/bikeshed | 0 | 52089 | <gh_stars>0
# pylint: disable=unused-import
# Module for holding types, for easy importing into the rest of the codebase
from __future__ import annotations
import sys
from typing import (
Any,
DefaultDict,
Dict,
Iterable,
Iterator,
List,
Mapping,
Optional,
Sequence,
Set,
Tu... | 2.0625 | 2 |
setup.py | rako233/rako-pyads | 1 | 52090 | from setuptools import setup, find_packages
exec(open('counsyl_pyads/version.py').read())
setup(
name='counsyl-pyads',
version=__version__,
packages=find_packages(),
scripts=['bin/twincat_plc_info.py'],
include_package_data=True,
zip_safe=False,
author='<NAME>.',
author_email='<EMAIL>'... | 1.242188 | 1 |
hooqu/analyzers/mean.py | mfcabrera/hooqu | 17 | 52091 | <gh_stars>10-100
from dataclasses import dataclass
from typing import Callable, List, Optional
from hooqu.analyzers.analyzer import (AggDefinition, DoubledValuedState,
StandardScanShareableAnalyzer)
from hooqu.analyzers.preconditions import has_column, is_numeric
from hooqu.datafr... | 2.484375 | 2 |
pykg2vec/core/RotatE.py | kyzhouhzau/pykg2vec | 1 | 52092 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from pykg2vec.core.KGMeta import ModelMeta, InferenceMeta
class RotatE(ModelMeta, InferenceMeta):
""" `Rotate-Knowledge graph embeddi... | 3.015625 | 3 |
ISYHelper/Helpers/Maker.py | jimboca/isyhelper | 9 | 52093 | <filename>ISYHelper/Helpers/Maker.py
"""
IFTTT Maker Helper
"""
from .Helper import Helper
import json
class Maker(Helper):
def __init__(self,parent,hconfig):
self.required = ['token']
super(Maker, self).__init__(parent,hconfig)
def maker(self,path,data):
#super(Tester, self).setvar(... | 2.484375 | 2 |
tests/test_parallel.py | jimmysong/fabric | 1 | 52094 | from __future__ import with_statement
from fabric.api import run, parallel, env, hide
from utils import FabricTest, eq_
from server import server, RESPONSES
class TestParallel(FabricTest):
@server()
@parallel
def test_parallel(self):
"""
Want to do a simple call and respond
"""
... | 2.296875 | 2 |
apppics/tests.py | JKimani77/pics | 0 | 52095 | from django.test import TestCase
# Create your tests here.
from django.test import TestCase
from .models import Image,Location, Category
class ImageTestClass(TestCase):
'''
Test case for model image
'''
def setUp(self):
self.any_category = Category(name = 'FOOD')
self.any_location = Lo... | 2.796875 | 3 |
teamwork/teamwork.py | gtdelong/teamwork | 0 | 52096 | from datetime import datetime, date, timedelta
import pandas as pd
import networkx as nx
from itertools import combinations
import numpy as np
class TeamworkStudyRunner:
def __init__(self, notes, window_in_days, step_in_days):
notes.sort_values('date', inplace=True)
self.notes = notes
sel... | 2.484375 | 2 |
waifu2x/loss/clipped_weighted_huber_loss.py | FHPythonUtils/Waifu2x | 6 | 52097 | <gh_stars>1-10
from __future__ import annotations
import numpy
from chainer import cuda, function
from chainer.utils import type_check
class ClippedWeightedHuberLoss(function.Function):
def __init__(self, weight, delta: float = 0.1, clip: tuple[float, float] = (0.0, 1.0)):
self.weight = weight
self.delta = delt... | 2.078125 | 2 |
src/plone/z3cform/fieldsets/extensible.py | zopefoundation/plone.z3cform | 0 | 52098 | <reponame>zopefoundation/plone.z3cform
# -*- coding: utf-8 -*-
from plone.z3cform import MessageFactory as _
from plone.z3cform.fieldsets import utils
from plone.z3cform.fieldsets.interfaces import IExtensibleForm
from plone.z3cform.fieldsets.interfaces import IFormExtender
from z3c.form.group import GroupForm
from zop... | 1.664063 | 2 |
learn/bb/dictionary.py | mksy61/python | 1 | 52099 | sayilar = {"Bir": 1, "İki": 2, "Üç": 3, "Dört": 4, "Beş": 5}
sayilar["Altı"] = 6
sayilar[43] = "fds"
print(len(sayilar))
print()
for v in sayilar.values():
print(v)
| 3.734375 | 4 |