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 |
|---|---|---|---|---|---|---|
hydra_one_navigation/scripts/make_plan_caller.py | PrabhjotKaurGosal/ROS_projects | 0 | 12787951 | <gh_stars>0
#! /usr/bin/env python
import rospy
from nav_msgs.srv import GetPlan, GetPlanRequest
import sys
rospy.init_node('service_client')
rospy.wait_for_service('/move_base/make_plan')
make_plan_service = rospy.ServiceProxy('/move_base/make_plan', GetPlan)
msg = GetPlanRequest()
msg.start.header.frame_id = 'map'... | 2.09375 | 2 |
python3/numpy/Comparisons Masks and Boolean Logic.py | Nahid-Hassan/code-snippets | 2 | 12787952 | # Reference Book: Python Data Science Handbook (page:(70-77))
# Date(13 April, 2019) Day-3, Time = 3:25 PM
# This section covers the use of Boolean masks to examine and manipulate values
# within NumPy arrays.
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn; seaborn.set() #set... | 4 | 4 |
weatherman/sql_butler.py | aecobb53/weatherman | 1 | 12787953 | import sqlite3
import datetime
import yaml
class SQLButler:
"""
SQLButler handles data addition and extraction from the database. There is a csv
database version that is designed to be completely compatable and interchangable
but SQL is likely to be faster in the long run.
"""
def __init__(se... | 3.53125 | 4 |
src/tack/Triggers.py | jmjwozniak/tack | 0 | 12787954 |
# TRIGGERS.PY
import logging
import sys
import time
defaultDefault = object()
class TriggerFactory:
def __init__(self, tack):
self.tack = tack
self.kinds = { "timer" : TimerTrigger,
"process" : ProcessTrigger,
"globus" : GlobusTrigger,
... | 2.703125 | 3 |
tools/init_db.py | yktimes/YkForm | 0 | 12787955 | <reponame>yktimes/YkForm<gh_stars>0
from apps.users.models import User
from peewee import MySQLDatabase
from YkForm.settings import database
from apps.community.models import CommunityGroup,CommunityGroupMember,PostComment,Post,CommentLike
from apps.question.models import Question,Answer
def init():
# database.cr... | 2.046875 | 2 |
1018-Banknotes.py | OrianaCadavid/uri-oj | 0 | 12787956 | <gh_stars>0
banknotes = [100, 50, 20, 10, 5, 2, 1]
def main():
money = int(raw_input())
print money
for bn in banknotes:
print '{} nota(s) de R$ {},00'.format(money / bn, bn)
money = money % bn
if __name__ == '__main__':
main()
| 3.71875 | 4 |
quizzes/00.organize.me/Cracking the Coding Interview/18-7-checkme.py | JiniousChoi/encyclopedia-in-code | 2 | 12787957 | <reponame>JiniousChoi/encyclopedia-in-code<filename>quizzes/00.organize.me/Cracking the Coding Interview/18-7-checkme.py
#!/usr/bin/env python3
''' 주어진 단어 리스트에서 , 다른 언어들을 조합하여
만들 수 있는 가장 긴 단어를 찾는 프로그램을 작성하라. '''
import unittest
def find_longest_compound(words):
words.sort(key=lambda w: len(w), reverse=True)
d... | 3.578125 | 4 |
benchmarks/SimResults/_bigLittle_hrrs_splash_tugberk_heteroFair/cmp_raytrace/power.py | TugberkArkose/MLScheduler | 0 | 12787958 | power = {'BUSES': {'Area': 1.33155,
'Bus/Area': 1.33155,
'Bus/Gate Leakage': 0.00662954,
'Bus/Peak Dynamic': 0.0,
'Bus/Runtime Dynamic': 0.0,
'Bus/Subthreshold Leakage': 0.0691322,
'Bus/Subthreshold Leakage with power gating': 0.0259246,
'Gate... | 1.53125 | 2 |
scripts/preprocessing/index_reference_genome.py | shunhuahan/mcclintock | 62 | 12787959 | <filename>scripts/preprocessing/index_reference_genome.py
import os
import sys
import subprocess
import traceback
try:
sys.path.append(snakemake.config['args']['mcc_path'])
import scripts.mccutils as mccutils
except Exception as e:
track = traceback.format_exc()
print(track, file=sys.stderr)
print("... | 2.1875 | 2 |
Python/Dimensionality-Reduction/t-SNE.py | James-McNeill/Learning | 0 | 12787960 | # t-SNE is a great technique for visual exploration of high dimensional datasets
# Should be applied to non-numeric features
# Import module
from sklearn.manifold import TSNE
# Non-numerical columns in the dataset
non_numeric = ['Branch', 'Gender', 'Component']
# Drop the non-numerical columns from df
df_numeric = d... | 3.96875 | 4 |
statelint/nodes/succeed_state.py | taro-kayo/statelint | 0 | 12787961 | from .mixins import EndMixin
from .state import State
class SucceedState(EndMixin, State):
pass
| 1.28125 | 1 |
old/mumble/doorbot-v5.py | RABCbot/DoorButler | 3 | 12787962 | import time
import alsaaudio as aa
import pymumble.pymumble_py3 as pymumble
from pymumble.pymumble_py3.constants import *
import audioop
from threading import Thread
import queue
import subprocess
import wave
AUDIO_LEN = 640 # Audio chunk size
MUMBLE_CHANNELS = 1 # Mumble hardcoded mono
MUMBLE_RATE = 4... | 2.15625 | 2 |
rules.py | turnerdj95/supreme-meme | 0 | 12787963 | <reponame>turnerdj95/supreme-meme<gh_stars>0
""""
Author: <NAME>
Purpose: Set win conditions and rules for player behavior that don't initiate
"""
# Create class for checking board game for win conditions
class diaglysis:
def __init__(self,
board_array, # the board is the only thing that needs to... | 3.875 | 4 |
projects/python-desk/python_pq_bridge/alembic/versions/392e1a7038a5_set_default_to_string.py | zaqwes8811/coordinator-tasks | 0 | 12787964 | """set default to string
Revision ID: 392e1a7038a5
Revises: <PASSWORD>
Create Date: 2014-11-17 17:41:47.983000
"""
# revision identifiers, used by Alembic.
revision = '392e1a7038a5'
down_revision = '<PASSWORD>'
from alembic import op
import sqlalchemy as sa
def upgrade():
# default ignored
op.drop_column... | 1.359375 | 1 |
cmd_parser.py | Play-Werewolf/werewolf-discord-bindings | 0 | 12787965 |
class Parser:
def __init__(self, discord_bot, context, command, args):
self.discord_bot = discord_bot
self.context = context
self.command = command
self.args = args
self.parse()
def parse(self):
commands = {
"roles": self.print_roles,
"ne... | 2.96875 | 3 |
pyFixedFlatFile/exceptions.py | anderson89marques/PyFixedFlatFile | 5 | 12787966 | class ParamsException(Exception):
"""Exception raised when tp, fmt and size values are wrongs"""
pass
class LineSizeException(Exception):
"""Exception raised when line size is bigger then specified"""
pass
class LineIdentifierException(Exception):
"""Exception raised when line indentifier rased ... | 2.625 | 3 |
apps/dcl/nnm/dcl_util.py | yt7589/cvep | 0 | 12787967 | #
import datetime
class DclUtil(object):
@staticmethod
def datetime_format():
return datetime.datetime.now().strftime("%Y-%m-%d-%H_%M_%S") | 2.953125 | 3 |
scripts/configuration.py | TheLokin/Kabalayn | 0 | 12787968 | import os
import json
from utils import Colors, clamp
from .controllers import Keyboard
from .managers.sprite_font import SpriteFontManager
from pygame.locals import K_UP, K_w, K_DOWN, K_s, K_LEFT, K_a, K_RIGHT, K_d, K_SPACE, K_e, K_RETURN, K_ESCAPE
def read_float(options, key, default):
try:
option = opt... | 2.59375 | 3 |
statarb/src/python/lib/data_handlers/barra_test.py | mikimaus78/ml_monorepo | 51 | 12787969 | import os
import string
import util
import datetime
import newdb
import datafiles
#import config
database = newdb.get_db()
__CAPITALIZATION_UPDATE_THRESHOLD = 0.03 # 5%
def __capEquals(previous, new):
if previous == 0:
if new == 0: return True
else: return False
else:
return abs(new /... | 2.78125 | 3 |
instagram_api/interfaces/api_response.py | Yuego/instagram_api | 13 | 12787970 | <reponame>Yuego/instagram_api<gh_stars>10-100
from abc import ABCMeta, abstractmethod, abstractproperty
__all__ = ['ApiResponseInterface']
class ApiResponseInterface(metaclass=ABCMeta):
@abstractproperty
def is_ok(self): ...
@abstractmethod
def get_message(self): ...
@abstractproperty
def ... | 2.375 | 2 |
cards/deck.py | doctoryes/card-play | 0 | 12787971 | """
Deck of cards.
"""
import itertools
import json
import random
SUITS = (
'Hearts',
'Diamonds',
'Clubs',
'Spades'
)
RANKS = [str(x) for x in range(2, 11)] + ['Jack', 'Queen', 'King', 'Ace']
class Card(object):
"""
A single card in a classic card deck.
"""
def __init__(self, suit=Non... | 4 | 4 |
solutions/Task Scheduler/solution.py | nilax97/leetcode-solutions | 3 | 12787972 | class Solution:
def leastInterval(self, tasks: List[str], n: int) -> int:
tasks_count = list(collections.Counter(tasks).values())
max_count = max(tasks_count)
max_count_tasks = tasks_count.count(max_count)
return max(len(tasks), (max_count-1)*(n+1)+max_count_tasks)
| 3.09375 | 3 |
src/py/analysis_lib/video_creator/colors.py | LandonFuhr/aseen | 0 | 12787973 | from matplotlib import cm
# (B, G, R)
mouse_colors = [
(83, 255, 18), # green
(0, 139, 232), # orange
(255, 136, 0), # blue
(0, 196, 255), # yellow
(0, 25, 255) # red
]
outline_colormap = cm.get_cmap('plasma', 100)
| 2.34375 | 2 |
nsd1805/python/day10/mysql_tedu.py | MrWangwf/nsd1806 | 0 | 12787974 | <gh_stars>0
import pymysql
conn = pymysql.connect(
host='127.0.0.1',
port=3306,
user='root',
passwd='<PASSWORD>',
db='tedu1805',
charset='utf8'
)
cursor = conn.cursor()
insert1 = 'INSERT INTO departments(dep_id, dep_name) VALUES (%s, %s)'
# result1 = cursor.execute(insert1, (1, '人事部'))
# resul... | 2.546875 | 3 |
project/file_upload/models.py | Tanukium/msemi | 9 | 12787975 | from django.db import models
import os
from django.conf import settings
from django.core.exceptions import ValidationError
# Create your models here.
# Define user directory path
def file_size(value):
limit = 524000
if value.size > limit:
raise ValidationError('File too large. Size should not exceed ... | 2.40625 | 2 |
snmpv3_example1.py | maddula55/python_test | 0 | 12787976 | if True:
IP = " 172.16.31.10"
a_user="pysnmp"
auth_key = "galileo1"
encrypt_key= "galileo1"
snmp_user = (a_user, auth_key, encrypt_key)
pynet_rtr1 = (IP, 7961)
pynet_rtr2 = (IP, 8061)
snmp_data = snmp_helper.snmp_get_oid_v3(pynet_rtr1, snmp_user, oid="1.3.6.1.2.1.1.5.0")
# function snmp_get_oid_v3 is ... | 2.421875 | 2 |
app/utils/mail.py | jshwi/jss | 1 | 12787977 | """
app.utils.mail
==============
Setup app's mailer.
"""
import typing as t
from threading import Thread
from flask import Flask, current_app
from flask_mail import Message
from app.extensions import mail
def _send_async_email(app: Flask, msg: Message) -> None:
with app.app_context():
mail.send(msg)
... | 2.703125 | 3 |
venv/lib/python3.6/site-packages/matchbook/endpoints/betting.py | slarkjm0803/autobets | 1 | 12787978 | <gh_stars>1-10
import datetime
from matchbook.endpoints.baseendpoint import BaseEndpoint
from matchbook import resources
from matchbook.enums import Side, Status, AggregationType
from matchbook.utils import clean_locals
class Betting(BaseEndpoint):
def get_orders(self, event_ids=None, market_ids=None,... | 2.359375 | 2 |
tests/test_mpain.py | raeoks/mpain | 0 | 12787979 | from mpain import MPain
class TestMPain(object):
def test_sanity(self):
assert MPain
| 1.734375 | 2 |
DB/mysite/tables_daniel/migrations/0003_auto_20200629_1331.py | stancld/MSc-Project | 2 | 12787980 | <reponame>stancld/MSc-Project<filename>DB/mysite/tables_daniel/migrations/0003_auto_20200629_1331.py
# Generated by Django 3.0.6 on 2020-06-29 13:31
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('tables_daniel', '0002_auto_20200629_1254'),
]
atomic = ... | 1.546875 | 2 |
MEG_SPC/spyking_circus_updates/clustering.py | tommytommy81/MEG-SPC | 1 | 12787981 | from .shared.utils import *
import circus.shared.algorithms as algo
from .shared import plot
import warnings
with warnings.catch_warnings():
warnings.filterwarnings("ignore",category=FutureWarning)
import h5py
from circus.shared.probes import get_nodes_and_edges
from .shared.files import get_dead_times
from cir... | 1.796875 | 2 |
code/replicate.py | tedunderwood/fiction | 21 | 12787982 | #!/usr/bin/env python3
# replicate.py
# This master script gives me a way to record the settings I used for
# various aspects of the article "The Life Cycles of Genres," and
# (I hope) allows other scholars to reproduce the same tests.
# Generally, I've defined a separate function for each part of the
# article that... | 2.015625 | 2 |
test/conftest.py | BvB93/noodles | 22 | 12787983 | <reponame>BvB93/noodles
import pytest
from test.workflows import workflows
from test.backends import backends
def pytest_addoption(parser):
# parser.addoption("--all", action="store_true",
# help="run all combinations")
parser.addoption(
"--workflow",
help="run test only on specified wo... | 2.046875 | 2 |
src/ruv_dl/organize.py | HaukurPall/ruv_dl | 2 | 12787984 | <gh_stars>1-10
import hashlib
import logging
import re
from pathlib import Path
from typing import Dict, List, Optional, Tuple
from ruv_dl.storage import EpisodeDownload
log = logging.getLogger(__name__)
ROMAN_NUMERALS_TO_INT = {
"I": 1,
"II": 2,
"III": 3,
"IV": 4,
"V": 5,
"VI": 6,
"VII":... | 2.671875 | 3 |
src/data/Alynize.py | xiaoyuehe/TFFinance | 0 | 12787985 | <gh_stars>0
if __name__ == '__main__':
df = [1,2,3,5,7,6,4,6,8,9]
mid = []
cur = []
cur_dir = 1
cur_value = df[0]
cur.append(cur_value)
mid.append(cur)
for i in range(len(df)-1):
new_value = df[i+1]
new_dir = 1 if new_value >= cur_value else -1
cur_value = new_v... | 2.875 | 3 |
recipes/Python/576587_Sort_sections_keys_ini/recipe-576587.py | tdiprima/code | 2,023 | 12787986 | #!/usr/bin/python
# -*- coding: cp1250 -*-
__version__ = '$Id: sort_ini.py 543 2008-12-19 13:44:59Z mn $'
# author: <NAME>
import sys
USAGE = 'USAGE:\n\tsort_ini.py file.ini'
def sort_ini(fname):
"""sort .ini file: sorts sections and in each section sorts keys"""
f = file(fname)
lines = f.readlines()
f.close()
... | 2.8125 | 3 |
tally_ho/apps/tally/models/quarantine_check.py | onaio/tally-ho | 12 | 12787987 | from django.db import models
from django.utils.translation import ugettext as _
import reversion
from tally_ho.libs.models.base_model import BaseModel
from tally_ho.apps.tally.models.user_profile import UserProfile
class QuarantineCheck(BaseModel):
class Meta:
app_label = 'tally'
user = models.Forei... | 1.984375 | 2 |
alvi/tests/resources/client/local_python_client/__init__.py | alviproject/alvi | 10 | 12787988 | import logging
import importlib
import multiprocessing
from alvi.tests.resources.base import Resource
logger = logging.getLogger(__name__)
class LocalPythonClient(Resource):
def __init__(self):
logger.info("setting up clients")
self._clients = []
for scene in self.scenes:
modu... | 2.3125 | 2 |
bindsnet_master/bindsnet/preprocessing/__init__.py | Singular-Brain/ProjectBrain | 6 | 12787989 | <reponame>Singular-Brain/ProjectBrain
from .preprocessing import AbstractPreprocessor
| 0.960938 | 1 |
results/reorganize.py | UoB-HPC/everythingsreduced | 0 | 12787990 | import pandas as pd
import glob
import csv
files = [
"a100-results.csv",
"clx-1S-results.csv",
"clx-results.csv",
"gen9-results.csv",
"mi100-results.csv",
# "rome-results-aocc.csv",
"rome-results-cce.csv"]
csv_frames = []
for f in files:
csv_frames.append(pd.read_csv(f, skipinitialspace... | 2.3125 | 2 |
scripts/slave/recipe_modules/gatekeeper/api.py | bopopescu/chromium-build | 0 | 12787991 | <reponame>bopopescu/chromium-build
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from recipe_engine import recipe_api
class Gatekeeper(recipe_api.RecipeApi):
"""Module for Gatekeeper NG."""
def __c... | 1.945313 | 2 |
worker/setup.py | unbalancedparentheses/indielangs | 4 | 12787992 | <filename>worker/setup.py
"""setup.py controls the build, testing, and distribution of the egg"""
from setuptools import setup, find_packages
import os.path
PROJECT = "indielangs"
setup(
name=PROJECT,
version="0.1",
description="Store list of languages detected by github in database",
keywords='prog... | 1.507813 | 2 |
tests/gdb/complete.py | cohortfsllc/cohort-cocl2-sandbox | 2,151 | 12787993 | # -*- python -*-
# Copyright (c) 2014 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import gdb_test
class CompleteTest(gdb_test.GdbTest):
def test_complete(self):
# Test that continue causes the debugged pr... | 2.5625 | 3 |
scheduler/apps/authentication/migrations/0003_merge_20191106_1150.py | bryan-munene/scheduler-api | 0 | 12787994 | <filename>scheduler/apps/authentication/migrations/0003_merge_20191106_1150.py
# Generated by Django 2.2.6 on 2019-11-06 08:50
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('authentication', '0002_auto_20191106_1018'),
('authentication', '0002_auto_201... | 1.304688 | 1 |
tests/tests.py | leomaurodesenv/multiple-nfe-reader | 0 | 12787995 | #--------------------------------------------
#-- Libraries
#--------------------------------------------
# system imports
import os
import sys
# add parent path to python paths
parentdir = os.path.join(os.path.dirname(__file__), '../')
sys.path.insert(0,parentdir)
# imports
import cv2
import datasets
from nfeReader ... | 2.65625 | 3 |
src/connectors/airwatch_devices.py | sfc-gh-kmaurya/SnowAlert | 144 | 12787996 | <gh_stars>100-1000
"""Airwatch
Collect Device information using API Key, Host, and CMSURL Authentication
"""
from runners.helpers import log
from runners.helpers import db
from runners.helpers.dbconfig import ROLE as SA_ROLE
from datetime import datetime
import requests
from urllib.error import HTTPError
from .utils... | 2.234375 | 2 |
custom_components/idasen-desk-controller/const.py | Xlinx64/idasen-desk-controller | 1 | 12787997 | """
Constants for Idasen Desk Controller Integration
"""
import logging
LOGGER = logging.getLogger(__package__)
DOMAIN = 'idasen-desk-controller'
PLATFORMS = ["cover", "sensor", "switch"]
MIN_HEIGHT = 620
MAX_HEIGHT = 1270 # 6500
HEIGHT_TOLERANCE = 2.0
ADAPTER_NAME = 'hci0'
SCAN_TIMEOUT = 5
CONNECTION_TIMEOUT = 20
... | 1.84375 | 2 |
04 - String variables/code_challenge.py | geezerP/workshop | 0 | 12787998 | <reponame>geezerP/workshop
# ask a user to enter their first
# name and store it in a variable
# ask a user to enter their
# last name and store it in a variable
# print their full name
# Make sure you have a space
# between first and last name
# Make sure the first letter
# of first name and last name is uppercase... | 2.953125 | 3 |
gwaripper/migrations/0001_normalize.py | nilfoer/gwaripper | 6 | 12787999 | <filename>gwaripper/migrations/0001_normalize.py<gh_stars>1-10
import os
import datetime
import sqlite3
import logging
import re
from .. import config
date = '2020-11-08'
logger = logging.getLogger(__name__)
FILENAME_MAX_LEN = 185
DELETED_USR_FOLDER = "deleted_users"
UNKNOWN_USR_FOLDER = "_unknown_user_files"
def... | 3 | 3 |
glazier/lib/logs_test.py | ItsMattL/glazier | 1,233 | 12788000 | # Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | 1.851563 | 2 |
SubscribeMQTT.py | NipunaMadhushan/Location_from_beacon_signals | 0 | 12788001 | import paho.mqtt.client as mqtt
import json
import numpy as np
import pandas as pd
import cv2 as cv
from New.TrainModel import test_model, predict_location, linear_train_model, logistic_train_model, svm_train_model, \
rf_train_model
def on_connect(client, userdata, flags, rc):
print("Connected with ... | 2.578125 | 3 |
LogLevel.py | adamcrowe242/logprune | 0 | 12788002 |
import main, os
class LogLevel:
def __init__(self, levelName, directory):
self.levelName = levelName
self.unzippedFilePath = os.path.join(directory, levelName + ".log")
self.zippedFiles = []
self.totalZippedSize = 0
# add each zipped file of the logLevel to the list 'zippe... | 3.265625 | 3 |
pdf_bot/files/file.py | Joy-nath/telegram-pdf-bot | 1 | 12788003 | from telegram.constants import MAX_FILESIZE_DOWNLOAD
from telegram.ext import CommandHandler, ConversationHandler, Filters, MessageHandler
from pdf_bot.consts import (
BACK,
BEAUTIFY,
BY_PERCENT,
BY_SIZE,
CANCEL,
COMPRESS,
COMPRESSED,
CROP,
DECRYPT,
ENCRYPT,
EXTRACT_IMAGE,
... | 1.476563 | 1 |
pysa/nhht.py | holwech/pysa | 0 | 12788004 | <gh_stars>0
import numpy as np
import scipy.signal as signal
from . import utils
# Calculates the normalized HHt.
# Takes in all the IMFs, but not the residue. That is; the last row of the the return value
# of the EMD function should not be included in the input variable "imfs"
def nhht(imfs, sample_frequency):
#... | 2.34375 | 2 |
mpas_analysis/docs/parse_quick_start.py | ytakano3/MPAS-Analysis | 43 | 12788005 | #!/usr/bin/env python
"""
A script for converting the README.md to a quick-start guide for inclusion
in the documentation
"""
from m2r import convert
def build_quick_start():
replace = {'# MPAS-Analysis': '# Quick Start Guide\n',
'[![Build Status]': '',
'[![Documentation Status]': ... | 2.6875 | 3 |
scripts/singledataset_convert.py | chadrick-kwag/labeldat.a | 0 | 12788006 | <filename>scripts/singledataset_convert.py
#!/bin/python3
# this is a script file that converted all the saves json to actual trainable annotation json files.
# modified to work with single dataset
import argparse
import json
import os
import sys
from PIL import Image
import sqlite3
import shutil
SQLITE_DB_LOCATIO... | 2.4375 | 2 |
orangecontrib/wavepy2/util/gui/ow_wavepy_process_widget.py | APS-XSD-OPT-Group/OASYS1-WavePy2 | 0 | 12788007 | # #########################################################################
# Copyright (c) 2020, UChicago Argonne, LLC. All rights reserved. #
# #
# Copyright 2020. UChicago Argonne, LLC. This software was produced #
# under U.S. Gov... | 0.953125 | 1 |
setup.py | regarmukesh3g/pythonPackages | 0 | 12788008 | #!/usr/bin/env python
"""
Setup for distribution package.
"""
from setuptools import setup
setup(name='dist_pdf',
version='1.0',
description='Distribution of data',
packages=['dist_pdf'],
zip_sage=False)
| 1.195313 | 1 |
652.py | wilbertgeng/LeetCode_exercise | 0 | 12788009 | """652. Find Duplicate Subtrees"""
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution(object):
def findDuplicateSubtrees(self, root):
"""
... | 3.84375 | 4 |
sysidentpy/polynomial_basis/tests/test_simulation.py | neylsoncrepalde/sysidentpy | 107 | 12788010 | from numpy.testing._private.utils import assert_allclose
from sysidentpy.polynomial_basis import PolynomialNarmax
from sysidentpy.utils.generate_data import get_miso_data, get_siso_data
import numpy as np
from numpy.testing import assert_almost_equal, assert_array_equal
from numpy.testing import assert_raises
from sysi... | 2.125 | 2 |
hokudai_furima/chat/migrations/0005_auto_20180514_0455.py | TetsuFe/hokuma | 1 | 12788011 | # Generated by Django 2.0.3 on 2018-05-14 04:55
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('chat', '0004_auto_201803... | 1.554688 | 2 |
build/lib/ThermoElectric/tests/test_tau_screened_coulomb.py | ariahosseini/Thermoelectric | 2 | 12788012 | """
Unit and regression test for the tau_screened_coulomb method.
"""
from ThermoElectric import tau_screened_coulomb
import numpy as np
from pytest import approx
def test_tau_screened_coulomb():
energy = np.array([[0.1]])
e_eff_mass = np.array([[0.23 * 9.109e-31]])
dielectric = 11.7
imp = np.array(... | 2.3125 | 2 |
custom_components/hpprinter/managers/config_flow_manager.py | tiberiushunter/hassio-conf | 2 | 12788013 | <gh_stars>1-10
import logging
from typing import Optional
import voluptuous as vol
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_HOST, CONF_NAME
from homeassistant.helpers import config_validation as cv
from .. import LoginError
from ..api.HPPrinterAPI import ProductConfig... | 2.046875 | 2 |
maml_vs_adapted_maml_src/dataloaders/union_sl_dataloaders.py | brando90/Does-MAML-Only-Work-via-Feature-Re-use-A-Data-Set-Centric-Perspective | 0 | 12788014 | <reponame>brando90/Does-MAML-Only-Work-via-Feature-Re-use-A-Data-Set-Centric-Perspective<filename>maml_vs_adapted_maml_src/dataloaders/union_sl_dataloaders.py
"""
Union of data sets for SL training.
"""
from typing import Union
import torchvision
from torch import Tensor
from torch.utils.data import Dataset
from pathl... | 2.375 | 2 |
audiocards/__main__.py | ptrstn/anki-audiocards | 0 | 12788015 | <filename>audiocards/__main__.py
import argparse
from audiocards import __version__
from audiocards.core import create_deck
def parse_arguments():
parser = argparse.ArgumentParser(description="An Anki audio flash card generator")
parser.add_argument(
"--version", action="version", version="%(prog)s ... | 3.03125 | 3 |
fishpass/migrations/0009_auto_20181003_1402.py | Ecotrust/FishPass | 3 | 12788016 | <reponame>Ecotrust/FishPass<filename>fishpass/migrations/0009_auto_20181003_1402.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-10-03 21:02
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fishpas... | 1.289063 | 1 |
text_to_command_conversion/model_creating.py | TolimanStaR/Virushack | 0 | 12788017 | import word2vec
from config import *
word2vec.word2phrase(filename_start, filename_phrases, verbose=True)
word2vec.word2vec(filename_phrases, filename_bin, size=100, verbose=True)
word2vec.word2clusters(filename_start, filename_clusters, 100, verbose=True)
| 2.28125 | 2 |
tests/test_metrics_updater.py | CloudWebManage/cwm-worker-operator | 2 | 12788018 | import json
import pytz
import datetime
from cwm_worker_operator import metrics_updater
from cwm_worker_operator import common
from .mocks.metrics import MockMetricsUpdaterMetrics
def iterate_redis_pools(dc):
for pool in ['ingress', 'internal', 'metrics']:
with getattr(dc, 'get_{}_redis'.format(pool))()... | 2.015625 | 2 |
api/viewsets.py | thinkAmi-sandbox/django-rules-sample | 0 | 12788019 | from rest_framework import mixins
from rest_framework.viewsets import ReadOnlyModelViewSet, GenericViewSet
from rules.contrib.rest_framework import AutoPermissionViewSetMixin
from .serializers import NewsSerializer
from myapp.models import DrfNews
class NewsReadOnlyModelViewSet(AutoPermissionViewSetMixin, ReadOnlyMo... | 1.867188 | 2 |
neurokit2/ecg/ecg_fixpeaks.py | TiagoTostas/NeuroKit | 1 | 12788020 | # - * - coding: utf-8 - * -
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.patches
def ecg_fixpeaks(rpeaks, sampling_rate=1000, iterative=True, show=False):
"""Correct R-peaks location based on their interval (RRi).
Identify erroneous inter-beat-intervals. Lipponen &... | 2.96875 | 3 |
lib/BlockerChecker.py | geirem/python-bom-tracker | 0 | 12788021 | import json
from lib.Component import Component
class BlockerChecker:
def __init__(self, file: str):
self.__blocked = {}
self.__populate_blocked_list(file)
def __populate_blocked_list(self, file: str):
with open(file, 'r') as inimage:
blocked_list = json.load(inimage)
... | 3.015625 | 3 |
fileprovider/utils.py | sideffect0/django-fileprovider | 4 | 12788022 | <filename>fileprovider/utils.py<gh_stars>1-10
from django.http import HttpResponse
def sendfile(path, view_mode=False, download_mode=False, download_fname=None):
"""
Create a xfile compatible Django response
:param str path: absolute path to file
:param view_mode: inform web browser/client the file ca... | 2.640625 | 3 |
crons/navitron_crons/exceptions.py | j9ac9k/navitron | 2 | 12788023 | """exceptions.py: navitron-cron custom exceptions"""
class NavitronCronException(Exception):
"""base exception for navitron-cron project"""
pass
class ConnectionException(NavitronCronException):
"""base exception for connections issues"""
pass
class FatalCLIExit(NavitronCronException):
"""general ... | 2.40625 | 2 |
test_cli/offline_docs/test_cli.py | top-on/offline-docs-py | 0 | 12788024 | """Functional tests of CLI."""
from offline_docs.cli import clean, python
def test_python():
"""Run 'python' command of CLI."""
python()
def test_clean():
"""Run 'clean' command of CLI."""
clean()
| 1.460938 | 1 |
categories/models.py | ajmasia/wordplease | 0 | 12788025 | from django.contrib.auth.models import User
from django.db import models
class Category(models.Model):
"""
Categories data model per user/blog
"""
owner = models.ForeignKey(User, on_delete=models.CASCADE)
name = models.CharField(max_length=150)
created_on = models.DateTimeField(auto_now_add=... | 2.6875 | 3 |
reflexif/framework/depresolver.py | chschmitt/reflexif | 0 | 12788026 | # -*- coding: utf-8 -*-
'''
.. created on 06.09.2016
.. by <NAME>
'''
from __future__ import print_function, absolute_import, division, unicode_literals
from reflexif.compat import *
class Resolver(object):
def __init__(self, nodes, expand):
self.nodes = nodes
self.expand = expand
self.de... | 2.703125 | 3 |
dst/survey/management/commands/systemcheck.py | Ecotrust/floodplain-restoration | 2 | 12788027 | <gh_stars>1-10
from django.core.management.base import BaseCommand, CommandError
from survey.validate import systemcheck, SystemCheckError
class Command(BaseCommand):
help = 'Checks the current system for data integrity'
def handle(self, *args, **options):
try:
systemcheck()
excep... | 2.46875 | 2 |
listener.py | blacktrub/simple_git_hook_listener | 1 | 12788028 | <reponame>blacktrub/simple_git_hook_listener
import os
import subprocess
import configparser
from bottle import route, run
PATH = os.path.dirname(os.path.abspath(__file__))
TOKEN = None
@route('/deploy/<token>', method='GET')
@route('/deploy/<token>', method='POST')
def view(token):
if token != TOKEN:
r... | 2.25 | 2 |
testapp/main.py | RobotHanzo/flaskfilemanager | 21 | 12788029 | <reponame>RobotHanzo/flaskfilemanager
"""
Main blueprint for test app
"""
import logging
from flask import Blueprint, render_template
__author__ = '<NAME> (Little Fish Solutions LTD)'
log = logging.getLogger(__name__)
main = Blueprint('main', __name__)
@main.route('/')
def index():
return render_template('in... | 1.867188 | 2 |
mw/lib/title/tests/test_functions.py | frankier/python-mediawiki-utilities | 23 | 12788030 | from nose.tools import eq_
from ..functions import normalize
def test_normalize():
eq_("Foobar", normalize("Foobar")) # Same
eq_("Foobar", normalize("foobar")) # Capitalize
eq_("FooBar", normalize("fooBar")) # Late capital
eq_("Foo_bar", normalize("Foo bar")) # Space
| 2.328125 | 2 |
client.py | ChargedMonk/Server-Client-communication-using-UDP-Protocol | 0 | 12788031 | import socket
def sendmsg(msgFromClient):
bytesToSend = str.encode(msgFromClient)
serverAddressPort = ("127.0.0.1", 20001)
bufferSize = 5120
UDPClientSocket = socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM)
UDPClientSocket.sendto(bytesToSend, serverAddressPort)
... | 2.578125 | 3 |
output/xml_out.py | pan-webis-de/duan20 | 1 | 12788032 | from xml.etree.ElementTree import Element,ElementTree,tostring
def create_author(autor_id,language,author_type):
author =Element('author', id =autor_id,lang =language, type= author_type)
return author
def write_authors():
author1=create_author("1","en","0")
author2=create_author("2","en","0")... | 3 | 3 |
bmcs_beam/mxn/matresdev/db/exdb/loadtxt_novalue.py | bmcs-group/bmcs_beam | 1 | 12788033 | <reponame>bmcs-group/bmcs_beam
'''
Created on Apr 9, 2010
@author: alexander
'''
from numpy import array, vstack, zeros
from os.path import \
join
from matresdev.db.simdb.simdb import simdb
# The implementation works but is too time consuming.
# @todo: check for a faster and more simple solution!
def loadtxt... | 2.140625 | 2 |
example_11.py | iljuhas7/lab-15 | 0 | 12788034 | <filename>example_11.py
import os
os.mkdir("NewDir")
| 1.570313 | 2 |
src/estimate_cutoff.py | hjhornbeck/fsg_token_speedup | 0 | 12788035 | <reponame>hjhornbeck/fsg_token_speedup
#!/usr/bin/env python3
from math import ceil, log, log1p
import re
import sys
token = re.compile(r'^(..)(..)-[\da-f]{16}-[\da-f]{16}-(.*)-(.*)-[\da-f]+$', re.IGNORECASE)
db = dict()
for line in sys.stdin:
match = token.search(line)
if match is None:
continue
... | 2.21875 | 2 |
ryzen/launcher.py | akhilguliani/daemon | 0 | 12788036 | <gh_stars>0
""" Helper functions to parse and launch programs presented in an input file """
import os
from multiprocessing import Process
from time import time
import shlex
import subprocess
import psutil
def parse_file(file_path):
"""Parse input file and return list of programs with thier dir annd shares"""
... | 3.015625 | 3 |
superai/cli.py | mysuperai/superai-sdk | 1 | 12788037 | import os
import boto3
import click
import json
import signal
import sys
import yaml
from botocore.exceptions import ClientError
from datetime import datetime
from typing import List
from warrant import Cognito
from superai import __version__
from superai.client import Client
from superai.config import get_config_dir... | 1.6875 | 2 |
unified_social_api/abstract/feed.py | kanishkarj/unified-social-api | 0 | 12788038 | import json
from abc import ABCMeta, abstractmethod
class Feed(metaclass=ABCMeta):
def __init__(self, keyword):
self._stories = []
self._len = len(self._stories)
self.__iter__ = self._stories.__iter__
self._stories = self._getStories(keyword)
try:
self.sources =... | 3.03125 | 3 |
interactive_check.py | jknielse/termtable | 0 | 12788039 | <gh_stars>0
import termtable
cols = ['Name', 'Position', 'Thingy']
rows = [
['Joe', 'CEO', 'A thing'],
['Fred', 'CFO', 'Another thing'],
['Bob', 'CTO', 'One more thing'],
['Bloop', '<NAME>', 'Additional thing'],
]
tt = termtable.TerminalTable(cols, rows)
print 'Showing table:\n'
tt.show()
print 'Sin... | 3.109375 | 3 |
tools/compare_humann2_output/compare_humann2_output.py | bernt-matthias/ASaiM-galaxytools | 1 | 12788040 | <reponame>bernt-matthias/ASaiM-galaxytools<filename>tools/compare_humann2_output/compare_humann2_output.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
def extract_abundances(fp, nb_charact_to_extract):
abundances = {}
more_abund_charact = []
abund_sum = 0
with open(fp, 'r') as abund... | 2.640625 | 3 |
apps/accounts/adapter.py | cloudartisan/dojomaster | 1 | 12788041 | from allauth.account.adapter import DefaultAccountAdapter
from django.conf import settings
from django.utils import timezone
from django.shortcuts import resolve_url
class AccountAdapter(DefaultAccountAdapter):
def get_login_redirect_url(self, request):
"""
If the user has never logged in before w... | 2.484375 | 2 |
teraserver/python/tests/modules/FlaskModule/API/user/test_UserRefreshToken.py | introlab/opentera | 10 | 12788042 | from tests.modules.FlaskModule.API.BaseAPITest import BaseAPITest
import datetime
class UserRefreshTokenTest(BaseAPITest):
login_endpoint = '/api/user/login'
test_endpoint = '/api/user/refresh_token'
def setUp(self):
pass
def tearDown(self):
pass
def test_no_token_http_auth_refr... | 2.5625 | 3 |
tests/test_snoo_pubnub.py | joncar/pysnoo | 6 | 12788043 | <reponame>joncar/pysnoo<filename>tests/test_snoo_pubnub.py
"""TestClass for the Snoo Pubnub"""
import json
from pubnub.enums import PNOperationType, PNStatusCategory
from pubnub.models.consumer.common import PNStatus
from pubnub.models.consumer.pubsub import PNMessageResult
from asynctest import TestCase, patch, Magi... | 2.109375 | 2 |
geolocations_app/models.py | sivasankar-dev/latlong-django | 0 | 12788044 | from django.db import models
# Create your models here.
class AddressFile(models.Model):
excel_file = models.FileField(upload_to='excel/')
| 1.929688 | 2 |
easier68k/core/enum/__init__.py | bpas247/Easier68k | 16 | 12788045 | <gh_stars>10-100
__all__ = ['condition',
'condition_status_code',
'ea_mode',
'ea_mode_bin',
'op_size',
'register',
'srecordtype',
'system_status_code',
'trap_task',
'trap_vector']
| 1.0625 | 1 |
youtube-commenter.py | voidabhi/python-scripts | 2 | 12788046 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Python bot for comment a list of urls in YouTube
import time
import numpy as np
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions ... | 3.09375 | 3 |
iaso/models/comment.py | BLSQ/iaso-copy | 29 | 12788047 | <reponame>BLSQ/iaso-copy
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site
from django.db import models
from django_comments.abstracts import CommentAbstractModel
from django.utils.translation import ugettext_lazy as _
class CommentIaso(CommentAbstractModel):
... | 2.15625 | 2 |
modules/check/tests/test_check_c.py | intel/diagnostics-utility | 5 | 12788048 | <gh_stars>1-10
#!/usr/bin/env python3
# /*******************************************************************************
# Copyright Intel Corporation.
# This software and the related documents are Intel copyrighted materials, and your use of them
# is governed by the express license under which they were provided to y... | 1.804688 | 2 |
misc/task_time_calc.py | butla/experiments | 1 | 12788049 | <filename>misc/task_time_calc.py<gh_stars>1-10
"""
Old script that I was using to calculate how much time I spent on a task based on my notes.
"""
import functools
import re
from datetime import datetime
MATCH_ABSOLUTE_TIME = r'(?P<time>\d\d?:\d\d)'
MATCH_TIME_RANGE = r'(?P<start_time>\d\d?:\d\d)\s?-\s?(?P<end_time>\... | 3.078125 | 3 |
backend/events/model/matching.py | IanSteenstra/TherapyNow | 3 | 12788050 | import numpy as np
import matplotlib.pyplot as plt
import sys
import math
import random
import operator
def euclidean(x, x_p):
return ((x[0] - x_p[0]) ** 2 + (x[1] - x_p[1]) ** 2) ** 0.5
def greatest_euclidean(data, centers):
maxi = {}
for x in centers:
for x_p in data:
euc = euclidean... | 3.78125 | 4 |