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 |
|---|---|---|---|---|---|---|
pineboolib/plugins/sql/flqpsql2.py | deavid/pineboo | 2 | 12768251 | from pineboolib import logging
from pineboolib.application.utils.check_dependencies import check_dependencies
from sqlalchemy import create_engine # type: ignore
from PyQt5.Qt import qWarning # type: ignore
from PyQt5.QtWidgets import QMessageBox, QWidget # type: ignore
from pineboolib.plugins.sql.flqpsql import F... | 2.125 | 2 |
resources/libraries/python/honeycomb/HcAPIKwBridgeDomain.py | preym17/csit | 0 | 12768252 | <filename>resources/libraries/python/honeycomb/HcAPIKwBridgeDomain.py
# Copyright (c) 2018 Cisco and/or its affiliates.
# 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.apach... | 2.15625 | 2 |
lib/matplotlib/tests/test_gridspec.py | jbbrokaw/matplotlib | 113 | 12768253 | import matplotlib.gridspec as gridspec
from nose.tools import assert_equal
def test_equal():
gs = gridspec.GridSpec(2, 1)
assert_equal(gs[0, 0], gs[0, 0])
assert_equal(gs[:, 0], gs[:, 0])
| 2.125 | 2 |
WiiBin.py | idaholab/WiiBin | 10 | 12768254 | #Copyright 2020 Battelle Energy Alliance, LLC, ALL RIGHTS RESERVED.
#Buffered File with 0x00's
#Offset measured from center of chunk
#Adjustable slide %
#Added .Net Bytecode
#Added startup Notes
#Additional Error checking
#Added DotNet Bytecode
#Added Compiler Detection
#Added Percent Compressed or Encrypted
from tki... | 2.078125 | 2 |
examples/password_git.py | qualichat/questionary | 851 | 12768255 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
"""Example for a password question type.
Run example by typing `python -m examples.password` in your console."""
from pprint import pprint
import questionary
from examples import custom_style_dope
from questionary import Separator, Choice, prompt
def ask_pystyle(**kwargs):... | 3.125 | 3 |
bin/bactopia-stats.py | bactopia/bactopia-wdl | 0 | 12768256 | #! /usr/bin/env python3
"""
usage: bactopia-stats [-h] STR STR
bactopia-stats - Ouput files to be used by Bactopia-WDL
positional arguments:
STR Directory where Bactopia outputs are.
STR Sample name used in Bactopia run
optional arguments:
-h, --help show this help message and exit
"""
import ... | 3.046875 | 3 |
Stack/402. Remove K Digits.py | Into-Y0u/Github-Baby | 2 | 12768257 | <gh_stars>1-10
class Solution:
def removeKdigits(self, num: str, k: int) -> str:
if len(num) == 0 and len(num) <= k :
return "0"
st = [num[0]]
i = 1
while i < len(num):
while len(st) > 0 and int(st[-1]) > int(num[i]) and k > 0:
st.pop... | 3.109375 | 3 |
main.py | Kazumasan/ulauncher-sessions | 2 | 12768258 | <reponame>Kazumasan/ulauncher-sessions
import os
import subprocess
import json
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk
from helpers import *
from ulauncher.api.client.EventListener import EventListener
from ulauncher.api.client.Extension import Extension
from ulauncher.api.shared.ac... | 1.976563 | 2 |
configlib/conftypes.py | ddorn/pyconfiglib | 1 | 12768259 | <gh_stars>1-10
import json
import click
from typing import TYPE_CHECKING
if TYPE_CHECKING:
import configlib
def is_valid(instance, type_):
if isinstance(type_, ConfigType):
return type_.is_valid(instance)
return isinstance(instance, type_)
class ConfigType(click.ParamType):
name = 'any'
... | 2.984375 | 3 |
main.py | seunghaekim/achapters003-ggded | 0 | 12768260 | import BartlebyMachine.main as bartleby
import BartlebyMachine.book as book
bartleby = bartleby.Bartleby()
bartleby.addTableOfContent('toc.ggded.yaml')
bartleby.markdownToLatex()
bartleby.writeLatex()
| 1.421875 | 1 |
train.py | jimmyyhwu/spatial-action-maps | 21 | 12768261 | # Adapted from https://pytorch.org/tutorials/intermediate/reinforcement_q_learning.html
import argparse
import random
import sys
import time
from collections import namedtuple
from pathlib import Path
# Prevent numpy from using up all cpu
import os
os.environ['MKL_NUM_THREADS'] = '1' # pylint: disable=wrong-import-po... | 2.34375 | 2 |
newsfeed/settings/production.py | mccarrion/newsfeed-django | 2 | 12768262 | """
These are the production settings for this Django project.
"""
import logging
from .base import *
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = os.getenv('SECRET_KEY')
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
# SECURITY WARNING: If you depl... | 1.679688 | 2 |
trypython/stdlib/dataclasses_/dataclasses02.py | devlights/try-python | 4 | 12768263 | """
dataclasses モジュールのサンプルです.
fronzen プロパティの指定について
REFERENCESS:: http://bit.ly/2KTZynw
http://bit.ly/2KJCnwk
http://bit.ly/2KHeNA9
http://bit.ly/2KFLGxc
"""
import dataclasses as dc
from trypython.common.commoncls import SampleBase
from trypython.common.commonfunc import pr
... | 3.3125 | 3 |
manage.py | ponyatov/laguna | 0 | 12768264 | <reponame>ponyatov/laguna
# powered by metaL: https://github.com/ponyatov/metaL/wiki/metaL-manifest
# \ <section:top>
import os
import sys
import config
# / <section:top>
# \ <section:mid>
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'proj.settings')
from django.core.management import execute_from_co... | 1.71875 | 2 |
Chapter09/filewrite1.py | LuisPereda/Learning_Python | 0 | 12768265 | file_input = open("motivation.txt",'w')
file_input.write("Never give up")
file_input.write("\nRise above hate")
file_input.write("\nNo body remember second place")
file_input.close() | 2.625 | 3 |
biosys/apps/main/api/urls.py | parksandwildlife/biosys | 2 | 12768266 | <reponame>parksandwildlife/biosys<filename>biosys/apps/main/api/urls.py
from __future__ import absolute_import, unicode_literals, print_function, division
from django.conf.urls import url
from rest_framework import routers
from rest_framework.authtoken.views import obtain_auth_token
from djoser import views as djoser_... | 1.890625 | 2 |
setup.py | john-veillette/pymc-learn | 187 | 12768267 | <gh_stars>100-1000
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
# from builtins import *
from codecs import open
from os.path import realpath, dirname, join
from setuptools import setup, find_packages
import sys
import re
DISTNAME = 'pymc-learn'
DESCRIPT... | 1.890625 | 2 |
Tests/testData.py | juanluislm/GPy-ABCD | 0 | 12768268 | import numpy as np
import scipy.io as sio
from GPy_ABCD.Models.modelSearch import *
from testConsistency import save_one_run
if __name__ == '__main__':
# np.seterr(all='raise') # Raise exceptions instead of RuntimeWarnings. The exceptions can then be caught by the debugger
datasets = ['01-airline', '02-sola... | 1.914063 | 2 |
model/discriminator.py | azraelkuan/univnet | 83 | 12768269 | import torch
import torch.nn as nn
from .mpd import MultiPeriodDiscriminator
from .mrd import MultiResolutionDiscriminator
from omegaconf import OmegaConf
class Discriminator(nn.Module):
def __init__(self, hp):
super(Discriminator, self).__init__()
self.MRD = MultiResolutionDiscriminator(hp)
... | 2.3125 | 2 |
Python Fundamentals/Regular Expressions/Lab/Task01_02.py | IvanTodorovBG/SoftUni | 1 | 12768270 | import re
data = input()
pattern = r"\b([A-Z][a-z]+)\s([A-Z][a-z]+)\b"
matches = re.finditer(pattern, data)
for match in matches:
print(match.group(), end=" ")
| 3.921875 | 4 |
kindeditor/__version__.py | waketzheng/django-kindeditor | 4 | 12768271 | __title__ = "django-kindeditor"
__description__ = "Django admin KindEditor integration."
__url__ = "https://github.com/waketzheng/django-kindeditor"
__version__ = "0.3.0"
__author__ = "<NAME>"
__author_email__ = "<EMAIL>"
__license__ = "MIT"
__copyright__ = "Copyright 2019 Waket Zheng"
| 1.15625 | 1 |
sum/rankingTFIDF.py | zhangyuchen584/pushkin_gs | 0 | 12768272 | # -*- coding: utf-8 -*-
__author__ = "Yuchen"
__aim__ = 'rank top sentences in one topic'
__testCase__ = "../test/test_rankingTFIDF.py"
from sklearn.feature_extraction.text import CountVectorizer,TfidfTransformer
import sys
import argparse
import numpy as np
from termcolor import colored
from sklearn.metrics.pairwise ... | 2.890625 | 3 |
telegram_payment_bot/member/members_payment_getter.py | ebellocchia/telegram_payment_bot | 3 | 12768273 | # Copyright (c) 2021 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, ... | 1.609375 | 2 |
python/GafferTest/TestRunner.py | Tuftux/gaffer | 31 | 12768274 | ##########################################################################
#
# Copyright (c) 2019, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistrib... | 0.945313 | 1 |
mongoDB_management.py | jcamstan3370/MachineLearningPerovskites | 6 | 12768275 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: Jared
"""
import pandas as pd
import pymongo
import json
from os import listdir
from os.path import isfile, join
import multiprocessing as mp
import numpy as np
import dbConfig
from builder.dummyCrystalBuilder import processDummyCrystals
from ml.feature impo... | 2.28125 | 2 |
ama_speech.py | UncleEngineer/AMAShop | 2 | 12768276 | #ama_speech.py
import speech_recognition as spr
from gtts import gTTS
from playsound import playsound
from googletrans import Translator
import googletrans
import time
def RecognizeAndSpeech(sound1='th',sound2='zh-cn'):
time.sleep(2)
print('Recognizing..')
#print(googletrans.LANGUAGES)
##### RECOGN... | 3.1875 | 3 |
src/kgmk/sample/enum_sample.py | kagemeka/python | 0 | 12768277 | from enum import (
Enum,
auto,
unique,
IntEnum,
Flag,
IntFlag,
)
import enum
@unique
class Color(Enum):
RED = auto()
BLUE = auto()
YELLOW = "yellow"
CYAN = 3
GREEN = auto()
print(Color.RED.value)
print(Color.GREEN.value) | 3.65625 | 4 |
tests_functional/test_config_sync/test_config_sync.py | brailovskiy/grpc-test | 0 | 12768278 | import pytest
import allure
from hamcrest import *
from shared.data_generators import Generators
@allure.issue("SAN-71", "Drafts")
@pytest.mark.parametrize('d_user', ["2 users"], indirect=True)
class TestConfigSync:
""" Tests for synchronization, setting and getting configs
"""
@allure.title("Test for dr... | 1.945313 | 2 |
src/image_processor/bounding_box.py | salieri/2d-enhance | 0 | 12768279 |
class BoundingBox:
x: int
y: int
x2: int
y2: int
cx: int
cy: int
width: int
height: int
def __init__(self, x: int, y: int, width: int, height: int):
self.x = x
self.y = y
self.width = width
self.height = height
self.x2 = x + width - 1
... | 3.515625 | 4 |
temperature_program.py | denislavdenov/python-book | 0 | 12768280 | <reponame>denislavdenov/python-book
#!/usr/bin/env python3
def convert_to_celsius(fahrenheit: float) -> float:
return (fahrenheit - 32.0) * 5.0 / 9.0
def above_freezing(celsius: float) -> bool:
return celsius > 0
fahrenheit = float(input('Enter the temperature in degrees Fahrenheit: '))
celsius = convert_t... | 4.25 | 4 |
samples/sampleLib.py | big-main/vm-automation | 1 | 12768281 | import json
def checkForProcess(vmObject, processName):
vmObject.updateProcList()
if processName in ' '.join(vmObject.procList):
return True
else:
return False
def loadJsonFile(fileName):
try:
fileObject = open(fileName, 'r')
fileStr = fileObject.read()
fileObje... | 2.40625 | 2 |
exercisio23.py | bruno194/EXERCICIOS | 1 | 12768282 | <reponame>bruno194/EXERCICIOS
numero = str(input('digite um numero'))
print('unidade: {}'.format(numero[1]))
print('dezena: {}'.format(numero[2]))
print('centena: {} '.format(numero[3]))
print('unidade de milhar: {}'.format(numero[4]))
| 3.875 | 4 |
src/Statistics_TechIndicators/CalcTechIndictors.py | zmcx16/AxisTradeCult | 35 | 12768283 | <reponame>zmcx16/AxisTradeCult<gh_stars>10-100
import pandas
import numpy
def GetRollingMean(values, window):
return pandas.Series.rolling(values, window = window, center = False).mean()
def GetRollingStd(values, window):
return pandas.Series.rolling(values, window = window, center = False).std()
def GetRol... | 2.234375 | 2 |
db_migrations/versions/7404cf411ca9_init.py | HBPSP8Repo/i2b2-setup | 0 | 12768284 | <filename>db_migrations/versions/7404cf411ca9_init.py
"""init
Revision ID: 7404cf411ca9
Create Date: 2017-02-16 11:22:22.388919
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
... | 1.875 | 2 |
mysql_dbcon.py | uniaim-event-team/pullre-kun | 3 | 12768285 | import codecs
from typing import Optional
from sqlalchemy.engine import create_engine
from config import webapp_settings
from model import Session
codecs.register(
lambda name: codecs.lookup('utf8') if name == 'utf8mb4' else None)
class ConnectionPooling(object):
def __init__(self, **params):
self.... | 2.40625 | 2 |
train_rl_MMI.py | eyalbd2/LanguageModel-UsingRL | 6 | 12768286 | <reponame>eyalbd2/LanguageModel-UsingRL
import os
import random
import logging
import numpy as np
from tensorboardX import SummaryWriter
import torch
import torch.optim as optim
import torch.nn.functional as F
import argparse
from libbots import data, model, utils
from model_test import run_test_mutual
device = tor... | 2.0625 | 2 |
mdit_py_plugins/wordcount/__init__.py | cjolowicz/mdit-py-plugins | 32 | 12768287 | <filename>mdit_py_plugins/wordcount/__init__.py
import string
from typing import Callable, List
from markdown_it import MarkdownIt
from markdown_it.rules_core import StateCore
def basic_count(text: str) -> int:
"""Split the string and ignore punctuation only elements."""
return sum([el.strip(string.punctuati... | 2.71875 | 3 |
python_module/megengine/_internal/version.py | stoneMo/MegEngine | 2 | 12768288 | <filename>python_module/megengine/_internal/version.py
# -*- coding: utf-8 -*-
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2020 Megvii Inc. All rights reserved.
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the Licens... | 2.046875 | 2 |
test/test_lifescan.py | garberw/glucometerutils_gw | 1 | 12768289 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""Tests for the LifeScan OneTouch Ultra Mini driver."""
__author__ = '<NAME>'
__email__ = '<EMAIL>'
__copyright__ = 'Copyright © 2013-2017, <NAME>'
__license__ = 'MIT'
import array
import os
import sys
import unittest
sys.path.append(os.path.dirname(os.path.dirname(os.path.abs... | 2.03125 | 2 |
Algorithms/GraphAlgorithms/floydwarshall.py | abhijit-c/AlgorithmsTopicReview | 0 | 12768290 | <filename>Algorithms/GraphAlgorithms/floydwarshall.py
def floydwarshall(G):
"""
Compute and return the all pairs shortest paths solution.
Notice the returned path cost matrix P has modified entries. For
example, P[i][j] contains a tuple (c, v1) where c is the cost of the
shortest path from i to j, a... | 3.921875 | 4 |
openclean/data/serialize.py | remram44/openclean-core | 4 | 12768291 | <gh_stars>1-10
# This file is part of the Data Cleaning Library (openclean).
#
# Copyright (C) 2018-2021 New York University.
#
# openclean is released under the Revised BSD License. See file LICENSE for
# full license details.
from histore.archive.serialize.base import COMPACT # noqa: F401
from histore.document.json... | 1.210938 | 1 |
peaksIdentification/peacks_testannotated.py | andreagia/peaks-identification | 0 | 12768292 | <filename>peaksIdentification/peacks_testannotated.py
import numpy as np
import sys
import re
import plotly.express as px
import pandas as pd
import plotly.graph_objects as go
# from peaksIdentification.peaks_assignement import generate_data, reassign_peaks
from core.peak_manager_V2 import PeakManager, Spectra
class ... | 2.46875 | 2 |
schemas/sav_15.py | SathyaBhat/hades_save_editor | 49 | 12768293 | <filename>schemas/sav_15.py
import zlib
from construct import *
from constant import FILE_SIGNATURE, SAVE_DATA_V15_LENGTH
sav15_save_data_schema = Struct(
"version" / Int32ul,
"location" / PascalString(Int32ul, "utf8"),
"runs" / Int32ul,
"active_meta_points" / Int32ul,
"active_shrine_points" / In... | 1.9375 | 2 |
visual/polyFit.py | dparnold/data-analysis | 0 | 12768294 | def polyFit(xData, yData, degree):
pass
fitValues = np.polyfit(xData, yData, degree)
yFit = np.zeros(len(xData))
for i in range(degree+1):
yFit = yFit + xData**(degree-i)*fitValues[i]
def function(x):
func = 0
for i in fitValues:
func = func*x + i
return f... | 3.765625 | 4 |
Population.py | MarcusRainbow/EconomySimulation | 0 | 12768295 | <reponame>MarcusRainbow/EconomySimulation<filename>Population.py
import random
import math
import numpy as np
from typing import Callable, Tuple, List
import matplotlib.pyplot as plt
def simulation(
simulations: int,
draws: int,
population: int,
game: Callable) -> Tuple[List[float], List[f... | 4.0625 | 4 |
todo/migrations/0012_filer_file_20201217_1211.py | paiuolo/django-todo | 0 | 12768296 | # Generated by Django 2.2.16 on 2020-12-17 12:11
from django.db import migrations, models
import django.db.models.deletion
import filer.fields.file
import todo.models
import todo.storage
class Migration(migrations.Migration):
dependencies = [
('filer', '0012_file_mime_type'),
('todo', '0011_auto... | 1.648438 | 2 |
server/src/repositories/FilmTop5.py | alexfire008/centrale | 1 | 12768297 | <reponame>alexfire008/centrale<gh_stars>1-10
""" Defines the User repository """
from models import Notation
from models import db
from sqlalchemy import func
class FilmTop5Repository:
"""The repository for the notation average truc"""
@staticmethod
def get():
return db.session.query(Notation.mo... | 2.375 | 2 |
Python/binary_search.py | cavigna/Sort_Order | 0 | 12768298 | def binary_search(array: list, valor_buscado, inicio=0, fin=None):
if fin == None:
fin = len(array)-1
if inicio > fin:
return f"No se encontró el valor: {valor_buscado}"
medio = (inicio + fin)//2
if valor_buscado == array[medio]:
return f"El valor {valor_buscado} está ... | 3.859375 | 4 |
shexer/core/shexing/strategy/direct_and_inverse_shexing_strategy.py | DaniFdezAlvarez/dbpedia-shexer | 0 | 12768299 | <filename>shexer/core/shexing/strategy/direct_and_inverse_shexing_strategy.py
from shexer.core.shexing.strategy.asbtract_shexing_strategy import AbstractShexingStrategy
from shexer.utils.shapes import build_shapes_name_for_class_uri
from shexer.model.statement import Statement
from shexer.model.shape import Shape
_POS... | 2.109375 | 2 |
bayeso_benchmarks/inf_dim_ackley.py | jungtaekkim/bayeso-benchmarks | 20 | 12768300 | <reponame>jungtaekkim/bayeso-benchmarks
#
# author: <NAME> (<EMAIL>)
# last updated: February 8, 2021
#
import numpy as np
from bayeso_benchmarks.benchmark_base import Function
def fun_target(bx, dim_bx,
a=20.0,
b=0.2,
c=2.0*np.pi
):
assert len(bx.shape) == 1
assert bx.shape[0] == dim_bx
ass... | 2.28125 | 2 |
TestingScripts/Looped/LoopedBlobDetect/loopedBlobPicsOnly.py | griffincalme/MicroDeconvolution | 2 | 12768301 | <reponame>griffincalme/MicroDeconvolution
#Hematoxylin (Basic blue)= binds to nuclei
#Cytokines are GBI Red Chromagen
#CD3 (TIL) are DAB
import numpy as np
import matplotlib.pyplot as plt
from skimage import data
from skimage.color import separate_stains
from skimage.exposure import rescale_intensity
from skimage.fea... | 2.265625 | 2 |
wgan_mnist.py | Fellfalla/minimal_wgan | 0 | 12768302 | """Minimal implementation of Wasserstein GAN for MNIST."""
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
from tensorflow.contrib import layers
from tensorflow.examples.tutorials.mnist import input_data
import threading
from rendering import draw_figure, export_video
def leaky_relu(x):
... | 2.78125 | 3 |
polyaxon/scheduler/spawners/horovod_spawner.py | wbuchwalter/polyaxon | 0 | 12768303 | from polyaxon_schemas.environments import HorovodClusterConfig
from polyaxon_schemas.polyaxonfile.specification.frameworks import HorovodSpecification
from polyaxon_schemas.utils import TaskType
from scheduler.spawners.experiment_spawner import ExperimentSpawner
class HorovodSpawner(ExperimentSpawner):
MASTER_SER... | 1.90625 | 2 |
src/runners/iris_runner.py | shivanip14/semisupclustering | 0 | 12768304 | from src.seededkm.seededkm import SeededKMeans
from src.constrainedkm.constrainedkm import ConstrainedKMeans
from sklearn import datasets
from src.utils.runnerutils import run_algo, run_KMeans
def cluster(n_clusters, seed_fraction, noise_fraction, incompleteness_fraction, manually_annotate, n_fold, run_KM):
iris =... | 2.546875 | 3 |
pycomponents/html/__init__.py | expert-m/pycomponents | 0 | 12768305 | from .base import *
from .basic import *
from .forms import *
from .frames import *
from .images import *
from .audio_and_video import *
from .links import *
from .lists import *
from .tables import *
from .semantics import *
from .meta import *
from .formatting import *
from .programming import *
from .other import *
| 0.917969 | 1 |
electrum_gui/common/basic/request/exceptions.py | huazhouwang/electrum | 0 | 12768306 | <gh_stars>0
from requests import Response
class ResponseException(IOError):
def __init__(self, message: str, response: Response):
self.message = message
self.response = response
super(ResponseException, self).__init__(message)
| 2.5625 | 3 |
tugs/utils.py | johnyf/gr1experiments | 3 | 12768307 | """Parsing of signal logs from experiments, and version logging."""
import datetime
import importlib
import json
import logging
import os
import pprint
import subprocess
import time
import git
import numpy as np
# these should be moved to other (optional) module
from openpromela import logic
from openpromela import slu... | 2.171875 | 2 |
fairness/algorithms/zafar/fair-classification-master/preferential_fairness/synthetic_data_demo/plot_synthetic_boundaries.py | yashwarlord/fairness-comparison | 146 | 12768308 | <gh_stars>100-1000
import matplotlib
import matplotlib.pyplot as plt # for plotting stuff
import os
import numpy as np
matplotlib.rcParams['text.usetex'] = True # for type-1 fonts
def get_line_coordinates(w, x1, x2):
y1 = (-w[0] - (w[1] * x1)) / w[2]
y2 = (-w[0] - (w[1] * x2)) / w[2]
return y1,y2
def... | 2.640625 | 3 |
test/test_coverage_wrapper.py | vasili-v/distcovery | 0 | 12768309 | <filename>test/test_coverage_wrapper.py<gh_stars>0
import unittest
import sys
import StringIO
import __builtin__
import os
from distutils import log
# Reload module to run its global section under coverage supervision
import distcovery.coverage_wrapper
reload(distcovery.coverage_wrapper)
from distcovery.coverage_wra... | 2.203125 | 2 |
evtx.py | analyzeDFIR/analyzeEVTX-structures | 0 | 12768310 | ## -*- coding: UTF-8 -*-
## evtx.py
##
## Copyright (c) 2018 analyzeDFIR
##
## Permission is hereby granted, free of charge, to any person obtaining a copy
## of this software and associated documentation files (the "Software"), to deal
## in the Software without restriction, including without limitation the rights
##... | 1.570313 | 2 |
intent/judge_intent.py | ricosr/travel_consult_chatbot | 0 | 12768311 | <gh_stars>0
# -*- coding: utf-8 -*-
from rasa.nlu.model import Interpreter
from intent.intent_temrs import intent_terms_dict
class Intent:
def __init__(self, model_name='models1'):
self.interpreter = Interpreter.load("intent/{}/nlu".format(model_name))
self.threshold = 0.7 # TODO: need to test... | 2.78125 | 3 |
getLogFilePath.py | mismailzz/Extract-filenames-from-Strace-result | 0 | 12768312 | <filename>getLogFilePath.py
from array import *
filepath = '/root/Desktop/output.txt'
#indexes value
quote_index = 0
slash_index = 1
alpha_numeric = 2
#print("\"ismail")
#2D list
# -1 mean nothing
table = [[1, -1, -1], [-1, 2, -1], [-1, -1, 3], [4, 2, 3]]
path_list = [] #to store table paths
with open(filepath) a... | 3.140625 | 3 |
tests/server/test_aiohttp.py | dapper91/pjrpc | 10 | 12768313 | import pytest
from aiohttp import web
from pjrpc import exc
from pjrpc.common import v20
from pjrpc.server.integration import aiohttp as integration
from tests.common import _
@pytest.fixture
def path():
return '/test/path'
@pytest.fixture
def json_rpc(path):
json_rpc = integration.Application(path)
... | 2.0625 | 2 |
share/extended-cpt/analysis/vis/run.py | ucla-pbpl/pbpl-compton | 2 | 12768314 | #!/usr/bin/env python
import os
import toml
import sys
os.system('rm -f *wrl *h5')
# print('### RUNNING GEANT4 (design.wrl) ###')
# conf = toml.load('sfqed.toml')
# A = conf['PrimaryGenerator']
# A['PythoGenerator'] = 'sfqed.pattern_spray'
# A['NumEvents'] = 100
# with open('temp.toml', 'w') as fout:
# toml.dump(... | 2.15625 | 2 |
interbotix_ros_xslocobots/examples/python_demos/joint_position_control.py | jywilson2/interbotix_ros_rovers | 13 | 12768315 | from interbotix_xs_modules.locobot import InterbotixLocobotXS
# This script commands some arbitrary positions to the arm joints
#
# To get started, open a terminal and type...
# 'roslaunch interbotix_xslocobot_control xslocobot_python.launch robot_model:=locobot_wx250s show_lidar:=true'
# Then change to this directory... | 2.53125 | 3 |
src/bin/algos_contrib/LatentDirichletAllocation.py | xynazog/mltk-algo-contrib | 65 | 12768316 | '''
Once newer version of sklearn is used will need to change k alias from n_topics to n_components
https://stackoverflow.com/a/48121678
'''
from sklearn.decomposition import LatentDirichletAllocation as _LatentDirichletAllocation
from base import BaseAlgo, TransformerMixin
from codec import codecs_manager
from util.p... | 1.960938 | 2 |
packit_service/service/api/webhooks.py | jscotka/packit-service | 0 | 12768317 | # MIT License
#
# Copyright (c) 2019 Red Hat, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge... | 1.625 | 2 |
core/operators.py | Aareon/Akilang | 0 | 12768318 | from collections import namedtuple
from enum import Enum, unique
from functools import lru_cache
from core.errors import ParseError
@unique
class Associativity(Enum):
UNDEFINED = 0
LEFT = 1
RIGHT = 2
BinOpInfo = namedtuple('BinOpInfo', ['precedence', 'associativity'])
BUILTIN_OP = {
'=': BinOpInfo(2... | 2.765625 | 3 |
open-hackathon-server/src/hackathon/storage/local_storage.py | 99Kies/open-hackathon | 37 | 12768319 | # -*- coding: utf-8 -*-
"""
This file is covered by the LICENSING file in the root of this project.
"""
import sys
sys.path.append("..")
import os
from os.path import realpath, dirname, isfile, abspath
import json
import time
import uuid
from werkzeug.datastructures import FileStorage
from io import IOBase
from hac... | 2.515625 | 3 |
ctf/routes/scoreboard.py | owenofengland/lCTF-Platform | 0 | 12768320 | from flask import Blueprint, render_template
from flask_login import login_required, current_user
from ctf.models.Score import Score
from ctf import db
from sys import path
path.append("..")
scoreboard = Blueprint("scoreboard", __name__)
@scoreboard.route("/scoreboard")
def scoreboard_out():
scores = Score.query... | 2.109375 | 2 |
flatpak-manager-steamos/flatpakmanager_steamos/gui.py | sharkwouter/flatpak-manager | 1 | 12768321 | import pygame
import pygameMenu
import flatpakmanager_steamos
import pyflatpak
class gui():
def __init__(self, window_width, window_height, title):
self.window_width = window_width
self.window_height = window_height
self.title = title
self.framerate = 30
self.running = Fa... | 2.703125 | 3 |
karsender/tests.py | smirnoffs/karsender | 0 | 12768322 | # -*- coding: utf-8 -*-
from karsender.database import get_collection
from karsender.services import validate_emails
__author__ = '<NAME> <<EMAIL>>'
from unittest import TestCase
class TestServices(TestCase):
def test_validate_emails(self):
validate_emails() | 2.140625 | 2 |
mechroutines/models/ene.py | lpratalimaffei/moldriver | 1 | 12768323 | """ calculates certain quantities of interest using MESS+filesytem
"""
import os
import autofile
from mechanalyzer.inf import rxn as rinfo
from mechanalyzer.inf import spc as sinfo
from mechanalyzer.inf import thy as tinfo
from mechlib.amech_io import printer as ioprinter
from mechroutines.models import typ
from mechr... | 2.3125 | 2 |
17/main.py | nybbles/advent-of-code-2021 | 0 | 12768324 | <gh_stars>0
#! python
from enum import Enum
import re
from itertools import count
from collections import namedtuple
from more_itertools import ilen
input = "target area: x=20..30, y=-10..-5"
input = open("17/input.txt", "r").read()
# Split the problem up into x and y coordinates separately.
# x coordinate: x = (dx ... | 3.1875 | 3 |
_archive/reference/pi_server.py | ranstotz/surveillance_system | 0 | 12768325 | import cv2
import numpy as np
import zmq
import base64
import time
class serverViewer(object):
def __init__(self, ip, port):
self.ip = ip
self.port = port
self.footage_socket = ""
print "Initiallizing context and socket."
self.context = zmq.Context()
self.fo... | 2.609375 | 3 |
questions/scripts/seed_questions_v1.py | nyctophiliacme/edtech-backend | 0 | 12768326 | <reponame>nyctophiliacme/edtech-backend
import csv
import django
import os
import sys
sys.path.append("/home/ubuntu/edtech-backend")
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'superteacher.settings')
django.setup()
from questions.views import QuestionPostView
file_path = '/home/ubuntu/edtech-backend/questions/q... | 2.484375 | 2 |
cursos_complementarios/estructuras_datos_lineales_python/modulo_II_arrays/utils/array.py | EdinsonRequena/articicial-inteligence-and-data-science | 30 | 12768327 | """
Tema: Arrays
Curso: Estructura de Datos Lineales (Python).
Plataforma: Platzi.
Profesor: <NAME>.
Alumno: @edinsonrequena.
"""
class Array(object):
"""A simple array"""
def __init__(self, capacity: int, fill_value=None) -> None:
self.items = list()
for i in range(capacity):
self... | 4.3125 | 4 |
tests/test_init.py | exxamalte/python-georss-client | 0 | 12768328 | """Tests for base classes."""
import datetime
import unittest
from unittest import mock
from unittest.mock import MagicMock
import requests
from georss_client import (
UPDATE_ERROR,
UPDATE_OK,
FeedEntry,
GeoRssDistanceHelper,
GeoRssFeed,
)
from georss_client.xml_parser.geometry import Point, Polyg... | 2.65625 | 3 |
agda/agda/settings/test.py | NBISweden/agda | 1 | 12768329 | from local import * # noqa
########## IN-MEMORY TEST DATABASE
#DATABASES = {
# "default": {
# "ENGINE": "django.db.backends.sqlite3",
# "NAME": ":memory:",
# "USER": "",
# "PASSWORD": "",
# "HOST": "",
# "PORT": "",
# },
#}
LOGGING = {}
| 1.484375 | 1 |
setup.py | josiahls/fast-reinforcement-learning | 42 | 12768330 | from setuptools import setup, find_packages
with open("README.md", "r") as fh:
long_description = fh.read()
VERSION = "1.0.1"
setup(name='fast_rl',
version=VERSION,
description='Fastai for computer vision and tabular learning has been amazing. One would wish that this would '
'be t... | 1.304688 | 1 |
FamilyPropertyMS/util/ResponseCode.py | 520MianXiangDuiXiang520/FamilyPropertyManageSystem | 7 | 12768331 | CODE = {
200: {'code': 200, 'msg': "ok"},
201: {'code': 201, 'msg': "no data"},
400: {'code': 400, 'msg': "Bad Request"}, # 请求错误
401: {'code': 401, 'msg': "Unauthorized"}, # 没有用户凭证
403: {'code': 403, 'msg': 'Forbidden'}, # 拒绝授权
418: {'code': 418, 'msg': 'happy new year'},
429: {'code': 42... | 2.015625 | 2 |
accounts/auth_backends.py | zeitcodes/django-accounts | 0 | 12768332 | from django.contrib.auth.backends import ModelBackend
try:
from django.contrib.auth import get_user_model
except ImportError:
from django.contrib.auth.models import User
get_user_model = lambda: User
import re
email_re = re.compile(
r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*" #... | 2.515625 | 3 |
plaso/formatters/bencode_parser.py | ir4n6/plaso | 1 | 12768333 | <reponame>ir4n6/plaso
# -*- coding: utf-8 -*-
"""The bencode parser event formatters."""
from __future__ import unicode_literals
from plaso.formatters import interface
from plaso.formatters import manager
class TransmissionEventFormatter(interface.ConditionalEventFormatter):
"""Formatter for a Transmission active... | 1.90625 | 2 |
tests/fireworks/user_objects/firetasks/test_dtool_lookup_tasks.py | IMTEK-Simulation/imteksimfw | 0 | 12768334 | <filename>tests/fireworks/user_objects/firetasks/test_dtool_lookup_tasks.py
# coding: utf-8
"""Test dtool lookup server queries integration."""
__author__ = '<NAME>'
__copyright__ = 'Copyright 2020, IMTEK Simulation, University of Freiburg'
__email__ = '<EMAIL>, <EMAIL>'
__date__ = 'Nov 05, 2020'
import glob
import j... | 2.078125 | 2 |
solog/filmanza/gameplay.py | Namratasingh10/SoloG | 1 | 12768335 | #!/usr/bin/env python
# coding: utf-8
import numpy as np
import pandas as pd
import random as rn
import time
from .game_over import game_over
from .run import run
score = 0 # Total score
h = 3 # Total Help
def question_number(l,n):
j=rn.randint(0,n-1)
if j in l:
question_number(l,n)
else:
... | 3.734375 | 4 |
src/apps/leaderboards/strategies.py | binfeng1018/competitions-v2 | 19 | 12768336 | <reponame>binfeng1018/competitions-v2<filename>src/apps/leaderboards/strategies.py<gh_stars>10-100
import logging
from django.db.models import Sum, Q
from rest_framework.generics import get_object_or_404
from competitions.models import Submission
from leaderboards.models import Leaderboard
logger = logging.getLogger... | 2.125 | 2 |
leetcode/231/231.power-of-two.py | Algorithm-Cracker/Leetcode | 1 | 12768337 | <filename>leetcode/231/231.power-of-two.py
#
# @lc app=leetcode id=231 lang=python3
#
# [231] Power of Two
#
# @lc code=start
class Solution:
def isPowerOfTwo(self, n: int) -> bool:
# 每次向下除2, 看最后的结果
if n < 1: return False
elif n == 1: return True
return self.isPowerOfTwo(n/2)
... | 3.734375 | 4 |
src/docserver/application_methods/delete.py | djpugh/docserver | 1 | 12768338 | import logging
from docserver.api import schemas
from docserver.config import config
from docserver.db import models as db_models
logger = logging.getLogger(__name__)
def delete_package(package: schemas.BasePackage, provided_permissions=None):
db = config.db.local_session()
packages = db_models.Package.rea... | 2.328125 | 2 |
external/trezor-common/tools/coin_info.py | makotoproject/makoto | 4 | 12768339 | <filename>external/trezor-common/tools/coin_info.py
#!/usr/bin/env python3
from collections import defaultdict, OrderedDict
import re
import os
import json
import glob
import logging
try:
import requests
except ImportError:
requests = None
log = logging.getLogger(__name__)
DEFS_DIR = os.path.abspath(
os.... | 2.484375 | 2 |
config_state/serializers/_pickle.py | nicolaspi/config-state | 2 | 12768340 | <gh_stars>1-10
import pickle
from typing import IO
from config_state import ConfigField
from config_state import register
from config_state.config_state import ObjectState
from config_state.serializers.serializer import Serializer
@register
class Pickle(Serializer):
is_binary: bool = ConfigField(True,
... | 2.515625 | 3 |
helpers/os_methods.py | finnurtorfa/aflafrettir.is | 0 | 12768341 | from os import walk, remove
def get_all_files(directory):
""" Method for listing files within a directory
"""
f = []
for (_, _, filenames) in walk(directory):
f.extend(filenames)
return f
def remove_file(filename, directory):
""" Method for removing a file within a directory
"""
try:
remove(d... | 4.03125 | 4 |
ejemplo-mqtt-viewer.py | Marcombo/cursio_IoT | 0 | 12768342 | <filename>ejemplo-mqtt-viewer.py
import paho.mqtt.client as mqtt
import time
def on_message(client,userdata,message):
data = str(message.payload.decode("utf-8"))
topic = str(message.topic)
print(topic,data)
broker_user = "xxxx"
broker_password = "<PASSWORD>"
broker_address = "xxxx"
broker_port = 1883
broker_topic ... | 3 | 3 |
heat_integration.py | glluk/ci-tests | 0 | 12768343 | # Copyright 2016 Mirantis, 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/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | 1.585938 | 2 |
main.py | Assaviv/demo_calculator | 0 | 12768344 | import re
import argparse
from typing import Optional, List
from dataclasses import dataclass
from lark import Lark, Transformer, v_args
USAGE = "A command line calculator"
@dataclass
class Token:
name: str
value: str
calc_grammar = """
?start: sum
| NAME "=" sum -> assign_var
?sum: ... | 2.84375 | 3 |
app/closeLoop/trainModels-prcp.py | fkwai/geolearn | 0 | 12768345 | <gh_stars>0
from hydroDL import pathSMAP, master, utils
from hydroDL.master import default
from hydroDL.post import plot, stat
import os
import matplotlib.pyplot as plt
import numpy as np
import torch
# training
tLst = [[20150501, 20151001], [20150402, 20160401]]
tagLst = ['2015RK', '2015']
for k in range(len(tLst)):
... | 1.625 | 2 |
cactus/mime.py | danielchasehooper/Cactus | 1,048 | 12768346 | <filename>cactus/mime.py
import os
import mimetypes
MIMETYPE_MAP = {
'.js': 'text/javascript',
'.mov': 'video/quicktime',
'.mp4': 'video/mp4',
'.m4v': 'video/x-m4v',
'.3gp': 'video/3gpp',
'.woff': 'application/font-woff',
'.eot': 'application/vnd.ms-fontobject',
'.ttf': 'applica... | 2.34375 | 2 |
TodoApp/todos/urls.py | ExeExzo/Django-ToDo | 0 | 12768347 | from django.urls import path
from . import views
from .views import CustomLoginView, RegisterPage
from django.contrib.auth.views import LogoutView
urlpatterns = [
path('login/', CustomLoginView.as_view(),name='login'),
path('logout/', LogoutView.as_view(next_page='login'),name='logout'),
path('regi... | 1.921875 | 2 |
bazaar/__init__.py | ronbeltran/bazaar | 2 | 12768348 | <reponame>ronbeltran/bazaar
import os
try:
from secrets import choice # >= python3.6
except ImportError:
from random import choice # < python3.6
BASE_DIR = os.path.join(os.path.dirname(__file__))
WORDS_DIR = os.path.join(BASE_DIR, 'words')
class Bazaar(object):
def __init__(self):
self.item =... | 2.484375 | 2 |
tests/job_test.py | mkeilman/sirepo | 49 | 12768349 | <reponame>mkeilman/sirepo<filename>tests/job_test.py
# -*- coding: utf-8 -*-
"""End to end test of running a job.
:copyright: Copyright (c) 2019 RadiaSoft LLC. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
import pyt... | 2.03125 | 2 |
plugin/python/zui/dlg/fileopen.py | cristivlas/zerobugs | 2 | 12768350 | <reponame>cristivlas/zerobugs
# -------------------------------------------------------------------------
# This file is part of ZeroBugs, Copyright (c) 2010 <NAME>
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
... | 2 | 2 |