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 |
|---|---|---|---|---|---|---|
eufy_security_ws_python/model/version.py | bachya/eufy-security-ws-python | 20 | 12799351 | <reponame>bachya/eufy-security-ws-python<gh_stars>10-100
"""Define utilities related to eufy-websocket-ws versions."""
from dataclasses import dataclass
@dataclass
class VersionInfo:
"""Define the server's version info."""
driver_version: str
server_version: str
min_schema_version: int
max_schema... | 2.421875 | 2 |
Practica1/Suma binaria/Grafica.py | JosueHernandezR/An-lisis-de-Algoritmos | 1 | 12799352 | <gh_stars>1-10
#Análisis de Algoritmos 3CV2
# <NAME>
# <NAME>
# Práctica 1 Suma Binaria
# En este archivo se crean las funciones para el graficado del algoritmo
import matplotlib.pyplot as plt
import numpy as np
def graph ( size, time ):
# Título de la ventana.
plt.figure ( "Complejidad temporal del algoritm... | 3.734375 | 4 |
rdfmodule/rdf_fixer.py | DocMinus/chem-rdf-fixer | 1 | 12799353 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Chemical RDF converter & fixer.
Version 2.3 (Dec 28, 14:25:00 2021)
Added mol sanitization and try/catch
run by calling
rdf_fixer.convert(filename or path)
(optional: returns list of new filenames)
@author: <NAME> (DocMinus)
license: MIT License
Copyright (c) 2021 D... | 2.796875 | 3 |
boot.py | DanijelMi/ChuckTesta | 0 | 12799354 | <gh_stars>0
# This file is executed on every boot (including wake-boot from deepsleep)
import esp
import machine
esp.osdebug(None)
SESSION_FILENAME = 'SessionData.txt'
exceptionMessage = None
def reboot():
machine.reset()
def help1():
print("This is a WIP help menu")
print("Some descriptio... | 2.453125 | 2 |
.deploy/run_tests.py | stigok/ruterstop | 8 | 12799355 | #!/usr/bin/env python3
from subprocess import run
from sys import argv, exit
PYVER = argv[1]
IMAGE = f"ruterstop:python{PYVER}"
print("Building", IMAGE)
run(
[
"docker",
"build",
"--network=host",
"--file=.deploy/Dockerfile",
f"--build-arg=PYTHON_VERSION={PYVER}",
f... | 2.171875 | 2 |
machine_replacement.py | dsbrown1331/broil | 1 | 12799356 | import bayesian_irl
import mdp_worlds
import utils
import mdp
import numpy as np
import scipy
import random
import generate_efficient_frontier
import matplotlib.pyplot as plt
def generate_reward_sample():
#rewards for no-op are gamma distributed
r_noop = []
locs = 1/2
scales = [20, 40, 80,190]
... | 2.625 | 3 |
example_code/python_scripts/get_most_recent_sentiment_by_symbol.py | khmurakami/pystocktwits_data_utils | 4 | 12799357 | <reponame>khmurakami/pystocktwits_data_utils
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pystocktwits_data_utils import PyStockTwitData
from pystocktwits_data_utils.utils import return_json_file
data = PyStockTwitData()
recent_msg = data.get_most_recent_sentiment_by_symbol_id('AAPL')
print(recent_msg)
retur... | 1.882813 | 2 |
accumulators/decorator.py | icecrime/Accumulators | 1 | 12799358 | <gh_stars>1-10
# Copyright 2013 <NAME>
#
# 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 agreed to in w... | 2.84375 | 3 |
keerthilinepro.py | Alu0331/python | 0 | 12799359 | import time
import math
@profile
def primes(n):
start = time.time()
prime1 = [2]
sn=int(math.sqrt(n))
for attempt in range(3,sn+1,2):
if all((attempt % prime != 0 and n%attempt==0) for prime in prime1):
prime1.append(attempt)
end = time.time()
print(end - start)
... | 3.640625 | 4 |
data.py | luyug/Condenser | 96 | 12799360 | # Copyright 2021 Condenser Author 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... | 1.976563 | 2 |
{{cookiecutter.project_slug}}/src/tests/core/test_core_exceptions.py | abogoyavlensky/cookiecutter-django-api | 7 | 12799361 | from rest_framework.exceptions import APIException
from core.exceptions import common_exception_handler
def test_common_exception_handler_if_error_without_detail(mocker):
exp = APIException({'data': 'test'})
response = common_exception_handler(exp, mocker.Mock())
assert response.data['service_name'] == '... | 2.671875 | 3 |
tests/service/test_account.py | dyens/sdk-python | 0 | 12799362 | <filename>tests/service/test_account.py
from dynaconf import settings
class TestAccount:
"""Test Account."""
def test_account_list(self, api):
"""Test account list."""
accounts = api.Account.list().all()
assert list(accounts)
def test_account(self, account):
"""Test accou... | 2.53125 | 3 |
venv/lib/python3.8/site-packages/typing_extensions.py | GiulianaPola/select_repeats | 1 | 12799363 | /home/runner/.cache/pip/pool/31/7e/c3/6f40f37bb639fd5ec71c56a301b7fc20fbafc36652d3ba3fb1fa41384f | 0.800781 | 1 |
emmet/abbreviation/tokenizer/tokens.py | jingyuexing/py-emmet | 29 | 12799364 | class Token:
__slots__ = ('start', 'end')
def __init__(self, start: int=None, end: int=None):
self.start = start
self.end = end
@property
def type(self):
"Type of current token"
return self.__class__.__name__
def to_json(self):
return dict([(k, self.__getat... | 2.734375 | 3 |
__init__.py | ScottHull/fEquilibrium | 0 | 12799365 | from radioactivity import *
from thermodynamics import *
from dynamics import *
from box import *
from stats import *
from meta import * | 1.070313 | 1 |
ENTRY_MODULE/FirstStepsInCoding/LAB/09_Yard_Greening.py | sleepychild/ProgramingBasicsPython | 0 | 12799366 | <gh_stars>0
price = float(input()) * 7.61
discount = price * 0.18
final = price - discount
print(f'The final price is: {final} lv.\nThe discount is: {discount} lv.')
| 3.4375 | 3 |
ui/gui.py | AivGitHub/clutcher | 0 | 12799367 | <filename>ui/gui.py<gh_stars>0
from concurrent.futures import ThreadPoolExecutor
import pathlib
from PyQt5.QtWidgets import QMainWindow, QMessageBox, QFileDialog
import threading
from clutcher import settings
from torrent.structure.torrent import Torrent
from ui.generated import Ui_MainFrame
class MainFrame(QMainWin... | 2.28125 | 2 |
h/h_api/bulk_api/model/data_body.py | kevinjalbert/h | 0 | 12799368 | """Models representing the data modifying payloads."""
from h.h_api.enums import DataType
from h.h_api.model.json_api import JSONAPIData
from h.h_api.schema import Schema
class UpsertBody(JSONAPIData):
data_type = None
query_fields = []
@classmethod
def create(cls, attributes, id_reference):
... | 2.640625 | 3 |
tests/test_app.py | Olive-Wangui/Pitchy | 0 | 12799369 | <gh_stars>0
import unittest
from app.models import User, Post, Comment
class PitchTest(unittest.TestCase):
def setUp(self):
self.new_user = User(username='Olly', email='<EMAIL>', password='<PASSWORD>')
self.new_post = Post()
self.new_comment = Comment()
def test_user_instance(self):
... | 2.65625 | 3 |
GArDen/compose/__init__.py | zaidurrehman/EDeN | 0 | 12799370 | #!/usr/bin/env python
"""Provides ways to join distinct graphs."""
from GArDen.transform.contraction import Minor
from sklearn.base import BaseEstimator, TransformerMixin
import networkx as nx
import logging
logger = logging.getLogger(__name__)
# ---------------------------------------------------------------------... | 2.796875 | 3 |
python/showwhy-backend/showwhy_backend/InferenceJoinResultActivity/__init__.py | microsoft/showwhy | 18 | 12799371 | <filename>python/showwhy-backend/showwhy_backend/InferenceJoinResultActivity/__init__.py
#
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project.
#
import uuid
from typing import Dict
from showwhy_inference.inference import join_results
from s... | 2.109375 | 2 |
SentimentAnalysis/creat_data/tencent.py | renjunxiang/Sentiment-analysis | 30 | 12799372 | from SentimentAnalysis.creat_data.config import tencent
import pandas as pd
import numpy as np
import requests
import json
import time
import random
import hashlib
from urllib import parse
from collections import OrderedDict
AppID = tencent['account']['id_1']['APP_ID']
AppKey = tencent['account']['id_1']['AppKey']
de... | 2.359375 | 2 |
testYOLOv3.py | SuicideMonkey/Object-Detection-API-Tensorflow | 303 | 12799373 | <filename>testYOLOv3.py
import tensorflow as tf
import numpy as np
import os
import utils.tfrecord_voc_utils as voc_utils
import YOLOv3 as yolov3
# import matplotlib.pyplot as plt
# import matplotlib.patches as patches
# from skimage import io, transform
from utils.voc_classname_encoder import classname_to_ids
os.envir... | 1.882813 | 2 |
shape_recognition/libraries/braile_recognition/braille.py | ys1998/tactile-shape-recognition | 0 | 12799374 | # -*- coding: utf-8 -*-
'''
#-------------------------------------------------------------------------------
# NATIONAL UNIVERSITY OF SINGAPORE - NUS
# SINGAPORE INSTITUTE FOR NEUROTECHNOLOGY - SINAPSE
# Singapore
# URL: http://www.sinapseinstitute.org
#-----------------------------------------------------------... | 1.773438 | 2 |
plot_property.py | NogaBar/open_lth | 0 | 12799375 | <reponame>NogaBar/open_lth
import argparse
import matplotlib
matplotlib.use('pdf')
import matplotlib.pyplot as plt
import os
import json
import numpy as np
from platforms.platform import get_platform
import seaborn as sns
def main(args):
property= {}
rand_property = {}
sparsity = []
for dir in os.lis... | 2.3125 | 2 |
gradient_boosting_classifier.py | rikudoayush/Tkinter-Gui-And-ML- | 1 | 12799376 | from algorithm import Algorithm
from tkinter import *
from tkinter import ttk
class Gradient_Boosting_Classifier(Algorithm):
def __init__(self, frame):
self.frame = frame
self.name = "Gradient Boosting Classifier"
#Options for the loss criteria.
self.Loss_Label = ttk.Label(frame, text="Loss Fun... | 3.546875 | 4 |
deepy/layers/word_embed.py | uaca/deepy | 260 | 12799377 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import theano
import theano.tensor as T
from deepy.layers import NeuralLayer
class WordEmbedding(NeuralLayer):
"""
Word embedding layer.
The word embeddings are randomly initialized, and are learned over the time.
"""
def __init__(... | 2.609375 | 3 |
Part 5 - Association Rule Learning/Section 28 - Apriori/Apriori_Python/apriori.py | xavialex/Machine-Learning-Templates | 1 | 12799378 | <reponame>xavialex/Machine-Learning-Templates
# Apriori
# Importing the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Data Preprocessing
dataset = pd.read_csv('Market_Basket_Optimisation.csv', header = None) # Se especifica el header = None para no perder la primera línea
# Conver... | 3.15625 | 3 |
2016-12-built-in-intents/parse_data.py | Carolyn95/NLU-data | 0 | 12799379 | import pdb
import json
import numpy as np
file = 'benchmark_data.json'
with open(file, 'r') as f:
json_data = json.load(f)
print(json_data.keys()) # ['domains', 'version']
domains = json_data['domains']
print('domain length', len(domains))
corr_data = []
for domain in domains:
temp = {}
temp['long_description'... | 2.59375 | 3 |
molmolpy/g_mmpbsa/g_mmpbsa_dask.py | hovo1990/molmolpy | 1 | 12799380 | # -*- coding: utf-8 -*-
# !/usr/bin/env python
#
# @file __init__.py
# @brief G_MMPBSA DASK PROJECT
# @author <NAME>
#
# <!--------------------------------------------------------------------------
#
# Copyright (c) 2016-2019,<NAME>.
# All rights reserved.
# Redistribution and use in source and binary forms, ... | 1.1875 | 1 |
randomized_tsp/Genetic.py | akshatkarani/tsp_solver | 1 | 12799381 | import random
from randomized_tsp.utils import cost, random_neighbour, random_tour
def init_population(population_size, num_of_cities):
"""
Initializes the population
"""
population = set()
while len(population) != population_size:
population.add(tuple(random_tour(num_of_cities)))
retu... | 3.671875 | 4 |
taggit/__init__.py | vhf/django-taggit | 0 | 12799382 | VERSION = (0, 12, 1)
| 1.15625 | 1 |
src/QDialog.py | liyu13264/PyQt5_Practice | 0 | 12799383 | <reponame>liyu13264/PyQt5_Practice
import sys
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QDialog, QApplication, QMainWindow, QPushButton
class QDialogDemo(QMainWindow):
def __init__(self):
super(QDialogDemo, self).__init__()
self.button = QPushButton(self)
self.init()
d... | 3.09375 | 3 |
alexa-british-problems.py | Sorsby/alexa-british-problems | 0 | 12799384 | import json
import time
import requests
import unidecode
from flask import Flask
from flask_ask import Ask, question, session, statement
APP = Flask(__name__)
ASK = Ask(APP, "/british_problems")
def get_british_problems():
"""Get the titles of the /r/britishproblems posts"""
user_pass_dict = {... | 2.984375 | 3 |
isic/core/models/base.py | ImageMarkup/isic | 0 | 12799385 | from django.db import models
from django_extensions.db.fields import CreationDateTimeField
from django_extensions.db.models import TimeStampedModel
class CreationSortedTimeStampedModel(TimeStampedModel):
class Meta(TimeStampedModel.Meta):
abstract = True
ordering = ['-created']
get_latest_... | 2.28125 | 2 |
utils/math/distributions.py | david-zwicker/py-utils | 0 | 12799386 | '''
Created on Feb 24, 2015
@author: <NAME> <<EMAIL>>
This module provides functions and classes for probability distributions, which
build upon the scipy.stats package and extend it.
'''
from __future__ import division
import numpy as np
from scipy import stats, special, linalg, optimize
from ..data_structures... | 3.09375 | 3 |
2020/03/ape.py | notxenonbox/adventofcode | 0 | 12799387 | <gh_stars>0
lines = []
with open('input.txt') as f:
lines = f.readlines()
lines = list(map(lambda x: x.strip(), lines))
linelen = len(lines[0])
linec = len(lines)
def check(x, y):
posX = 0
posY = 0
trees = 0
while posY < linec:
if lines[posY][posX % linelen] == '#':
trees += 1
posX+=x
posY+=y
return tr... | 3.34375 | 3 |
shoppingcart/shop/context_processors.py | bsurajbh/shopping-cart | 0 | 12799388 | <filename>shoppingcart/shop/context_processors.py
from .models import Category
def menu_links(request):
"""get menu links"""
links = Category.objects.all()
return dict(links=links)
| 1.90625 | 2 |
explicalib/calibration/evaluation/metrics/classwise/__init__.py | euranova/estimating_eces | 2 | 12799389 | <reponame>euranova/estimating_eces
# -*- coding: utf-8 -*-
"""
@author: nicolas.posocco
"""
from .classwise_ece import classwise_ece
from .classwise_ece_c import classwise_ece_c
from .classwise_ece_a import classwise_ece_a
from .classwise_ece_ac import classwise_ece_ac
| 0.765625 | 1 |
models.py | RahulRagesh/GAT | 1 | 12799390 | from layers import *
from metrics import *
class Model(object):
def __init__(self, **kwargs):
name = kwargs.get('name')
if not name:
name = self.__class__.__name__.lower()
self.name = name
self._LAYER_UIDS = {}
self.vars = {}
self.placeholders = {}
... | 2.453125 | 2 |
build/manage.py | abrahamrhoffman/archangel | 0 | 12799391 | <filename>build/manage.py
import configparser
import subprocess
import argparse
import shutil
import base64
import glob
import sys
import os
import promote
class Manage(object):
def __init__(self, image, verbose=False):
self.init_feedback()
self.verbose = verbose
self.devnull = open(os.d... | 2.296875 | 2 |
voltaire/website/models/users.py | voltaire/website | 1 | 12799392 | from sqlalchemy.dialects.postgresql import UUID
from .. import db
from . import Base
roles = db.Table(
'roles',
db.Column('role_id', UUID, db.ForeignKey('role.id')),
db.Column('user_id', UUID, db.ForeignKey('user.id'))
)
socialmedianetworks = db.Table(
'socialmedianetworks',
db.Column('socialmedi... | 2.5 | 2 |
tests/test_mappedPayload.py | gertschreuder/kinesis-consumer | 0 | 12799393 | #!/usr/bin/env python3
# coding=utf-8
import json
import os
import sys
import unittest
from src.utils.payloadHelper import PayloadHelper
class MappedPayloadTests(unittest.TestCase):
def setUp(self):
pass
def test_hartbeat(self):
script_dir = os.path.dirname(__file__)
rel_path = 'dat... | 2.671875 | 3 |
api/letterjam/word.py | arnehuang/letterjam | 0 | 12799394 | import random
import string
from .player import Player
# from flask import current_app
# from flask_socketio import SocketIO, emit
# socketio = SocketIO(current_app)
# logger = current_app.logger
class Word:
def __init__(self, word: str, player: Player, guesser: Player = None):
self.word = word.upper()
... | 2.796875 | 3 |
scripts/tests/test_migrate_mailing_lists_to_mailchimp_field.py | DanielSBrown/osf.io | 1 | 12799395 | from nose.tools import *
from tests.base import OsfTestCase
from tests.factories import UserFactory
from scripts.migration.migrate_mailing_lists_to_mailchimp_field import main, get_users_with_no_mailchimp_mailing_lists
class TestMigrateMailingLists(OsfTestCase):
def setUp(self):
super(TestMigrateMailingL... | 2.296875 | 2 |
tests/test_transverse_deformation.py | aripekka/tbcalc | 1 | 12799396 | <reponame>aripekka/tbcalc
# -*- coding: utf-8 -*-
"""
Tests for the transverse deformation functions. Run with pytest.
Created on Sat May 9 00:09:00 2020
@author: aripekka
"""
import sys
import os.path
import numpy as np
sys.path.insert(1, os.path.join(os.path.dirname(__file__),'..'))
from tbcalc.transverse_deform... | 2.03125 | 2 |
hotpot/data_handling/squad/squad_data.py | faezezps/SiMQC | 36 | 12799397 | import pickle
from typing import List, Set
from os.path import join, exists, isfile, isdir
from os import makedirs, listdir
from hotpot.config import CORPUS_DIR
from hotpot.configurable import Configurable
from hotpot.data_handling.data import RelevanceQuestion
from hotpot.data_handling.word_vectors import load_word... | 2.421875 | 2 |
src/saturnv_ui/saturnv/ui/presenters/__init__.py | epkaz93/saturnv | 1 | 12799398 | from .basepresenter import BasePresenter, PresenterWidgetMixin
from .mainpresenter import MainPresenter
| 1.03125 | 1 |
image_processing/src/image_processing/image_processing.py | Fricodelco/image_matching | 0 | 12799399 | <reponame>Fricodelco/image_matching
#!/usr/bin/env python3
from cv2 import resize
from numpy import reshape
import rospy
import cv2
import numpy as np
from PIL import Image
import rospkg
import gdal
from dataclasses import dataclass
from geodetic_conv import GeodeticConvert
from decimal import Decimal
import os
from ... | 2.390625 | 2 |
mass_flask_webui/context_processors.py | mass-project/mass_server | 8 | 12799400 | from flask import current_app, render_template, url_for
from markupsafe import Markup
from mass_flask_core.models import FileSample, IPSample, DomainSample, URISample, ExecutableBinarySample, UserLevel
from mass_flask_webui.config import webui_blueprint
@webui_blueprint.context_processor
def sample_processors():
... | 2.234375 | 2 |
tests/test_cases.py | cariad/differently | 0 | 12799401 | <filename>tests/test_cases.py
from os import scandir
from pathlib import Path
from differently import JsonDifferently
def test() -> None:
for directory in scandir(Path() / "tests" / "cases"):
a = JsonDifferently.load(Path(directory) / "a.json")
b = JsonDifferently.load(Path(directory) / "b.json")... | 2.765625 | 3 |
ad_fcemu/nes_cpu_test.py | sisyphus1993/fc-emulator | 0 | 12799402 | <filename>ad_fcemu/nes_cpu_test.py
# -*- coding: utf-8 -*-
import log_differ as ld
import nes_cpu as nc
import nes_file_test as nft
def test_load_nes():
nes = nft.prepared_nes()
mem = nc.Memory(None, None)
mem.load_nes(nes)
if len(nes.prg_rom) == 32 * 1024:
expected = nes.prg_rom
else:
... | 2.328125 | 2 |
04-FaceRecognition-II/thetensorclan-backend-heroku/models/__init__.py | amitkml/TSAI-DeepVision-EVA4.0-Phase-2 | 1 | 12799403 | from .utils import get_classifier, MODEL_REGISTER | 1.0625 | 1 |
Code_Challenges/bubble_sort.py | fuse999/Python_Sandbox | 0 | 12799404 | import math
import os
import random
import re
import sys
a = [6, 4, 1]
# Complete the countSwaps function below.
def countSwaps(a):
n = len(a)
swapcount = 0
for i in range(n):
for j in range(0, n-i-1):
if a[j] > a[j+1]:
swapcount += 1
a[j], a[j+1] = a[... | 3.484375 | 3 |
pets/models.py | guipeeix7/website | 6 | 12799405 | from users.models import User
from django.db import models
PET_SIZES = [('P', 'Pequeno'), ('M', 'Médio'), ('G', 'Grande')]
PET_SEX = [('M', 'Macho'), ('F', 'Fêmea')]
# PET TYPE
GATO = 'Gato'
CACHORRO = 'Cachorro'
PASSARO = 'Pássaro'
ROEDOR = 'Roedor'
OUTRO = 'Outro'
# DEFAULT
DE00 = 'Sem raça definida'
DE01 = '... | 1.914063 | 2 |
2018/03/intact.py | jhnesk/advent-of-code | 0 | 12799406 | <filename>2018/03/intact.py
#!/usr/bin/env python3.7
import sys
lines = [claim.rstrip('\n') for claim in open(sys.argv[1])]
canvas = [[0 for x in range(1000)] for y in range(1000)]
for claim in lines:
x = int(claim.split(' ')[2].split(',')[0])
y = int(claim.split(' ')[2].split(',')[1][:-1])
a = int(claim... | 3.03125 | 3 |
ripiu/djangocms_aoxomoxoa/admin/options/navigation.py | ripiu/djangocms_aoxomoxoa | 0 | 12799407 | <reponame>ripiu/djangocms_aoxomoxoa
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
class TilesGridNavigationUniteOptionsAdmin(admin.ModelAdmin):
'''
Tiles - Grid
'''
fieldsets = (
(_('Navigation options'), {
'classes': ('collapse',),
... | 1.75 | 2 |
engine/modularity.py | tchimih/NSD_project | 1 | 12799408 | <reponame>tchimih/NSD_project
import networkx as nx
# All rights are reserved to the authors ... I only used a span of his code :)
__author__ = """<NAME> (<EMAIL>)"""
def modularity(partition, graph, weight='weight'):
"""Compute the modularity of a partition of a graph
Parameters
----------
partitio... | 2.890625 | 3 |
ea_sim/utils.py | lis-epfl/Tensoft-G21 | 1 | 12799409 | <filename>ea_sim/utils.py<gh_stars>1-10
import os
import json
import pickle
import sqlite3
import numpy as np
import matplotlib
# select matplotlib backend
matplotlib.use('pdf')
import matplotlib.pyplot as plt
from params_conf import N_MODULES, STIFF_TABLE
# ================================== #
# Utils fu... | 2.3125 | 2 |
Card.py | Ilphrin/TuxleTriad | 1 | 12799410 | # coding: utf-8
import pygame
import os
from functions import *
from color import *
from pygame.locals import *
from listOfCards import allCards, values
from About import About
from Text import *
from color import *
class Card(pygame.sprite.Sprite):
"""Manages the cards in the game"""
def __init__(self, numb... | 3.453125 | 3 |
tests/unit/stream_alert_alert_processor/test_outputs.py | ashmere/streamalert | 1 | 12799411 | <filename>tests/unit/stream_alert_alert_processor/test_outputs.py<gh_stars>1-10
"""
Copyright 2017-present, Airbnb Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/lice... | 1.789063 | 2 |
code/lstm_without_peephole.py | sanketkalwar/LSTM | 1 | 12799412 | <filename>code/lstm_without_peephole.py
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
plt.ion()
dataset = open('../data/input.txt','r').read()
#dataset = open('../data/code.txt','r').read()
len_of_dataset = len(dataset)
print('len of dataset:',len_of_dataset)
vocab = set(d... | 3.234375 | 3 |
dataStructures/tree.py | auxsophia/Spellbook | 0 | 12799413 | '''
Terminology used in trees
Root
The top node in a tree.
Child
A node directly connected to another node when moving away from the root.
Parent
The converse notion of a child.
Siblings
A group of nodes with the same parent.
Descendant
A node reachable by repeated proceeding from parent to child. Also known as subchil... | 3.5 | 4 |
get_random_quote/migrations/0017_auto_20200525_0235.py | helloprash/birthday | 0 | 12799414 | <gh_stars>0
# Generated by Django 3.0.3 on 2020-05-24 21:05
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('get_random_quote', '0016_auto_20200525_0146'),
]
operations = [
migrations.RenameField(
model_name='quote',
old_... | 1.625 | 2 |
selenium_pipeline/screenshot_with_sel.py | Praneethvvs/CircleCi_FastApi | 0 | 12799415 | <reponame>Praneethvvs/CircleCi_FastApi<gh_stars>0
from time import sleep
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium import webdriver
sleep(5)
def screenshot_main():
driver = webdriver.Remote("http://:4444/wd/hub",desired_capabilities=DesiredCapabilities.CHROME)
... | 2.765625 | 3 |
sss/sss.py | TAMU-CSE/mitre-ectf2021 | 1 | 12799416 | <filename>sss/sss.py
#!/usr/bin/python3
# 2021 Collegiate eCTF
# SCEWL Security Server
# <NAME>
#
# (c) 2021 The MITRE Corporation
#
# This source file is part of an example system for MITRE's 2021 Embedded System CTF (eCTF).
# This code is being provided only for educational purposes for the 2021 MITRE eCTF competiti... | 2.0625 | 2 |
data_gen.py | amahendra98/ga-pytorch | 2 | 12799417 | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import torch
from torch.utils.data import Dataset
from sklearn.model_selection import train_test_split
# Define the class for the Meta-material dataset
class MetaMaterialDataSet(Dataset):
""" The Meta Material Dataset Class """
def __init__... | 2.953125 | 3 |
test/core_tests/test_params_object.py | RobinDePauw/talos | 0 | 12799418 | <filename>test/core_tests/test_params_object.py
import talos as ta
def test_params_object():
'''Tests the object from Params()'''
print('Start testing Params object...')
p = ta.Params()
# without arguments
p.activations()
p.batch_size()
p.dropout()
p.epochs()
p.kernel_initiali... | 2.46875 | 2 |
FBG_ReStrain_Python/Load_Sync.py | GilmarPereira/ReStrain | 0 | 12799419 | <reponame>GilmarPereira/ReStrain
""" Python Class To Load and Sync two files: Thermocouple and FBG
Copyright (C) <NAME>
2015 DTU Wind Energy
Author: <NAME>
Email: <EMAIL>; <EMAIL>
Last revision: 02-08-2016
***License***:
This file is part of FBG_ReStrain.
FBG_ReStrain is free software: you can redistribute it and/... | 2.125 | 2 |
PiGPIO/migrations/0007_programlog.py | girisandeep/Django-PiGPIO | 8 | 12799420 | <reponame>girisandeep/Django-PiGPIO<filename>PiGPIO/migrations/0007_programlog.py
# Generated by Django 2.1.7 on 2019-03-25 23:17
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('PiGPIO', '0006_program_logging'),
]
... | 1.96875 | 2 |
tests/scripts/unicode💩.py | benfred/py-spy | 8,112 | 12799421 | <filename>tests/scripts/unicode💩.py<gh_stars>1000+
#!/env/bin/python
# -*- coding: utf-8 -*-
import time
def function1(seconds):
time.sleep(seconds)
if __name__ == "__main__":
function1(100)
| 1.640625 | 2 |
chart/repl/src/python/sseq_display.py | JoeyBF/sseq | 7 | 12799422 | <reponame>JoeyBF/sseq
from js import (
location,
console
)
from js_wrappers.async_js import Fetcher
from js_wrappers.filesystem import FileHandle
import json
import pathlib
from spectralsequence_chart import SseqChart
from spectralsequence_chart.serialization import JSON
from working_directory... | 2.578125 | 3 |
aiocloudflare/api/zones/spectrum/analytics/events/summary/summary.py | Stewart86/aioCloudflare | 2 | 12799423 | from aiocloudflare.commons.auth import Auth
class Summary(Auth):
_endpoint1 = "zones"
_endpoint2 = "spectrum/analytics/events/summary"
_endpoint3 = None
| 1.179688 | 1 |
2021/22b.py | msullivan/advent-of-code | 8 | 12799424 | <filename>2021/22b.py
#!/usr/bin/env python3
from __future__ import annotations
import sys
import re
from dataclasses import dataclass
from typing import List, NamedTuple, Tuple, Set
def extract(s):
return [int(x) for x in re.findall(r'(-?\d+).?', s)]
class Pos(NamedTuple):
x: int
y: int
z: int
... | 2.796875 | 3 |
Knowledge test/11 - Decomposition.py | davwheat/btec-python-challenges | 0 | 12799425 | # Read the problem below and then implement it in code. You do not need to submit your
# written decomposition of how you’ve worked it out but make sure to comment your code
# to explain what you’ve done.
#
# A computer generates a random number from 0 – 10. It then asks the user to make a
# guess. They have 5 attempt... | 4.25 | 4 |
msldap/external/asciitree/asciitree/traversal.py | zhuby1973/msldap | 79 | 12799426 | <gh_stars>10-100
from .util import KeyArgsConstructor
class Traversal(KeyArgsConstructor):
"""Traversal method.
Used by the tree rendering functions like :class:`~asciitree.LeftAligned`.
"""
def get_children(self, node):
"""Return a list of children of a node."""
raise NotImplementedE... | 3.671875 | 4 |
weboauth2/apps/oauth2/views/app.py | askar-alty/oauth2 | 1 | 12799427 | from django.urls import reverse_lazy
from oauth2_provider import views
from .. import mixins
class ApplicationList(mixins.TwoFactorMixin, mixins.ApplicationViewMixin, views.ApplicationList):
template_name = 'oauth2/applications/list.html'
class ApplicationRegistration(mixins.ApplicationCreationMixin, mixins.Tw... | 2.0625 | 2 |
modules/clan.py | mrhappyasthma/HoN-Trivia-Bot | 9 | 12799428 | # -*- coding: utf8 -*-
from hon.packets import ID
def setup(bot):
bot.config.module_config('welcome_members',[1,'Will welcome members in /c m if set to non-zero value'])
bot.config.module_config('officers', [[], 'Officers alts'])
bot.config.module_config('allowdnd', [[], 'Allowed to use DND command'])
... | 2.265625 | 2 |
demo/doctype/task.py | Nikhil9168/demo | 0 | 12799429 | import frappe
def execute():
a=frappe.new_doc("Task")
a.subject='axy'
a.save()
print(a.name)
# #bench execute demo.doctype.task.execute
# print('***************') | 1.71875 | 2 |
tests/messages/data/project/_hidden_by_default/hidden_file.py | kolonialno/babel | 1 | 12799430 | from gettext import gettext
def foo():
print(gettext('ssshhh....'))
| 1.773438 | 2 |
assets/nurses_2/widgets/_root.py | Reverend-Toady/Duck-Builder | 1 | 12799431 | import numpy as np
from ..colors import Color
from .widget import Widget, overlapping_region
from .widget_data_structures import Point, Size, Rect
class _Root(Widget):
"""
Root widget. Meant to be instantiated by the `App` class. Renders to terminal.
"""
def __init__(self, app, env_out, default_char,... | 2.546875 | 3 |
slashdot_news_aggregate.py | tmzwane/Slashdot_News_Aggregate | 1 | 12799432 | import re
import time
from datetime import datetime
import urllib
import mechanicalsoup
import getpass
from bs4 import BeautifulSoup
# Conver Time Function
def convertTime(time):
try:
time = time.replace(",","").replace("@","").replace("."," ").replace(":"," ")
t2 = datetime.strptime(time[3:], "%A... | 3.046875 | 3 |
tests/test_environ.py | cheremnov/bddcli | 5 | 12799433 | import os
from bddcli import Given, stdout, Application, when, given
def foos(): # pragma: no cover
e = os.environ.copy()
# For Linux and Windows
discarded_variables = ['LC_CTYPE', 'PWD',
'COMSPEC', 'PATHEXT', 'PROMPT', 'SYSTEMROOT']
# Windows environment variables are cas... | 2.515625 | 3 |
VEnCode_Django/settings/production.py | AndreMacedo88/VEnCode-Web | 0 | 12799434 | from .base import *
import dj_database_url
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['*']
# If DEBUG is False, send the errors to the email:
ADMINS = [
('Andre', '<EMAIL>'),
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenois... | 1.96875 | 2 |
openpnm/contrib/_transient_multiphysics.py | xu-kai-xu/OpenPNM | 2 | 12799435 | import logging
import numpy as np
from openpnm.utils import SettingsAttr, Docorator
from openpnm.integrators import ScipyRK45
from openpnm.algorithms import GenericAlgorithm
from openpnm.algorithms._solution import SolutionContainer, TransientSolution
logger = logging.getLogger(__name__)
docstr = Docorator()
@docstr.... | 2.46875 | 2 |
Python/Buch_ATBS/Teil_1/Kapitel_06_Stringbearbeitung/05_formatierte_ausgabe.py | Apop85/Scripts | 0 | 12799436 | # Formatierte Stringausgabe
dic={'Käse' : 5, 'Brot' : 3, 'Wein' : 2,
'Eier' : 6, 'Nuss' : 12, 'Tee' : 14,
'Müsli' : 1}
print(('Inventar'.center(16, '#')).center(60))
for namen, anzahl in dic.items():
print((namen.ljust(13, '.') + str(anzahl).rjust(3, '.')).center(60))
print(('#'.center(16, '#')).cente... | 3.515625 | 4 |
shorty/config/parser.py | dennisxtria/shorty | 0 | 12799437 | <filename>shorty/config/parser.py
import json
import sys
from pathlib import Path
def create_config():
"""
Creates a merged dictionary between the `config.json` and
the respective environment's config, by merging them.
Sidenote: the implementation for the generic access token
was made ... | 3.15625 | 3 |
mmdeploy/codebase/mmocr/models/text_recognition/sar_encoder.py | zhiqwang/mmdeploy | 746 | 12799438 | # Copyright (c) OpenMMLab. All rights reserved.
import mmocr.utils as utils
import torch
import torch.nn.functional as F
from mmdeploy.core import FUNCTION_REWRITER
@FUNCTION_REWRITER.register_rewriter(
func_name='mmocr.models.textrecog.encoders.SAREncoder.forward',
backend='default')
def sar_encoder__forwar... | 2.265625 | 2 |
tests/test_node_expand.py | spyysalo/wikitextprocessor | 38 | 12799439 | # Tests for WikiText parsing
#
# Copyright (c) 2020-2021 <NAME>. See file LICENSE and https://ylonen.org
import unittest
from wikitextprocessor import Wtp
from wikitextprocessor.parser import (print_tree, NodeKind, WikiNode)
def parse_with_ctx(title, text, **kwargs):
assert isinstance(title, str)
assert isi... | 2.84375 | 3 |
algorithm/leetcode/Python_2.7.10/00004.py | leonard-sxy/algorithm-practice | 1 | 12799440 | <reponame>leonard-sxy/algorithm-practice<gh_stars>1-10
#
## https://leetcode.com/problems/median-of-two-sorted-arrays/
#
class Solution(object):
def findMedianSortedArrays(self, nums1, nums2):
"""
:type nums1: List[int]
:type nums2: List[int]
:rtype: float
"""
if nums1 is None or nums2 is Non... | 3.578125 | 4 |
cogs/utility.py | ldgregory/bishbot | 0 | 12799441 | <reponame>ldgregory/bishbot
#! /usr/bin/env python3
"""
Bishbot - https://github.com/ldgregory/bishbot
<NAME> <<EMAIL>>
fun.py v0.1
Tested to Python v3.7.3
Description:
Fun commands for everyone
Changelog:
20210606 - Fixed members command for intents
20200522 - Initial code
Copyright 2020 <NAME>
Licensed under t... | 1.929688 | 2 |
MessengerCounter.py | KMChris/messenger-counter | 2 | 12799442 | import collections
import io
import json
import math
import zipfile
import logging
from urllib.error import URLError
from urllib.request import urlopen
import pandas as pd
from matplotlib import pyplot as plt
# Getting data
def set_source(filename):
"""
Sets source global variable to the path of .zip file.
... | 3.109375 | 3 |
tests/unit/selection/factories/test_expand_path_cfg.py | shane-breeze/AlphaTwirl | 0 | 12799443 | <filename>tests/unit/selection/factories/test_expand_path_cfg.py<gh_stars>0
# <NAME> <<EMAIL>>
import os
import sys
import pytest
from alphatwirl.selection.factories.expand import expand_path_cfg
from alphatwirl.selection.factories.factory import FactoryDispatcher
from alphatwirl.selection.modules.LambdaStr import La... | 2.15625 | 2 |
terbilang.py | Ellenn01/Tugas-pertemuan-12 | 0 | 12799444 | <reponame>Ellenn01/Tugas-pertemuan-12
import os
kata = ['', 'one', 'two', 'tree', 'four', 'five', 'six', 'seven', 'eight', 'nine']
def terbilang (n) :
if n < 10 :
return kata [n]
elif n >= 1_000_000_000 :
return terbilang (n // 1_000_000_000) + ' billion ' + (terbilang(n % 1_000_000_0... | 3.75 | 4 |
graph_builder/parse_osm_xml.py | rkalz/MyBhamMap | 2 | 12799445 | import xml.etree.ElementTree as et
from objects.node import Node
from objects.way import Way
def extract_road(item, roads):
way_id = int(item.attrib['id'])
way = Way(way_id)
is_highway = False
for child in item:
if child.tag == "nd":
way.add_node(int(child.attrib['ref']))
... | 2.75 | 3 |
code/sample_2-1-20.py | KoyanagiHitoshi/AtCoder-Python-Introduction | 1 | 12799446 | <filename>code/sample_2-1-20.py
print(7/3)
| 0.980469 | 1 |
linearRegression/linearReg.py | zzw0929/deeplearning | 4 | 12799447 | <filename>linearRegression/linearReg.py
# coding: utf-8
import numpy as np
from numpy import *
import math
import sys
def loadDataSet(filename):
f = open(filename)
lines = f.readlines()
dataSet = []
labels = []
for i in lines:
i = i.strip()
cols = i.split("\t")
dataSet.ap... | 3.1875 | 3 |
cadishi/dict_util.py | bio-phys/cadishi | 14 | 12799448 | <filename>cadishi/dict_util.py
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding: utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 fileencoding=utf-8
#
# Cadishi --- CAlculation of DIStance HIstograms
#
# Copyright (c) <NAME>, <NAME>
# See the file AUTHORS.rst for the full list of contributo... | 3.3125 | 3 |
tableview/__init__.py | ryansturmer/tableview | 1 | 12799449 | <reponame>ryansturmer/tableview<gh_stars>1-10
from core import (TableView, load, loads, __version__)
| 0.832031 | 1 |
grocercheck/scripts/lazy_coding_scripts/generateCodeForModel.py | andy0liang/GrocerCheck | 0 | 12799450 | <filename>grocercheck/scripts/lazy_coding_scripts/generateCodeForModel.py
days = ["mon",'tue','wed','thu','fri','sat','sun']
for day in days:
for i in range(0,24):
if(i<10):
i = '0'+str(i)
else:
i = str(i)
print(day+i+' = models.IntegerField(null=True)')
| 2.796875 | 3 |