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 |
|---|---|---|---|---|---|---|
tabulate_deals.py | frostburn/puyotable | 0 | 12798751 | import argparse
import json
from multiprocessing import Pool
from puyotable.canonization import canonize_deals
def all_deals(num_deals, num_colors):
if not num_deals:
return [[]]
result = []
for c0 in range(num_colors):
for c1 in range(num_colors):
for deals in all_deals(num_d... | 2.578125 | 3 |
src/pbn_api/migrations/0026_auto_20210816_0815.py | iplweb/django-bpp | 1 | 12798752 | <reponame>iplweb/django-bpp<gh_stars>1-10
# Generated by Django 3.0.14 on 2021-08-16 06:17
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("pbn_api", "0025_auto_20210809_0149"),
]
operations = [
migrations.AlterUniqueTogether(
name="... | 1.382813 | 1 |
bin/dump_lpcnet.py | nkari82/LPCNet | 0 | 12798753 | <gh_stars>0
#!/usr/bin/python3
'''Copyright (c) 2017-2018 Mozilla
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 conditio... | 1.695313 | 2 |
straph/paths/meta_walks.py | busyweaver/Straph | 0 | 12798754 | import matplotlib.pyplot as plt
import numpy as np
import numpy.polynomial.polynomial as nppol
class Metawalk:
def __init__(self,
time_intervals=None,
nodes=None,
):
"""
A basic constructor for a ``Metwalks`` object
:param times : A list o... | 3.09375 | 3 |
src/comment/models.py | xistadi/BookStore | 0 | 12798755 | from django.db import models
from django.core.validators import MaxValueValidator, MinValueValidator
from django.db.models.signals import post_delete
from django.dispatch import receiver
from myauth import models as myauth_models
from products.models import Book
class CommentProducts(models.Model):
profile = mod... | 1.789063 | 2 |
examples/BioASQ/extra_modules/CoreMMR.py | paritoshgpt1/BOOM | 29 | 12798756 | <reponame>paritoshgpt1/BOOM
import glog as log
from boom.modules import Module
from multiprocessing import Pool
from .bioasq.coreMMR import CoreMMR as BioASQCoreMMR
def multi_process_helper(args):
questions, alpha = args
ranker = BioASQCoreMMR()
result = []
for question in questions:
if 'snippe... | 2.140625 | 2 |
app/__init__.py | jamescurtin/ham-dash | 0 | 12798757 | <filename>app/__init__.py
"""Main application."""
| 0.996094 | 1 |
main.py | Wajahat-Mirza/Linear_Algebra_Project | 1 | 12798758 | <reponame>Wajahat-Mirza/Linear_Algebra_Project
import sys
import time
from help_functions import *
from Inverse_mat import *
from Matrix_mutliplication import *
from linear_system import *
from LU_factorization import *
from determinant import *
def input_mat(num):
rows = input("Enter number of rows for Matrix {}: ... | 3.875 | 4 |
src/lib/twilio/request_validator.py | crucialwebstudio/unemployment-reminders | 0 | 12798759 | from urllib.parse import urlparse, urlunparse
from functools import wraps
from flask import abort, request, current_app
from lib.twilio import TwilioClient
def validate_twilio_request(f):
"""Validates that incoming requests genuinely originated from Twilio"""
# Adapted from https://www.twilio.com/docs/usage/... | 2.859375 | 3 |
rpicam/utils/telegram_poster.py | LokiLuciferase/rpicam | 0 | 12798760 | #!/usr/bin/env python3
import os
from typing import Union
from pathlib import Path
import requests
from rpicam.utils.logging_utils import get_logger
class TelegramPoster:
"""
Bare-bones class to post videos to a Telegram chat.
Uses per default credentials stored in environment.
"""
API_URL = '... | 2.578125 | 3 |
src/tracker/mtmct/wp/utils_for_mtmct.py | ToumaKazusa3/WP-MTMCT | 1 | 12798761 | <gh_stars>1-10
import json
import pickle
import numpy as np
import os
import errno
from geopy.distance import geodesic
from pathlib import Path
import glob
import cv2
def ham_to_dem(time):
'''
:param time: hour minute second
:return: second
'''
dam_time_list = []
if isinstance(t... | 2.40625 | 2 |
ci/check_copyright_block.py | VishnuPrem/multi_robot_restaurant | 7 | 12798762 | <filename>ci/check_copyright_block.py
#!/usr/bin/env python3
from datetime import datetime
import re
import sys
file_path = sys.argv[1]
n_lines = open(file_path, 'r').readlines()
email_address = open('.git/copyrightemail', 'r').readlines()[0].strip()
if not email_address in "\n".join(n_lines[:5]):
print("{}: Your ... | 2.765625 | 3 |
py/fingerboard.py | Takayoshi-Aoyagi/Jazz-Chords | 1 | 12798763 | # coding: UTF-8
from tone import Tone
class Fingerboard:
@classmethod
def getPos(cls):
_pos = {}
openTones = ["E", "B", "G", "D", "A", "E"]
tone = Tone()
for stringIndex, openTone in enumerate(openTones):
toneIndex = tone.getToneNumberByName(openTone)
a... | 2.8125 | 3 |
app/Account.py | dan-english/test3 | 1 | 12798764 | """Account Model."""
from masoniteorm.models import Model
class Account(Model):
"""Account Model."""
__fillable__ = ['email', 'access_token', 'scopes', 'type', 'valid', 'user_id', 'provider', 'nylas_account_id']
__auth__ = 'email'
| 2.453125 | 2 |
lib10x/lib10x.py | antonybholmes/lib10x | 0 | 12798765 | <filename>lib10x/lib10x.py
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 6 16:51:15 2018
@author: antony
"""
import matplotlib
# matplotlib.use('agg')
import matplotlib.pyplot as plt
import collections
import numpy as np
import scipy.sparse as sp_sparse
import tables
import pandas as pd
from sklearn.manifold import ... | 1.726563 | 2 |
tensormonk/loss/adversarial_loss.py | Tensor46/TensorMONK | 29 | 12798766 | <gh_stars>10-100
"""TensorMONK :: loss :: AdversarialLoss"""
__all__ = ["AdversarialLoss"]
import torch
import numpy as np
eps = np.finfo(float).eps
def g_minimax(d_of_fake: torch.Tensor, invert_labels: bool = False):
r"""Minimax loss for generator. (`"Generative Adversarial Nets"
<https://papers.nips.cc/pa... | 2.546875 | 3 |
autoarray/plot/fit_imaging_plotters.py | jonathanfrawley/PyAutoArray_copy | 0 | 12798767 | <filename>autoarray/plot/fit_imaging_plotters.py
from autoarray.plot import abstract_plotters
from autoarray.plot.mat_wrap import visuals as vis
from autoarray.plot.mat_wrap import include as inc
from autoarray.plot.mat_wrap import mat_plot as mp
from autoarray.fit import fit as f
from autoarray.structures.grids.t... | 2.4375 | 2 |
sensehat/__init__.py | myDevicesIoT/cayennee-plugin-sensehat | 3 | 12798768 | """
This module provides a class for interfacing with the Sense HAT add-on board for Raspberry Pi.
"""
import os
from multiprocessing.managers import RemoteError
from myDevices.utils.logger import error, exception, info
from sensehat.manager import connect_client
class SenseHAT():
"""Class for interacting with a... | 2.796875 | 3 |
support/cross/aio/gthread.py | pmp-p/python-wasm-plus | 3 | 12798769 | <filename>support/cross/aio/gthread.py
import aio
import inspect
# mark not started but no error
aio.error = None
aio.paused = False
aio.fd = {}
aio.pstab = {}
def _shutdown():
print(__file__, "_shutdown")
# https://docs.python.org/3/library/threading.html#threading.excepthook
# a green thread
# FIXME: fix w... | 2.375 | 2 |
base16_theme_switcher/__init__.py | piotr-rusin/base16-theme-switcher | 0 | 12798770 | <gh_stars>0
"""
======================
base16-theme-switcher
======================
Base16-theme-switcher is an extensible color theme configuration tool
for applications using colors provided in X resource database
(configured in ~/.Xresources file).
The application may be extended with support for different ways
of... | 1.007813 | 1 |
Examples/SimpleSNR-2015-10-07.py | scivision/isrutils | 1 | 12798771 | #!/usr/bin/env python
from isrutils.looper import simpleloop
# %% users param
P = {
"path": "~/data/2015-10-07/isr",
"beamid": 64157,
"acf": True,
"vlimacf": (18, 45),
"zlim_pl": [None, None],
"vlim_pl": [72, 90],
"flim_pl": [3.5, 5.5],
"odir": "out/2015-10-07",
"vlim": [25, 55],
... | 1.867188 | 2 |
turbotutorial/turbotutorial/urls.py | vitaliimelnychuk/django-hotwire-playground | 0 | 12798772 | """turbotutorial URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/4.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class... | 2.5 | 2 |
services/movies_etl/postgres_to_es/config.py | svvladimir-ru/ugc_sprint_1 | 0 | 12798773 | import os
# ETL
ETL_MODE = os.environ.get('ETL_MODE')
ETL_CHUNK_SIZE = int(os.environ.get('ETL_CHUNK_SIZE'))
ETL_SYNC_DELAY = int(os.environ.get('ETL_SYNC_DELAY'))
ETL_FILE_STATE = os.environ.get('ETL_FILE_STATE')
ETL_DEFAULT_DATE = os.environ.get('ETL_DEFAULT_DATE')
# Postgres
POSTGRES_NAME = os.environ.get('POSTGRE... | 1.773438 | 2 |
send_email.py | DGhambari/CompSys_Facial_Recognition_Assignment | 0 | 12798774 | <filename>send_email.py
import email, smtplib, ssl
from email import encoders
from email.mime.base import MIMEBase
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from dotenv import load_dotenv, find_dotenv
import os
from pathlib import Path
#load_dotenv(".env")
project_folder = o... | 3.03125 | 3 |
Artificial Intelligence/Goal Stack Planning/gsp.py | Harjiwan/Python | 17 | 12798775 | class GSP:
def __init__(self):
self.start = []
self.goal = []
self.stack = []
self.actions = ['Stack','UnStack','Pick','Put']
self.predicate = ['On','OnTable']
self.prereq = ['Clear','Holding','ArmEmpty']
def accept(self):
self.start = input("Enter Start ... | 3.140625 | 3 |
preprocess/TripleClassificationData.py | lualiu/GanforKGE | 0 | 12798776 | <gh_stars>0
import os
import numpy as np
import torch
from utils.readdata import read_dicts_from_file,read_triples_from_file,turn_triples_to_label_dict
class TripleClassificationData(object):
def __init__(self,data_path,train_data_name,valid_data_name,test_data_name,with_reverse=False):
self.entity_dict,se... | 2.578125 | 3 |
run.py | goonpug/goonpug-stats | 1 | 12798777 | #!/usr/bin/env python
from __future__ import absolute_import
from goonpug import app
def main():
app.run(debug=True)
if __name__ == '__main__':
main()
| 1.226563 | 1 |
swagger_client/models/get_universe_graphics_graphic_id_ok.py | rseichter/bootini-star | 0 | 12798778 | <filename>swagger_client/models/get_universe_graphics_graphic_id_ok.py
# coding: utf-8
"""
EVE Swagger Interface
An OpenAPI for EVE Online # noqa: E501
OpenAPI spec version: 0.8.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
impor... | 1.703125 | 2 |
setup.py | itamar-otonomo/traj-dist-py3 | 0 | 12798779 | from setuptools import setup, find_packages
from Cython.Distutils.extension import Extension
from Cython.Build import cythonize, build_ext
import numpy
import os
from glob import glob
"""
ext_modules = [Extension("traj_dist.cydist.basic_geographical", ["traj_dist/cydist/basic_geographical.pyx"]),
Extens... | 1.78125 | 2 |
ex034.py | olmirjunior/CursoemVideoPython-Exercicios-e-Aula | 0 | 12798780 | nome = str(input('Digite o nome do funcioário: '))
salario = float(input('Qual o salário do funcionário R$ '))
sal10 = (salario * 10 / 100)
sal15 = (salario * 15 / 100)
if (salario >= 1250) * (10 * 10 / 100):
print('O novo salário do funcionário(a) {} com 10% de aumento será de {}'.format(nome, sal10 + salario))
el... | 3.875 | 4 |
pyeccodes/defs/grib2/template_4_categorical_def.py | ecmwf/pyeccodes | 7 | 12798781 | import pyeccodes.accessors as _
def load(h):
h.add(_.Unsigned('numberOfCategories', 1))
with h.list('categories'):
for i in range(0, h.get_l('numberOfCategories')):
h.add(_.Codetable('categoryType', 1, "4.91.table", _.Get('masterDir'), _.Get('localDir')))
h.add(_.Unsigned('co... | 2.046875 | 2 |
genbank-fan/nwk_tree_parser.py | chnops/code | 2 | 12798782 | <filename>genbank-fan/nwk_tree_parser.py
import sys
from Bio import Phylo
names = {}
tree = Phylo.read(sys.argv[1], "newick")
for idx, clade in enumerate(tree.find_clades()):
if clade.name:
clade.name = '%d\t%s' % (idx, clade.name)
print clade.name
# else:
# clade.name = str(idx)
... | 2.9375 | 3 |
HomieMQTT.py | RdeLange/skill-homey | 0 | 12798783 | <gh_stars>0
import paho.mqtt.client as mqtt
import threading
import time
class HomieMQTT:
""" Class for controlling Homie Convention.
The Homie Convention follows the following format:
root/system name/device class (optional)/zone (optional)/device name/capability/command """
DEVICES = []
... | 2.578125 | 3 |
LeetCode/852 Peak Index in a Mountain Array.py | gesuwen/Algorithms | 0 | 12798784 | # Binary Search
# Let's call an array A a mountain if the following properties hold:
#
# A.length >= 3
# There exists some 0 < i < A.length - 1 such that A[0] < A[1] < ... A[i-1] < A[i] > A[i+1] > ... > A[A.length - 1]
# Given an array that is definitely a mountain, return any i such that A[0] < A[1] < ... A[i-1] < A[... | 3.765625 | 4 |
official/modules/example/example.py | jaklinger/nesta-toolbox | 0 | 12798785 | <reponame>jaklinger/nesta-toolbox<gh_stars>0
'''
example
This is an example of a python module. It contains all the required elements
for being promoted to nesta-toolbox.official.modules.
The specific example here simply demonstrates how to check the weather in London,
with the API key read from an configuration file... | 3.203125 | 3 |
src/controller/mode.py | iivvoo-abandoned/most | 0 | 12798786 | <filename>src/controller/mode.py
#!/usr/bin/python
# $Id: mode.py,v 1.3 2002/02/05 17:44:25 ivo Exp $
"""
Class to parse modes. The class is initialized with a modestring,
the result methods will provide the parsed plus/min modes and
parameters.
TODO: banlist support?
"""
""" Handle messages like:
... | 3.203125 | 3 |
src/inmediag/__init__.py | TechFitU/MDSOM | 0 | 12798787 | <filename>src/inmediag/__init__.py
default_app_config = 'inmediag.apps.MDSOMConfig' | 1.117188 | 1 |
misc/pytorch_toolkit/chest_xray_screening/chest_xray_screening/train.py | e-ddykim/training_extensions | 256 | 12798788 | <reponame>e-ddykim/training_extensions<filename>misc/pytorch_toolkit/chest_xray_screening/chest_xray_screening/train.py
import numpy as np
import time
import os
import argparse
import torch
from torch.backends import cudnn
from torch import optim
import torch.nn.functional as tfunc
from torch.utils.data import DataLoad... | 2.21875 | 2 |
NeuralStyleTransferSrc/overide_fun.py | vonlippmann/Deep-_Style_Transfer | 2 | 12798789 | <reponame>vonlippmann/Deep-_Style_Transfer
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import *
from PyQt5.QtGui import *
class self_QlineEdit(QtWidgets.QLineEdit):
clicked = pyqtSignal()
def __init__(self, parent=None):
super(self_QlineEdit, self).__init__(parent)
def event(... | 2.1875 | 2 |
tmp/test.py | AeneasHe/eth-brownie-enhance | 1 | 12798790 | <reponame>AeneasHe/eth-brownie-enhance<filename>tmp/test.py
import os
import shutil
raw_path = "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/eth_brownie-1.15.0-py3.9.egg/brownie/project/brownie_project"
install_path = "/Users/aeneas/.brownie/packages/brownie/[email protected]"
shuti... | 1.757813 | 2 |
cyberdb/extensions/nonce.py | Cyberbolt/CyberDB | 1 | 12798791 | <reponame>Cyberbolt/CyberDB<filename>cyberdb/extensions/nonce.py
import random
seed = '<KEY>'
def generate(num: int):
'''
Generate num random strings.
'''
text = ''
for i in range(num):
text += random.choice(seed)
return text
| 2.53125 | 3 |
publisher/conf.py | hongsups/scipy_proceedings | 1 | 12798792 | <filename>publisher/conf.py
import glob
import os
import io
excludes = ['vanderwalt', 'bibderwalt']
# status_file_root possible values: draft, conference, ready
status_file_base = 'draft'
status_file_name = ''.join([status_file_base, '.sty'])
work_dir = os.path.dirname(__file__)
papers_dir = os.path.join(work... | 1.90625 | 2 |
run/packet_manager.py | insidus341/Packet-Capture-Analyzer | 0 | 12798793 | <filename>run/packet_manager.py
class PacketManager:
def __init__(self):
self.packets = []
def add_packet(self, packet):
Packet(packet)
self.packets.append(packet)
def read_packet(self, number):
try:
packet = self.packets[number]
print(packet.number... | 3.203125 | 3 |
demo/site/index.html.py | leafcoder/litefs | 2 | 12798794 | def handler(self):
self.start_response(200)
return ['Hello World'] | 1.601563 | 2 |
pygama/dsp/_processors/time_point_thresh.py | iguinn/pygama | 13 | 12798795 | import numpy as np
from numba import guvectorize
from pygama.dsp.errors import DSPFatal
@guvectorize(["void(float32[:], float32, float32, float32, float32[:])",
"void(float64[:], float64, float64, float64, float64[:])"],
"(n),(),(),()->()", nopython=True, cache=True)
def time_point_thresh(w_... | 2.6875 | 3 |
Numbers/natural.py | rohanrajkamal/pythonexamples | 0 | 12798796 | input1=int(input("enter a number:"))
print("prints the range of natural numbers")
for i in range(1, input1+1):
print("%d" % (i))`` | 4.03125 | 4 |
aiocometd/_metadata.py | robertmrk/aiocometd | 14 | 12798797 | <gh_stars>10-100
"""Package metadata"""
TITLE = "aiocometd"
DESCRIPTION = "CometD client for asyncio"
KEYWORDS = "asyncio aiohttp comet cometd bayeux push streaming"
URL = "https://github.com/robertmrk/aiocometd"
PROJECT_URLS = {
"CI": "https://travis-ci.org/robertmrk/aiocometd",
"Coverage": "https://coveralls.... | 0.996094 | 1 |
handler/mlsklearn/model_selection/model_selection_handler.py | daliuzhen1/BIServiceForRest | 3 | 12798798 | import tornado
import json
import uuid
import pandas as pd
from handler.mlsklearn.util import regqeust_arg_to_sklearn_arg
from sklearn.model_selection import train_test_split
from data.persistence import *
from data.data_source import DataSource
from data.data_storage import DataStorage
class TrainTestSplitHandler(t... | 2.375 | 2 |
src/multipageforms/forms/multipageform.py | kaleissin/django-multipageforms | 4 | 12798799 | <reponame>kaleissin/django-multipageforms
from __future__ import unicode_literals
from collections import OrderedDict
import logging
import copy
LOGGER = logging.getLogger(__name__)
class MultiPageForm(object):
help_text = ''
percentage_done = 0.0
def __init__(self, data=None, files=None, initial=None, ... | 2.34375 | 2 |
Portfolio_Strategies/vectorized_backtesting.py | vhn0912/Finance | 441 | 12798800 | import numpy as np
import pandas as pd
import yfinance as yf
import matplotlib.pyplot as plt
import datetime
from yahoo_fin import stock_info as si
plt.rcParams['figure.figsize'] = (15, 10)
tickers = si.tickers_dow()
individual_stock = input(f"Which of the following stocks would you like to backtest \n{tickers}\n:")
... | 3.0625 | 3 |
horseModuleCore/ar_logger.py | TNO/horse-module-core | 0 | 12798801 | # -*- coding: utf-8 -*-
"""
Created on Tue May 22 14:07:42 2018
@author: HORSE
"""
import logging
import logging.handlers
import os
def ARLogger(log_filename = 'log.txt'):
# if not os.path.exists('logs'):
# os.makedirs('logs')
fmt = '%(asctime)s %(levelname)s %(message)s'
... | 2.796875 | 3 |
integrations/pinger/pinger.py | hamptons/alerta-contrib | 114 | 12798802 | <filename>integrations/pinger/pinger.py
import sys
import platform
import time
import subprocess
import threading
import Queue
import re
import logging
import yaml
from alertaclient.api import Client
__version__ = '3.3.0'
LOG = logging.getLogger('alerta.pinger')
LOG.setLevel(logging.DEBUG)
LOG.addHandler(logging.St... | 2.328125 | 2 |
desky/layout/grid.py | noelbenz/desky | 0 | 12798803 |
import unittest
from desky.rect import Rect
from desky.panel import Panel
from enum import Enum
from functools import reduce, partial
from toolz.dicttoolz import valfilter
# | Type of sizing | Maximum extra width allocation
# --------------------------------------------------------------
# | Fixed (200 p... | 2.515625 | 3 |
seqrepc/setup.py | ednilsonlomazi/SeqrepC | 1 | 12798804 | from distutils.core import setup, Extension
def main():
setup(name="seqrepc",
version="beta1.0",
description="SeqrepC is a module for fundamental operations related to numerical representations of genomic sequences.",
author="<NAME>",
author_email="<EMAIL>",
url="... | 1.265625 | 1 |
python_modules/dagma/dagma_tests/test_lambda_engine.py | vishvananda/dagster | 0 | 12798805 | <filename>python_modules/dagma/dagma_tests/test_lambda_engine.py<gh_stars>0
import logging
import uuid
from collections import namedtuple
import boto3
# import numpy
import pytest
import dagster.check as check
import dagster.core.types as types
from dagster import (
DependencyDefinition,
ExecutionContext,
... | 1.984375 | 2 |
link/test/test_tcp_connection.py | pretty-wise/link | 0 | 12798806 | <filename>link/test/test_tcp_connection.py
import sys
import os
import subprocess
import threading
import signal
import urllib2
import json
import time
sys.path.append('/home/dashboard/codebase/link/utils')
sys.path.append('/Users/prettywise/Codebase/codebase/link/utils')
import parse
import link
def http_local_reques... | 2.65625 | 3 |
model/framework.py | LiGaoJi/DegreEmbed | 7 | 12798807 | <gh_stars>1-10
#!/usr/bin/env python
# -*-coding:utf-8 -*-
# @file : framework.py
# @brief : Framework for training, evaluating and saving models.
# @author : <NAME>
# @email : <EMAIL>
import os
from typing import List, Tuple
from tqdm import tqdm
import numpy as np
import torch
from torch import opti... | 2.234375 | 2 |
src/pydas_metadata/migrations/versions/f73a9aa46c77_add_isenabled_column_to_eventhandlerbase.py | bvanfleet/pydas | 0 | 12798808 | # pylint: disable=no-member,invalid-name,line-too-long,trailing-whitespace
"""Add IsEnabled column to EventHandlerBASE
Revision ID: <KEY>
Revises: 6b5369ab5224
Create Date: 2021-02-17 20:15:42.776190
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_... | 1.085938 | 1 |
stacks/XIAOMATECH/1.0/services/MYSQL/package/scripts/mysql_client.py | tvorogme/dataops | 3 | 12798809 | from resource_management.libraries.script.script import Script
from resource_management.core.resources.packaging import Package
class Client(Script):
def install(self, env):
packages = ['percona-server-client']
Package(packages)
self.configure(env)
def configure(self, env):
im... | 1.984375 | 2 |
Vokeur/website/migrations/0036_auto_20190719_1236.py | lsdr1999/Project | 0 | 12798810 | # Generated by Django 2.2.1 on 2019-07-19 12:36
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('website', '0035_auto_20190625_0900'),
]
operations = [
migrations.RenameField(
model_name='verenigingen',
old_name='ontgroen... | 1.640625 | 2 |
proxy/init.py | chrissvec/py-proxy | 0 | 12798811 | #!/usr/bin/python
# Flask is used to create a somewhat lightweight listening server
from flask import Flask
from requests import get
def spawn_proxy():
myproxy = Flask('__name__')
# Quick health check override
@myproxy.route('/healthcheck', methods=['GET'])
def health():
return "OK"
# ... | 3.015625 | 3 |
Q926_Flip-String-to-Monotone-Increasing.py | xiaosean/leetcode_python | 0 | 12798812 | <filename>Q926_Flip-String-to-Monotone-Increasing.py<gh_stars>0
class Solution:
def minFlipsMonoIncr(self, S: str) -> int:
n = len(S)
min_diff = sum([a != b for a, b in zip(S, n * "1")])
dp_ = [min_diff] * (n+1)
for zero_idx in range(n):
if "0" == S[zero_idx]:
... | 2.890625 | 3 |
pecli/plugins/strings.py | kirk-sayre-work/pecli | 0 | 12798813 | #! /usr/bin/env python
import pefile
import datetime
import os
import re
from pecli.plugins.base import Plugin
from pecli.lib.utils import cli_out
ASCII_BYTE = b" !\"#\$%&\'\(\)\*\+,-\./0123456789:;<=>\?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\[\]\^_`abcdefghijklmnopqrstuvwxyz\{\|\}\\\~\t"
class PluginStrings(Plugin):
name... | 2.453125 | 2 |
polyglot/utils.py | UniversalDevicesInc/Polyglot | 27 | 12798814 | <filename>polyglot/utils.py
""" Generic utilities used by Polyglot. """
# pylint: disable=import-error, unused-import, invalid-name, undefined-variable
# flake8: noqa
import sys
import threading
# Uniform Queue and Empty locations b/w Python 2 and 3
try:
from Queue import Queue, Empty
except ImportError:
from... | 1.984375 | 2 |
connectortest.py | waysys/BCGen | 0 | 12798815 | <filename>connectortest.py
# -------------------------------------------------------------------------------
#
# Copyright (c) 2021 Waysys LLC
#
# -------------------------------------------------------------------------------
# -------------------------------------------------------------------------------
__author_... | 1.726563 | 2 |
j2fa/forms.py | kajala/django-j2fa | 0 | 12798816 | <filename>j2fa/forms.py
from django import forms
from django.utils.translation import gettext_lazy as _
class TwoFactorForm(forms.Form):
code = forms.CharField(label=_("two.factor.code.label"), max_length=8, min_length=1)
| 1.921875 | 2 |
components/fileLoader.py | WangCHEN9/fsPreprocess | 0 | 12798817 | <gh_stars>0
from abc import abstractmethod, ABC
from pathlib import Path
import logging
import streamlit as st
import librosa
import pandas as pd
import numpy as np
from fs_preprocess.tdmsReader import tdmsReader
class fileLoader(ABC):
"""fileLoader meta class"""
def __init__(self, multiple_... | 2.859375 | 3 |
problem_20.py | mc10/project-euler | 0 | 12798818 | '''
Problem 20
@author: <NAME>
'''
def sum_of_digits(number):
'''Sum the digits of a number by taking the last digit and continually
dividing by 10.'''
digit_sum = 0
while number:
digit_sum += number % 10
number //= 10
return digit_sum
def factorial(number):
factoria... | 4.0625 | 4 |
oauth/oauth.py | hasibulkabir/Google | 15 | 12798819 | <reponame>hasibulkabir/Google
# Copyright (c) 2017 The TelegramGoogleBot Authors (see AUTHORS)
#
# 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 limitat... | 1.851563 | 2 |
ex_mn/from_indiv/topo1.py | Oeufhp/seniorProject-SDN | 3 | 12798820 | <gh_stars>1-10
from mininet.topo import Topo
class My_Topo(Topo):
def __init__(self):
"Create P2P topology."
# Initialize topology
Topo.__init__(self)
# Add hosts and switches
H1 = self.addHost('h1',ip='10.0.0.1')
H2 = self.addHost('h2',ip='10.0.0.2')
H3 = ... | 2.828125 | 3 |
api/management/commands/set_in_search_init.py | IFRCGo/ifrcgo-api | 11 | 12798821 | from django.core.management.base import BaseCommand
from api.models import Country
from django.db import transaction
from django.db.models import Q
from api.logger import logger
class Command(BaseCommand):
help = 'Update Countries initially to set/revoke their in_search field (probably one-time run only)'
@t... | 2.09375 | 2 |
code/python/10.regular-expression-matching.py | ANYALGO/ANYALGO | 1 | 12798822 | class Solution:
def isMatch(self, s: str, p: str) -> bool:
if not p:
return not s
if s == p:
return True
if len(p) > 1 and p[1] == "*":
if s and (s[0] == p[0] or p[0] == "."):
return self.isMatch(s, p[2:]) or self.isMatch(s[1:], p)
... | 3.609375 | 4 |
bot/cogs/lock.py | connor-ford/random-discord-bot | 0 | 12798823 | <gh_stars>0
import logging
from discord.errors import NotFound
from discord.ext import commands
from discord_slash import cog_ext
from discord_slash.model import SlashCommandOptionType
from discord_slash.utils.manage_commands import create_choice, create_option
from discord import VoiceState, Member, VoiceChannel, Chan... | 2.375 | 2 |
setup.py | jlnerd/JLpy_Utilities | 0 | 12798824 | <reponame>jlnerd/JLpy_Utilities<gh_stars>0
import setuptools
from distutils.version import LooseVersion
from pathlib import Path
import os
import re
import codecs
here = os.path.abspath(os.path.dirname(__file__))
def read(*parts):
with codecs.open(os.path.join(here, *parts), 'r') as fp:
return fp.read()
... | 2.3125 | 2 |
tos/templatetags/tos_tags.py | SocialGouv/ecollecte | 0 | 12798825 | from django import template
from tos.models import CGUItem
register = template.Library()
@register.simple_tag
def get_cgu_items():
return CGUItem.objects.filter(deleted_at__isnull=True)
| 1.71875 | 2 |
egs/sawtooth-detection-baseline/v2/sawtooth_detection.py | dev0x13/globus-plasma | 0 | 12798826 | <gh_stars>0
import numpy as np
import os
import matplotlib.pyplot as plt
import sys
#####################
# SCRIPT PARAMETERS #
#####################
stage = 0
current_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.join(current_dir, "../../../tools"))
from base import get_globus_version
pyg... | 2.09375 | 2 |
py/test/pytests/brightness/brightness.py | arccode/factory | 3 | 12798827 | # Copyright 2016 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""This is a factory test to check the brightness of LCD backlight or LEDs."""
from cros.factory.device import device_utils
from cros.factory.test.i18n i... | 2.40625 | 2 |
finat/finiteelementbase.py | connorjward/FInAT | 14 | 12798828 | <filename>finat/finiteelementbase.py
from abc import ABCMeta, abstractproperty, abstractmethod
from itertools import chain
import numpy
import gem
from gem.interpreter import evaluate
from gem.optimise import delta_elimination, sum_factorise, traverse_product
from gem.utils import cached_property
from finat.quadratu... | 2.234375 | 2 |
simulation/experiments/simple/sa_strategy.py | smartarch/recodex-dataset | 0 | 12798829 | <reponame>smartarch/recodex-dataset
from interfaces import AbstractSelfAdaptingStrategy
class SimpleSelfAdaptingStrategy(AbstractSelfAdaptingStrategy):
"""Represents a simple SA controller for activation/deactivation of queues based on current workload.
Activates suspended worker queues when the system gets ... | 2.984375 | 3 |
app/port_data_analysis.py | btr260/freestyle-project | 1 | 12798830 | import pandas as pd
import os
import dotenv
from dotenv import load_dotenv
import datetime
import plotly
import plotly.graph_objects as go
from plotly.subplots import make_subplots
from app.other_data_pull import spy_pull, fred_pull
from app.port_data_pull import port_data_pull
from app.portfolio_import import portfol... | 2.453125 | 2 |
aiomatrix/types/events/base.py | Forden/aiomatrix | 2 | 12798831 | <reponame>Forden/aiomatrix<gh_stars>1-10
import datetime
from pydantic import BaseModel, Extra, root_validator
from ...utils.mixins import ContextVarMixin
class MatrixObject(BaseModel, ContextVarMixin):
raw: dict
class Config:
allow_mutation = True
json_encoders = {datetime.datetime: lambda... | 2.296875 | 2 |
src/utils/common.py | neerajbafila/pytorch-CNN | 0 | 12798832 | <gh_stars>0
import yaml
import os
import logging
"""Used to perform common tasks
"""
def read_yaml(yaml_path):
with open(yaml_path, 'r') as yaml_file:
content = yaml.safe_load(yaml_file)
logging.info('yaml file loaded')
return content
def create_directories(path_to_dir: list):
"""Creates dir... | 3.03125 | 3 |
experiments/KS/Bayes/.ipynb_checkpoints/experiment_code-checkpoint.py | GJBoth/MultiTaskPINN | 0 | 12798833 | <filename>experiments/KS/Bayes/.ipynb_checkpoints/experiment_code-checkpoint.py<gh_stars>0
from multitaskpinn.utils.tensorboard import Tensorboard
from multitaskpinn.utils.output import progress
from multitaskpinn.model.deepmod import DeepMoD
from typing import Optional
import torch
import time
import numpy as n... | 2.21875 | 2 |
Python3/872.py | rakhi2001/ecom7 | 854 | 12798834 | <filename>Python3/872.py
__________________________________________________________________________________________________
sample 24 ms submission
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
from coll... | 3.703125 | 4 |
neurogenesis/demux.py | juliusf/Neurogenesis | 3 | 12798835 | <filename>neurogenesis/demux.py
import itertools
import hashlib
import os
import stat
from neurogenesis.base import SimulationRun
from neurogenesis.util import Logger
class DynamicLine(): # TODO better name?
def __init__(self):
self.head_part = ""
self.dynamic_part = ""
self.tail_part = ""
... | 2.703125 | 3 |
test/test_idseqs_to_mask.py | ulf1/keras-tweaks | 0 | 12798836 | from keras_tweaks import idseqs_to_mask
import tensorflow as tf
class AllTests(tf.test.TestCase):
def test1(self):
idseqs = [[1, 1, 0, 0, 2, 2, 3], [1, 3, 2, 1, 0, 0, 2]]
target = tf.sparse.SparseTensor(
indices=(
[0, 0, 1],
[0, 1, 1],
... | 2.375 | 2 |
project_dir/urls.py | cybrvybe/FactorBeats-Platform | 0 | 12798837 | <reponame>cybrvybe/FactorBeats-Platform
"""project_dir URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatte... | 2.40625 | 2 |
skbio/sequence/__init__.py | Kleptobismol/scikit-bio | 0 | 12798838 | <reponame>Kleptobismol/scikit-bio
r"""
Biological sequences (:mod:`skbio.sequence`)
============================================
.. currentmodule:: skbio.sequence
This module provides functionality for working with biological sequences,
including generic sequences, nucelotide sequences, DNA sequences, and RNA
sequenc... | 2.53125 | 3 |
pyheom/noise_decomposition.py | tatsushi-ikeda/pyheom | 5 | 12798839 | <gh_stars>1-10
#
# LibHEOM: Copyright (c) <NAME>
# This library is distributed under BSD 3-Clause License.
# See LINCENSE.txt for licence.
# ------------------------------------------------------------------------
import numpy as np
import scipy as sp
import scipy.sparse
import itertools
from collections import Order... | 1.65625 | 2 |
snippets/streaming_indicators_app.py | MarcSkovMadsen/panel-visuals | 0 | 12798840 | <filename>snippets/streaming_indicators_app.py
import numpy as np
import pandas as pd
import panel as pn
pn.extension(sizing_mode='stretch_width')
layout = pn.layout.FlexBox(*(
pn.indicators.Trend(
data={'x': list(range(10)), 'y': np.random.randn(10).cumsum()},
width=150,
height=... | 2.359375 | 2 |
test_cast/19-10-17/Animal-shelter/solution.py | qinggniq/Algorithm-Practice | 0 | 12798841 | <gh_stars>0
class Animal:
def __init__(self, id: int, isDog: bool):
self.id = id
self.isDog = isDog
class Solution:
def __init__(self):
self.catQueue = []
self.dogQueue = []
self.time = 0
def enqueue(self, animal: list):
if animal[1]:
self.dogQu... | 3.296875 | 3 |
composer/models/resnet9_cifar10/__init__.py | ajaysaini725/composer | 0 | 12798842 | <reponame>ajaysaini725/composer<filename>composer/models/resnet9_cifar10/__init__.py
# Copyright 2021 MosaicML. All Rights Reserved.
from composer.models.resnet9_cifar10.model import CIFAR10_ResNet9 as CIFAR10_ResNet9
from composer.models.resnet9_cifar10.resnet9_cifar10_hparams import CIFARResNet9Hparams as CIFARResNe... | 1.171875 | 1 |
movielens-ml.py | oFwano/Movielens-Datascience-Project | 0 | 12798843 | <gh_stars>0
#!/usr/bin/env python
# coding: utf-8
import sys
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from scipy.sparse import csr_matrix
from sklearn.neighbors import NearestNeighbors
from sklearn.svm import SVC
from sklearn.naive_bayes import GaussianNB
from sklearn.naive_b... | 3.03125 | 3 |
apis_v1/tests/test_views_voter_email_address_retrieve.py | ecluster/WeVoteServer | 0 | 12798844 | # apis_v1/test_views_voter_email_address_save.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
from django.urls import reverse
from django.test import TestCase
from email_outbound.models import EmailAddress, EmailManager
import json
class WeVoteAPIsV1TestsVoterEmailAddressRetrieve(TestCase):
datab... | 2.34375 | 2 |
src/SpartanTicTacToe.py | SpartanEngineer/SpartanTicTacToe | 0 | 12798845 | <gh_stars>0
import copy, random, tkFont, time, webbrowser, os
from Tkinter import *
from functools import partial
from PIL import ImageTk
#-------------------------------------------------------------------------------------
#-------------------------------------------------------------------------------------
#-----... | 2.421875 | 2 |
AC_tools/obsolete/misc_REDUNDANT.py | tsherwen/AC_tools | 7 | 12798846 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Redundant misc. functions to be eventually removed from AC_tools.
"""
import os
import numpy as np
from matplotlib.backends.backend_pdf import PdfPages
import matplotlib.pyplot as plt
from pandas import DataFrame
# time
import time
import datetime as datetime
# math
from m... | 2.671875 | 3 |
douban/test.py | mcxiaoke/python-labs | 7 | 12798847 | <gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: mcxiaoke
# @Date: 2018-01-27 09:47:26
from __future__ import print_function, unicode_literals, absolute_import
import requests
import json
import os
import sys
import hashlib
import time
import argparse
import logging
from lxml import etree, html... | 2.625 | 3 |
wsma/base.py | aradford123/wsma_python | 4 | 12798848 | <reponame>aradford123/wsma_python
# -*- coding: utf-8 -*-
"""
This defines the base class for the WSMA Python module.
"""
from abc import ABCMeta, abstractmethod
from jinja2 import Template
from xml.dom.minidom import parseString
from xml.parsers.expat import ExpatError
import xmltodict
import json
import time
import... | 2.359375 | 2 |
postprocessing.py | loftwah/chatscript_generator | 1 | 12798849 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""Module with functions used in post processing phase"""
import os
import glob
import re
def save_topic_file(topic, botdir):
"""This method saves a topic in a file and returns its name.
Args:
topic (str): Topic content.
botdir (str): Path to dir where t... | 3.03125 | 3 |
nanome/_internal/_structure/_serialization/_residue_serializer.py | rramji/nanome-lib | 0 | 12798850 | from nanome._internal._util._serializers import _ArraySerializer, _StringSerializer, _ColorSerializer
from . import _AtomSerializerID
from . import _BondSerializer
from .. import _Residue
from nanome.util import Logs
from nanome._internal._util._serializers import _TypeSerializer
class _ResidueSerializer(_TypeSeriali... | 1.875 | 2 |