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 |
|---|---|---|---|---|---|---|
vis/viscell.py | rnbwdsh/VisRNN_ICLR_2016_Text | 0 | 12791551 | <gh_stars>0
import json
import os.path as path
import numpy as np
from utils import *
from model import *
import pdb
def vis_cell(test_set, int_to_char, char_to_int, config):
# no trained model, train a new one
if not path.exists(path.join(config.model_dir,
config.model + '_... | 2.234375 | 2 |
extensions/guessing_game.py | bk62/botter.py | 0 | 12791552 | import random
import asyncio
from discord.ext import commands
import discord
import typing
from base import BaseCog
# https://github.com/Rapptz/discord.py/blob/v1.7.2/examples/guessing_game.py
class GuessingGame(BaseCog, name="Free guessing game -- with nothing at stake."):
def __init__(self, bot):
self... | 3.09375 | 3 |
tests/test_py33_exceptions.py | haypo/trollius | 175 | 12791553 | # -*- coding: utf-8 -*-
"""
Tests for py33_exceptions.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import unittest
from trollius import py33_exceptions
class TestWrapErrors(unittest.TestCase):
def test_ebadf_wrapped_to_OSError(self):
... | 2.5625 | 3 |
emotion/emoji_emotion.py | Datalab-AUTH/MSc---Lampridis---MANIFEST | 3 | 12791554 | <gh_stars>1-10
# anger, fear, joy, sadness
emoji_emotions = {
":person_surfing:": [0.12, 0.195, 0.08800000000000001, 0.222],
":locked:": [0.146, 0.141, 0.196, 0.212],
":hammer:": [0.33299999999999996, 0.42700000000000005, 0.221, 0.18600000000000003],
":confused_face:": [0.331, 0.34299999999999997, 0.10... | 1.851563 | 2 |
chapter-7-image-cap-multimodal-transformers/caption-training.py | EluMichael/Advanced-Natural-Language-Processing-with-TensorFlow-2 | 91 | 12791555 | import tensorflow as tf
from tensorflow.keras.applications.resnet50 import preprocess_input
from tensorflow.keras.preprocessing.image import img_to_array
from tensorflow.keras.preprocessing.image import load_img
import tensorflow_datasets as tfds
import numpy as np
import pandas as pd
from sklearn.model_selection imp... | 2.25 | 2 |
src/main.py | djrlj694/COVID-19 | 0 | 12791556 | #!/usr/bin/env python3
"""
main.py - The main module for processing data and creating visual summaries
for this study.
"""
# =========================================================================== #
# METADATA
# =========================================================================== #
__author__ = 'Robert (Bob... | 1.984375 | 2 |
k8s/config.py | jasonquekavalon/k8s | 0 | 12791557 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8
# Copyright 2017-2019 The FIAAS 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.apache.org/licenses/LICENS... | 1.179688 | 1 |
govee_api_laggat/govee_api_laggat.py | riishh/python-govee-api | 0 | 12791558 | """Govee API client package."""
import asyncio
import logging
import time
import math
from contextlib import asynccontextmanager
from dataclasses import dataclass
from datetime import datetime
from events import Events
from typing import Any, List, Optional, Tuple, Union
import aiohttp
from govee_api_laggat.__versio... | 2.46875 | 2 |
sstcam_sandbox/d181105_sim_telarray_cfg/spe_response.py | watsonjj/CHECLabPySB | 0 | 12791559 | """
Obtain the single photoelectron response for an SiPM. Can be used as an input
to sim_telarray after normalisation with Konrads script
"""
import argparse
from argparse import ArgumentDefaultsHelpFormatter as Formatter
import numpy as np
from scipy.special import binom
from scipy.stats import norm
from IPython impor... | 3.078125 | 3 |
src/datastructures/lru_cache.py | seahrh/coding-interview | 0 | 12791560 | """
LRU Cache: Design and build a "least recently used" cache, which evicts the least recently used item.
The cache should map from keys to values (allowing you to insert and retrieve a value associated
with a particular key) and be initialized with a max size. When it is full, it should evict the least
recently us... | 3.96875 | 4 |
cpdb/cr/tests/views/test_cr_mobile_viewset.py | invinst/CPDBv2_backend | 25 | 12791561 | <reponame>invinst/CPDBv2_backend<filename>cpdb/cr/tests/views/test_cr_mobile_viewset.py
from datetime import datetime, date
from django.urls import reverse
from django.contrib.gis.geos import Point
from mock import patch
from rest_framework.test import APITestCase
from rest_framework import status
from robber import ... | 2.0625 | 2 |
notebooks/csv_maker.py | CJHJ/spatiotemporal-transformer-paper | 6 | 12791562 | # %%
import pandas as pd
from collections import defaultdict
import pickle
from typing import DefaultDict
cmap_data = pickle.load(open("./cmap_transformer.pkl", "rb"))
mm_data = pickle.load(open("./mm_report_transformer.pkl", "rb"))
# %%
def convert_to_metric_first(data):
rows = defaultdict(dict)
for model, ... | 2.640625 | 3 |
classification/migrations/0019_auto_20210201_1625.py | SACGF/variantgrid | 5 | 12791563 | <reponame>SACGF/variantgrid
# Generated by Django 3.1 on 2021-02-01 05:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('classification', '0018_auto_20210201_1004'),
]
operations = [
migrations.AlterField(
model_name='condi... | 1.6875 | 2 |
tasks/new_discussions.py | harej/reports_bot | 2 | 12791564 | # -*- coding: utf-8 -*-
"""
New Discussions -- Provides a list of new discussions within a WikiProject's scope
Copyright (C) 2015 <NAME>, 2016 <NAME>
Licensed under MIT License: http://mitlicense.org
"""
from collections import namedtuple
from datetime import datetime
import re
from reportsbot.task import Task
from ... | 2.796875 | 3 |
tests/RunTests/PythonTests/test2011_011.py | maurizioabba/rose | 488 | 12791565 | <gh_stars>100-1000
# tests for dictionary displays
a = {}
b = {1: 2}
c = {3: 4, 5: 6}
d = {7: "seven", 8: "eight", 9: "nine", 10: "one" + "zero"}
print a
print b
print c
print d
| 2.5 | 2 |
tests/tfTests/tfSim.py | Los-Phoenix/Word2vec_LP | 1 | 12791566 | #coding:UTF-8
#这个文件用tf实现一个单层神经网络,用来判断两个词是否是同义词
#输入是readerX产生的X@200 和Y@1
#划分测试集和监督集、测试集
#使用三层神经网进行训练,n个隐藏层和1个输出层??
import readerX
import tensorflow as tf
import numpy as np
import random
import gc
data_dim = 200#输入数据的维度
# piece = 999999
# sample_num = piece * 49
xInTemp, yInTemp = readerX.genAllXY()
yInTemp = [[i,1 ... | 2.71875 | 3 |
tests/conftest.py | Rshep3087/log-five-three-one | 2 | 12791567 | <filename>tests/conftest.py<gh_stars>1-10
from strength_log.models import User
from strength_log import create_app, db
from strength_log.config import Config
from helium import start_firefox, kill_browser, click, Link, write
import pytest
HOME_PAGE = "https://www.strengthlog.app/"
class TestConfig(Config):
TEST... | 2.265625 | 2 |
src/test.py | priba/graph_metric.pytorch | 6 | 12791568 | <gh_stars>1-10
# -*- coding: utf-8 -*-
from __future__ import print_function, division
"""
Graph classification
"""
# Python modules
import torch
import glob
import numpy as np
import time
import os
# Own modules
from options import Options
from Logger import LogMetric
from utils import load_checkpoint, knn_accuracy... | 2.0625 | 2 |
Old/Market_demand.py | ntuecon/2018groupCE | 3 | 12791569 | price=input('Please detemine the market prices of [x,y]: ')
income=input('Please detemine the income of individual: ')
par=input('Please detemine the parameters of Cobb-Doglous[alpha1,alpha2]: ')
nper=input('Please determine the number of individuals: ')
import Consumer_class
Market_D=[0,0]
for i in range(nper):
... | 3.65625 | 4 |
tests/test_events_triggered_unused.py | Pelmen323/Kaiserreich_Jenkins_PyTests | 0 | 12791570 | ##########################
# Test script to check if "is_triggered_only = yes" events are triggered from somewhere
# If they not - they'll never be triggered
# By Pelmen, https://github.com/Pelmen323
##########################
import re
from ..test_classes.generic_test_class import DataCleaner, ResultsReporter
from ..t... | 2.515625 | 3 |
0x04-python-more_data_structures/10-best_score.py | flourishcodes/holbertonschool-higher_level_programming | 0 | 12791571 | <reponame>flourishcodes/holbertonschool-higher_level_programming<filename>0x04-python-more_data_structures/10-best_score.py<gh_stars>0
#!/usr/bin/python3
def best_score(a_dictionary):
if a_dictionary is None or a_dictionary == {}:
return
n = []
for new in a_dictionary:
n.append(new)
retu... | 2.3125 | 2 |
Scripts/simulation/routing/waypoints/waypoint_generator_connected_points.py | velocist/TS4CheatsInfo | 0 | 12791572 | <gh_stars>0
# uncompyle6 version 3.7.4
# Python bytecode 3.7 (3394)
# Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
# Embedded file name: T:\InGame\Gameplay\Scripts\Server\routing\waypoints\waypoint_generator_connected_points.py
# Compiled at: 2020-04-22 01:40... | 1.90625 | 2 |
utils/tests.py | none-da/zeshare | 0 | 12791573 | from utils.alltests.models_tests import *
from utils.alltests.views_tests import * | 1.085938 | 1 |
Hillup/data/__init__.py | migurski/DEM-Tools | 17 | 12791574 | <gh_stars>10-100
""" Starting point for DEM retrieval utilities.
"""
from math import pi, sin, cos
from os import unlink, close
from itertools import product
from tempfile import mkstemp
from sys import modules
import NED10m, NED100m, NED1km, SRTM1, SRTM3, VFP, Worldwide
from ModestMaps.Core import Coordinate
from Ti... | 2.28125 | 2 |
transform/src/parquet.py | halasystems/boxball | 76 | 12791575 | from pathlib import Path
from typing import Dict, Type, Iterator, List, Tuple
import pyarrow as pa
from pyarrow import csv as pcsv
from pyarrow import parquet as pq
from sqlalchemy import MetaData as AlchemyMetadata, Table as AlchemyTable
from sqlalchemy import Integer, SmallInteger, Float, String, CHAR, Text, Boolean... | 2.515625 | 3 |
codecast_client.py | pitchaim/codecast | 0 | 12791576 | <reponame>pitchaim/codecast<gh_stars>0
import os, subprocess
from socket import *
from threading import Thread
import jack
class Client():
def __init__(self):
#@todo:
# ---ESTABLISH SOCKET CONNECTION WITH SERVER--- #
# ---ONCE ESTABLISHED, PROCEED--- #
#slave - open... | 2.453125 | 2 |
python/plugins/detectbase.py | JumuFENG/iptv-m3u-maker | 0 | 12791577 | # -*- coding: utf-8 -*-
import tools
import time
import db
import threading
from .threads import ThreadPool
class DetectorBase(object):
"""the base class for detecting"""
def __init__(self):
self.T = tools.Tools()
self.now = int(time.time() * 1000)
def getItems(self):
pass
de... | 2.578125 | 3 |
apps/comment/models.py | luismayta/python-example-elasticsearch | 4 | 12791578 | # -*- coding: utf-8 -*-
from django.db import models
from model_utils.models import TimeStampedModel
from apps.post.models import Post
class Comment(TimeStampedModel):
"""Comment for Post
"""
class Meta:
db_table = "comment"
ordering = ["-created"]
post = models.ForeignKey(Post, on_... | 2.3125 | 2 |
exemples/attaques/arp_someone.py | RedFou52/esgi_securite_informatique_pratique | 12 | 12791579 | from scapy.all import *
BROADCAST = "FF:FF:FF:FF:FF:FF"
HOW_MUCH_TO_SPAM_PPL = 7
victim_ip = "192.168.79.129"
gate_ip = "192.168.79.254"
interface = 'vmnet1'
def get_mac(ip):
"""
Récupère l'adresse MAC associée à l'IP par une requête ARP.
"""
ans, unans = srp(
Ether(dst=BROADCAST)/ARP(pds... | 2.515625 | 3 |
chess/ChessConstants.py | vinoo999/alpha-zero-general | 2 | 12791580 | #######################################################
# BOARD CONSTANTS
#######################################################
BLACK = 'b'
WHITE = 'w'
EMPTY = -1
PAWN = 'p'
KNIGHT = 'n'
BISHOP = 'b'
ROOK = 'r'
QUEEN = 'q'
KING = 'k'
SYMBOLS = 'pnbrqkPNBRQK'
DEFAULT_POSITION = 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/... | 2.03125 | 2 |
course/models.py | Mutghost01/ailms | 0 | 12791581 | from django.core.validators import MaxValueValidator
from django.core.validators import MaxValueValidator
from django.db import models
from django.utils import timezone
class Faculty(models.Model):
name = models.CharField(max_length=80, blank=True, null=True)
faculty_describtion = models.TextField(blank=True,... | 2.21875 | 2 |
src/striga/service/sitebus/_stsvcsb_bus.py | ateska/striga | 0 | 12791582 | <gh_stars>0
import os, sys, re, functools, copy, logging as L
import striga.core.exception
###
class Bus(object):
CustomSiteBusDefs = {}
PathCheckRE = re.compile(r'^[^//]*$')
def __init__(self):
self.IntroBusItems = [] #Iterate thru this (call each) in the begining
self.CrossroadBusItems = {} #Check path aga... | 2.3125 | 2 |
tests/test_vasprun.py | akiraakaishi/vasputils | 0 | 12791583 | <reponame>akiraakaishi/vasputils
import unittest
from vasputils.vasprun import from_string
class VectorTest(unittest.TestCase):
def test_parse(self):
v = from_string('<v>0.0 1.0 1.2</v>')
self.assertTrue(v.value, [0.0, 1.0, 1.2])
| 2.6875 | 3 |
modules/dbnd/src/dbnd/api/shared_schemas/alerts_def_schema.py | dmytrostriletskyi/dbnd | 0 | 12791584 | from dbnd._core.tracking.schemas.base import ApiStrictSchema
from dbnd._vendor.marshmallow import fields, pre_load
class MLAlert(ApiStrictSchema):
sensitivity = fields.Float()
look_back = fields.Integer()
class AlertDefsSchema(ApiStrictSchema):
severity = fields.Str(required=True)
type = fields.Str(... | 1.859375 | 2 |
fuel_neutron/extensions/fuel.py | rmoe/fuel-neutron | 0 | 12791585 | <reponame>rmoe/fuel-neutron
from neutron.api.extensions import ExtensionDescriptor
from neutron.api import extensions
from neutron.api.v2 import attributes as attr
from neutron.api.v2 import base
from neutron.common import exceptions as nexception
from neutron import manager
from neutron.quota import resource_registry
... | 1.664063 | 2 |
src/__init__.py | owenvoke/covid-19-tracker | 0 | 12791586 | <gh_stars>0
from .utils import UpdateHandler
up = UpdateHandler() | 1.179688 | 1 |
main_investment_checker.py | ginkgodango/lgs | 1 | 12791587 | import datetime as dt
import numpy as np
import pandas as pd
# START USER INPUT
lgs_filepath = 'U:/CIO/#Data/output/investment/checker/lgs_table.csv'
jpm_filepath = 'U:/CIO/#Data/input/jpm/report/investment/LGSS Preliminary Performance 202005.xlsx'
lgs_dictionary_filepath = 'U:/CIO/#Data/input/lgs/dictionary/2020/06/N... | 3.015625 | 3 |
S1B_imzML_error_fix.py | luketrichardson/RKMD-MS-Imaging-Annotation-and-Filtering | 1 | 12791588 | <reponame>luketrichardson/RKMD-MS-Imaging-Annotation-and-Filtering
from pyimzml.ImzMLParser import ImzMLParser
from pyimzml.ImzMLWriter import ImzMLWriter
import numpy as np
import os
from tqdm import tqdm
## SCRIPT 1B: Run this script if SCRIPT 1A encounters a ValueError.
def imzML_fix(data_path, imzml_fil... | 2.3125 | 2 |
newsApp/docManager.py | adityabansal/newsAroundMe | 9 | 12791589 | import os
import json
import calendar
import time
from boto.s3.connection import S3Connection
from boto.s3.key import Key
from .cachingHelper import getCache
from .constants import LINKTAG_PUBTIME, FEEDTAG_DO_NOT_CLUSTER
from .dbhelper import parseConnectionString, getS3Connection
from .doc import Doc
def _getEpochS... | 2.015625 | 2 |
proxy_check.py | Vaibhav/ProxyTools | 1 | 12791590 | import urllib2, socket
socket.setdefaulttimeout(180)
# read the list of proxy IPs in proxyList
def is_bad_proxy(pip):
try:
proxy_handler = urllib2.ProxyHandler({'http': pip})
opener = urllib2.build_opener(proxy_handler)
opener.addheaders = [('User-agent', 'Mozilla/5.0'... | 3.3125 | 3 |
genemethods/assemblypipeline/skesa.py | OLC-LOC-Bioinformatics/genemethods | 1 | 12791591 | <filename>genemethods/assemblypipeline/skesa.py<gh_stars>1-10
#!/usr/bin/env python3
from olctools.accessoryFunctions.accessoryFunctions import make_path, run_subprocess, write_to_logfile
from genewrappers.biotools import bbtools
from subprocess import CalledProcessError
from click import progressbar
import logging
imp... | 2.109375 | 2 |
Simulating Orbits with Runge Kutta.py | alexodowd/physicsprojects | 0 | 12791592 | <gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 4 10:37:05 2020
@author: Alex
"""
import numpy as np
import matplotlib.pyplot as plt
plt.style.use('dark_background')
from prettytable import PrettyTable
G = 6.674e-11
Me = 5.972e24 #mass of the Earth (kg)
rE = 6.371e6 #radius of e... | 2.75 | 3 |
blog/urls.py | admtomas/cybersecurity_blog | 0 | 12791593 | from django.urls import path
from . import views
app_name = 'blog'
urlpatterns = [
path('', views.post_list, name='post_list'),
path('<slug:post>/', views.post_detail, name='post_detail'),
path('comment/reply/', views.reply_page, name='reply'),
path('about', views.about_page, name='about'),
]
| 1.914063 | 2 |
plot_stats.py | ZhaomingXie/RLAlg | 0 | 12791594 | <reponame>ZhaomingXie/RLAlg
import pickle
import numpy as np
import matplotlib.pyplot as plt
import statistics
class Stats:
def __init__(self, file):
with open (file, 'rb') as fp:
stats = pickle.load(fp)
self.mean = stats[2]
self.noisy_mean = stats[4]
self.std = stats[3]
self.samples = stats[1]
self.lo... | 2.828125 | 3 |
api-intent/app.py | ClimenteA/Python-Chalice-AWSLambda-APIGateway | 1 | 12791595 | <gh_stars>1-10
import requests
from chalice import Chalice
from chalicelib import (
productSchemaIsValid,
cleanProductData,
uploadFromMediaUrls,
saveProductData,
getProductDataByID,
deleteProductDataByID
)
app = Chalice(app_name='api-intent')
# All commented lines are for debugging
# app.deb... | 2.609375 | 3 |
__init__.py | acegiak/midicontrol-skill | 0 | 12791596 | from mycroft import MycroftSkill, intent_file_handler
class Midicontrol(MycroftSkill):
def __init__(self):
MycroftSkill.__init__(self)
@intent_file_handler('midicontrol.intent')
def handle_midicontrol(self, message):
self.speak_dialog('midicontrol')
def create_skill():
return Midico... | 2.203125 | 2 |
st_rationale.py | microsoft/RationaleST | 0 | 12791597 | <gh_stars>0
"""
Author: <NAME> (<EMAIL>)
Code for Self-training for Rationale using few-shot learning.
This code base is adapted from UST (https://github.com/microsoft/UST)
"""
from collections import defaultdict
from sklearn.utils import shuffle
from transformers import *
import logging
import math
impor... | 2.3125 | 2 |
py/test_pat.py | frasertweedale/drill | 1 | 12791598 | import unittest
from . import pat
class PatTestCase(unittest.TestCase):
def test_pat(self):
self.assertTrue(pat.match('a*', ''))
self.assertFalse(pat.match('.', ''))
self.assertTrue(pat.match('ab*', 'a'))
self.assertTrue(pat.match('a.', 'ab'))
self.assertTrue(pat.match('a'... | 3.140625 | 3 |
noah/VersionInfo.py | dasong2410/dataloader | 0 | 12791599 | #! /usr/bin/env python
#_*_encoding:utf-8_*_
class VersionInfo:
def __init__(self, program, version, date, author):
self.program = program
self.version = version
self.date = date
self.author = author
#打印版本信息
def info(self):
print """
Name: \033[33;2m%s\033[0m
Version: \033[33;2m%s\033[0... | 2.796875 | 3 |
soda/distributed_environment/entity.py | mpuk/SODA | 0 | 12791600 | <gh_stars>0
from zmq import Context, DONTWAIT, Poller, POLLIN, DEALER
from threading import Thread
from pickle import dumps, loads
from logging import getLogger
from soda.helpers import support_arguments
from soda.distributed_environment.behavior import ActionNode, IfNode
from subprocess import run, PIPE
from shlex imp... | 1.835938 | 2 |
HW9/YuliiaKutsyk/task_9_3_adam_and_eve.py | kolyasalubov/Lv-677.PythonCore | 0 | 12791601 | <filename>HW9/YuliiaKutsyk/task_9_3_adam_and_eve.py
def God():
return[Man(), Woman()]
class Human:
pass
class Man(Human):
pass
class Woman(Human):
pass | 2.15625 | 2 |
ospi_addon.py | noisymime/OSPi | 1 | 12791602 | <gh_stars>1-10
#!/usr/bin/python
import ospi
#### Add any new page urls here ####
ospi.urls.extend(['/c1', 'ospi_addon.custom_page_1']) # example: (['/c1', 'ospi_addon.custom_page_1', '/c2', 'ospi_addon.custom_page_2', '/c3', 'ospi_addon.custom_page_3'])
#### add new functions and classes here ####
### E... | 2.265625 | 2 |
panflute/utils.py | robert-shade/panflute | 0 | 12791603 | <gh_stars>0
"""
Auxiliary functions that have no dependencies
"""
# ---------------------------
# Imports
# ---------------------------
from collections import OrderedDict
import sys
import os.path as p
from importlib import import_module
# ---------------------------
# Functions
# ---------------------------
def c... | 2.578125 | 3 |
arvan_client/vod/video.py | Sajadrahimi/arvan-client | 1 | 12791604 | <filename>arvan_client/vod/video.py
from typing import List
from arvan_client.arvan.types import DynamicType
class FileInfo(DynamicType):
class General(DynamicType):
duration: int
format: str
bit_rate: int
size: int
class Video(DynamicType):
codec: str
width: int
height: int
frame_rate: str
bit_... | 2.453125 | 2 |
napari_svg/__init__.py | Carreau/napari-svg | 1 | 12791605 | from .hook_implementations import (
napari_get_writer,
napari_write_image,
napari_write_labels,
napari_write_points,
napari_write_shapes,
napari_write_vectors,
)
| 0.949219 | 1 |
test/main/test_about_us.py | crockmitnic/question-paper-generator | 6 | 12791606 | from flaskapp import models
from test.main.base_classes import BaseUser
from test.main.utils import test_post_request
class AboutUsTestCase(BaseUser):
def test_about_us(self):
response = self.client.get("/about-us")
self.assertIn(
b"Welcome to SetNow, We're dedicated to giving you the ... | 2.40625 | 2 |
Examples/two_ultrassonic_thread_HC_SR04 copy.py | BosonsHiggs/arduPython | 0 | 12791607 | <reponame>BosonsHiggs/arduPython
## See Figures/two_ultrassonics_thread.png
from threading import Thread
from pyfirmata import Arduino, pyfirmata, util
from pyfirmata.util import ping_time_to_distance
import time
### Start of pin configuration
board = Arduino() # or Arduino(port) define board
print("Communication succ... | 3.09375 | 3 |
source/nomenclator/dialog/__init__.py | buddly27/nomenclator-nuke | 11 | 12791608 | # -*- coding: utf-8 -*-
from .comp_manager_dialog import CompoManagerDialog
from .outputs_manager_dialog import OutputsManagerDialog
from .project_manager_dialog import ProjectManagerDialog
from .settings_dialog import SettingsDialog
| 1.015625 | 1 |
common/xrd-ui-tests-python/tests/xroad_cs_view_trusted_anchor/view_trusted_anchor.py | ria-ee/XTM | 3 | 12791609 | <gh_stars>1-10
import re
from selenium.webdriver.common.by import By
from tests.xroad_cs_upload_trusted_anchor.upload_trusted_anchor import get_generated_at
from view_models.global_configuration import TRUSTED_ANCHORS_TAB_CSS
from view_models.sidebar import GLOBAL_CONFIGURATION_CSS
from view_models.trusted_anchor imp... | 2.34375 | 2 |
tests/test_rebar.py | SurajDadral/pyconcrete | 19 | 12791610 | <gh_stars>10-100
import pytest
import copy
from pyconcrete import rebar
@pytest.fixture
def r1():
r = rebar.Rebar(
length=5,
diameter=20,
count=1,
insert=(0, 0))
return r
@pytest.fixture
def lr1():
r = rebar.LRebar(
length=5,
diameter=20,
count=2,... | 2.171875 | 2 |
test/test_mw.py | freiburgermsu/WCMpy | 0 | 12791611 | <reponame>freiburgermsu/WCMpy<gh_stars>0
from pandas import DataFrame
from shutil import rmtree
from math import isclose
from glob import glob
import chemw
import re, os
def test_inits():
# import the class modules
chem_mw = chemw.ChemMW()
phreeq_db = chemw.PHREEQdb()
print(os.getcwd())
for TF in ... | 2.40625 | 2 |
Generate_Key.py | ChenhaoJimmyZou/Encryption-For-Any-File | 1 | 12791612 | from Crypto.Hash import SHA256
def getKey(passWord):
hash = SHA256.new(passWord.encode('utf-8'))
return hash.digest()
| 2.71875 | 3 |
xmpath/translate.py | xmake-io/pxmake | 1 | 12791613 | from os.path import expanduser
from os import sep
from re import split
from functools import reduce
from xmtrace import xmtrace
@xmtrace
def xm_path_translate(lua, ph):
return expanduser(reduce(lambda a, b: a + sep + b, split(r"\\|/", ph)))
| 1.828125 | 2 |
Class-Example/CLASS_REPRACTRICED.py | emehrawn/Python-Codes | 0 | 12791614 | <filename>Class-Example/CLASS_REPRACTRICED.py
#Write a Python class named Circle constructed by a radius and two methods
#which will compute the area and the perimeter of a circle.
import math
class circle:
def area1(self,radius):
self.radius = radius
area= radius*radius*math.pi
pr... | 4.3125 | 4 |
moni-alert/bin/comm/log.py | jimdn/monitor-toolkits | 4 | 12791615 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import logging
import logging.handlers
CRITICAL = 1
ERROR = 2
WARNING = 3
INFO = 4
DEBUG = 5
class Logger:
def __init__(self, fileName, level=DEBUG):
dictLevel = {
CRITICAL: logging.CRITICAL,
ERROR: logging.ER... | 3.109375 | 3 |
examples/LUH16A/COMP/plotcomp.py | dcmvdbekerom/exojax | 0 | 12791616 | import matplotlib.pyplot as plt
import numpy as np
nus_lpf,mu_lpf=np.load("clpf.npz",allow_pickle=True)["arr_0"]
nus_modit,mu_modit=np.load("cmodit4500.npz",allow_pickle=True)["arr_0"]
fig=plt.figure(figsize=(8,4))
plt.plot(nus_modit,mu_modit,label="MODIT",color="C1")
plt.plot(nus_lpf,mu_lpf,label="DIRECT",ls="dashe... | 2.390625 | 2 |
test_module.py | EdvardasDlugauskas/Auto-Rain | 1 | 12791617 | import icon_get
import unittest
import mainutils
import iconmanager
test_ini = """
[Rainmeter]
Author=<EMAIL>.<EMAIL>.<EMAIL>
Name=Mid Dock
------------------------------------------------------------------------
;Metadata added by RainBrowser
;http://rainmeter.net/RainCMS/?q=Rainmeter101_AnatomyOfASkin
[Metadata]... | 1.703125 | 2 |
tools/save_waveform.py | ml-postech/LISA | 0 | 12791618 | <filename>tools/save_waveform.py
import argparse
import os
import torch
import torchaudio
import torchaudio.functional as F
import torchaudio.transforms as T
import librosa
import matplotlib.pyplot as plt
def plot_waveform(waveform, sample_rate, filename, title="Waveform", xlim=None, ylim=None):
waveform = wavefo... | 2.5625 | 3 |
preprocessor/__init__.py | AntonYermilov/gec-dataset-analyzer | 0 | 12791619 | <reponame>AntonYermilov/gec-dataset-analyzer
from .aesw import AESWPreprocessor
from .lang8 import Lang8Preprocessor
from .fce import FCEPreprocessor
from .jfleg import JFLEGPreprocessor
class DatasetPreprocessorNotFoundError(ValueError):
def __init__(self, preprocessor_name: str):
super().__init__()
... | 2.046875 | 2 |
mdct/windows.py | tombackstrom/mdct | 40 | 12791620 | <reponame>tombackstrom/mdct
""" Module for windowing functions not found in SciPy
"""
from __future__ import division
import numpy as np
from scipy.signal import kaiser
__all__ = [
'kaiser_derived',
]
def kaiser_derived(M, beta):
""" Return a Kaiser-Bessel derived window.
Parameters
----------
... | 2.296875 | 2 |
tests/test_base_element.py | oiakinat/shawl | 3 | 12791621 | <reponame>oiakinat/shawl
# -*- coding: utf-8 -*-
# pylint:disable=protected-access
from shawl import BaseElement
def test_load_elements():
b_element = BaseElement('driver', **{'xpath': '//div'})
assert b_element._element is None
assert b_element._selector == ('xpath', '//div')
def test_check_str_repr():... | 2.25 | 2 |
BOJ/review/boj_2110.py | mrbartrns/swacademy_structure | 0 | 12791622 | # BOJ 2110
import sys
si = sys.stdin.readline
n, m = map(int, si().split())
arr = [int(si()) for _ in range(n)]
arr.sort()
MIN = 1
MAX = arr[-1] - arr[0]
def get_count(gap):
cnt = 1
last = arr[0]
for i in range(1, n):
if arr[i] - last >= gap:
cnt += 1
last = arr[i]
re... | 2.96875 | 3 |
CHAPTER 07 (linked_list)/position_class.py | ahammadshawki8/Data-Structures-Algorithms-in-Python- | 0 | 12791623 | <filename>CHAPTER 07 (linked_list)/position_class.py
class Position:
"""An abstraction representing the location of a single element."""
def __init__(self,container,node):
"""Constructor should not be invoked by the user."""
self._container = container
self._node = node
def element... | 4.1875 | 4 |
fdxExceptionDetails/fdxExceptionDetailsForNameError.py | SkyLined/mDebugOutput | 2 | 12791624 | <gh_stars>1-10
import re;
def fdxExceptionDetailsForNameError(oException):
if len(oException.args) != 1:
return {};
if isinstance(oException, UnboundLocalError):
oUnboundLocalErrorMessageMatch = re.match(r"^local variable '([_\w]+)' referenced before assignment$", oException.args[0]);
if not oUnboundLo... | 2.28125 | 2 |
answers/justshivam/Day 3/question2.py | arc03/30-DaysOfCode-March-2021 | 22 | 12791625 | def check(num):
stage = []
for i in num:
if i in stage:
print(f"{num} is not a Unique Number.")
return
stage.append(i)
print(f'{num} is a Unique Number.')
num = input('Enter the number: ')
check(num)
| 3.8125 | 4 |
aaem/components/residential_buildings/component.py | gina-alaska/alaska_affordable_energy_model | 1 | 12791626 | <gh_stars>1-10
"""
Residential Efficiency component body
-------------------------------------
"""
import numpy as np
from pandas import DataFrame
import os
from aaem.components.annual_savings import AnnualSavings
from aaem.community_data import CommunityData
from aaem.forecast import Forecast
from aaem.diagnostics i... | 2.296875 | 2 |
nginx_log_monitor/clients/overwatch_client.py | messa/nginx-log-monitor | 0 | 12791627 | <gh_stars>0
from aiohttp import ClientSession
from logging import getLogger
from reprlib import repr as smart_repr
logger = getLogger(__name__)
post_timeout_s = 30
class OverwatchClientNotConfiguredError (Exception):
pass
class OverwatchClientReportError (Exception):
pass
class OverwatchClient:
de... | 2.234375 | 2 |
ACM ICPC/DP/MatrixChain_multiplication/matrixchain_mul.py | shreejitverma/GeeksforGeeks | 2 | 12791628 | <gh_stars>1-10
import sys
def MatrixChainOrder(p, i, j):
'''
Matrix A[i] has dimension p[i-1] x p[i]
for i = 1..n
'''
if i == j:
return 0
_min = sys.maxsize
# place parenthesis at different places
# between first and last matrix,
# recursively calculate count of
# mul... | 3.5625 | 4 |
dev/frontend/controllers/__init__.py | frederikgram/describe | 2 | 12791629 | <reponame>frederikgram/describe
from .template_builders import *
from .actions import *
from .startup import *
| 1.03125 | 1 |
streamlit_qa.py | manisnesan/fastchai | 2 | 12791630 | from transformers import pipeline
import wikipedia
import warnings
import streamlit as st
warnings.filterwarnings("ignore")
def get_context_from_wiki(query: str) -> str:
"Given a query, return the summary about the query from wikipedia"
results = wikipedia.search(query)
# There could be more than 1 due to Dis... | 3.46875 | 3 |
module_02/youtube_ex.py | AngieGarciaT/2021_python_selenium | 0 | 12791631 | <gh_stars>0
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select
from selenium.webdriver.support.wait import WebDriverWait
from common.webdriver_factory import get_driver
from selenium.webdriver.support import expected_conditions as EC
driver = get_driver('chrome')
driver... | 3.25 | 3 |
src/sites/product_model.py | FelipeCRamos/Wishlist-Scrape | 4 | 12791632 | <filename>src/sites/product_model.py<gh_stars>1-10
class ProductModel:
def __init__(
self,
title = '',
price = 0.0,
hasDiscount = False,
hasError = False,
isIndisponible = False
):
self.title = title
self.price = price
... | 2.234375 | 2 |
MFD_vio_plot.py | hghodke/mfd_FRET | 0 | 12791633 | <filename>MFD_vio_plot.py
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 25 11:19:10 2021
@author: ribis
"""
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
df = pd.read_csv("C:/Users/harshad/Dropbox/Mfd project/Mfd FRET paper/Data/Reviewer experiments/lifetimes... | 2.25 | 2 |
basic/p_extract_clips.py | magland/pyms | 1 | 12791634 | <filename>basic/p_extract_clips.py<gh_stars>1-10
import numpy as np
import sys,os
parent_path=os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(parent_path)
from mlpy import writemda64,writemda32,readmda,DiskReadMda
from common import TimeseriesChunkReader
# import the C++ code
# we no lon... | 2.234375 | 2 |
webapp/project.py | YajanaRao/WebApp | 1 | 12791635 | <filename>webapp/project.py
from flask import render_template
from webapp import app
from webapp.route import bp
from webapp.database import setup
#
app.register_blueprint(bp)
setup()
@app.route('/')
def index():
return render_template('index.html')
@app.errorhandler(404)
def pagenotfound(error):
return ... | 2.15625 | 2 |
Exercicios do curso em video/pythonProject/pythonexercicios/ex029.py | HiCosta/Exercicios-de-Python | 0 | 12791636 | vel = int(input('Digite a velocidade que o carro está: '))
if vel > 80:
print('Você foi multado em {} reais'.format((vel - 80) * 7))
| 3.6875 | 4 |
resource/globals.py | Kyando2/TLE | 1 | 12791637 | <filename>resource/globals.py
import json
def get_channels():
with open('bin/channels.json', 'r') as f:
parsed = json.loads(f.read())
f.close()
return parsed
| 2.453125 | 2 |
_templates/jinja2/cookiecutter-py/{{cookiecutter.name}}/choices/testfrwk/pytest/tests/test_classic.py | thebridge0491/intro_py | 0 | 12791638 | # -*- coding: utf-8 -*-
'''Test cases for Classic module.'''from __future__ import (absolute_import, division, print_function,
unicode_literals)
import pytest
from future.builtins import (ascii, filter, hex, map, oct, zip, object, range)
from {{cookiecutter.parent}}.{{cookiecutter.project}} import classic
def in... | 2.296875 | 2 |
help/examples/only_analyze_demo.py | foxrenderfarm/rayvision_clarisse | 1 | 12791639 | <filename>help/examples/only_analyze_demo.py
# -*- coding: utf-8 -*-
"""only analyze clarisse"""
from rayvision_clarisse.analyse_clarisse import AnalyzeClarisse
analyze_info = {
"cg_file": r"D:\files\CG FILE\clarisse_test1.project",
"workspace": "c:/workspace",
"software_version": "clarisse_ifx_4.0_sp3",
... | 1.640625 | 2 |
google-cloud-sdk/lib/third_party/cloud_ml_engine_sdk/features/__init__.py | bopopescu/searchparty | 0 | 12791640 | # 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 a... | 2.890625 | 3 |
main.py | daniel20159050454/Biblioteca | 0 | 12791641 | import PyQt5
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QMainWindow, QMessageBox, QApplication
import sys
from Telas_Usuario.tela_de_login import Ui_Tela_Login
from Telas_Usuario.adm_livro import Ui_MainWindow as Ui_Adm_Livro
from Telas_Usuario.cad_livro import Ui_MainWindow as Ui_Cadastro_L... | 1.976563 | 2 |
plot_outs.py | dieman95/deepimportance_code_release | 0 | 12791642 | <gh_stars>0
import numpy as np
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
from keras.models import load_model, model_from_json
from utils import load_MNIST
from utils import get_layer_outs_new
from utils import filter_val_set
from utils import load_layerwise_relevances
from lrp_toolbox.mo... | 2.34375 | 2 |
analysis.py | lanl/SHELTIE | 2 | 12791643 | <gh_stars>1-10
#!/usr/bin/env python2
from test_json import test_json
from cleansing import parse_sublogs, build_graph
import os.path
import subprocess
import sys
import json
import argparse
from git import Repo
import re
import pprint
import git
import matplotlib
import binascii
parser = argparse.ArgumentParser()
p... | 2.328125 | 2 |
blinky/blinky.py | tve/mpy-mqtt | 80 | 12791644 | <filename>blinky/blinky.py<gh_stars>10-100
import logging
log = logging.getLogger(__name__)
from uasyncio import Loop as loop, sleep_ms
from board import act_led
class Blinker:
def __init__(self, mqclient, topic, period):
self.mqclient = mqclient
self.topic = topic
self.period = period
... | 2.875 | 3 |
speech_mixer.py | ZhihaoDU/speech_feature_extractor | 111 | 12791645 | <reponame>ZhihaoDU/speech_feature_extractor
# coding = utf-8
import numpy as np
from read_sphere_wav import read_sphere_wav
from scipy.io import wavfile
from feature_extractor import *
from matplotlib import pyplot as plt
def SNR(x1, x2):
from numpy.linalg import norm
return 20 * np.log10(norm(x1) / norm(x2)... | 2.765625 | 3 |
pickle_details.py | garudlab/mother_infant | 0 | 12791646 | <gh_stars>0
# Script to pickle very specific information (allele identity and counts)
# for small set of given QP pairs at given sites
from utils import sample_utils as su, parse_midas_data, substitution_rates_utils, config, temporal_changes_utils, snps_utils, core_gene_utils, gene_diversity_utils
import numpy as np
f... | 2.109375 | 2 |
tests/conftest.py | zillow/aiographite | 14 | 12791647 | <reponame>zillow/aiographite
import pytest
@pytest.fixture
def metric_parts():
return ['sproc performance', '<EMAIL>', '::EH12']
@pytest.fixture
def timestamp():
return 1471640923
@pytest.fixture
def metric_value_tuple_list():
return [
('zillow', 124), ('trulia', 223),
('hotpad', 53534... | 1.796875 | 2 |
aedes_server/core/management/commands/compute_clusters.py | henriquenogueira/aedes | 0 | 12791648 | from aedes_server.core.clusters import compute_clusters
from django.core.management import BaseCommand
class Command(BaseCommand):
help = 'Calculate clusters for AedeSpot app.'
def handle(self, *args, **options):
'''
Computing clusters.
'''
compute_clusters()
| 1.828125 | 2 |
pymusicterm/ui/labels.py | EGAMAGZ/Terminal-Music-Player | 2 | 12791649 | import py_cui
from pymusicterm.music import SongFile
from pymusicterm.util.file import File, FileMetadata
class SongInfoBlockLabel:
_row:int=0
_column:int=2
_row_span:int=2
_column_span:int=3
_center:bool=False
window:py_cui.widget_set.WidgetSet
def __init__(self,window:py_cui.widget_se... | 2.75 | 3 |
jcasts/podcasts/migrations/0043_alter_podcast_hub_token.py | danjac/jcasts | 13 | 12791650 | # Generated by Django 3.2.7 on 2021-09-18 10:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("podcasts", "0042_podcast_hub_exception"),
]
operations = [
migrations.AlterField(
model_name="podcast",
name="hub_to... | 1.554688 | 2 |