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 |
|---|---|---|---|---|---|---|
registration_app/tests/frontend/test_view.py | radekska/django-network-controller | 0 | 36500 | <reponame>radekska/django-network-controller
import pytest
import requests
import unittest
from django.test import TestCase
from django.urls import reverse
from django.contrib.auth.models import User
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from webdriver_manager.chrome im... | 2.421875 | 2 |
export_util/normalize.py | amoghmatt/export-lib | 3 | 36501 | <gh_stars>1-10
import collections
import schematics
from export_util import (
template as tpl,
value as val
)
class Normalizer:
"""
Normalizer object formats data into ordered rows using provided template. Templates are building
using `export_lib.template` functionality. First what should be pas... | 2.921875 | 3 |
gwent/vendor/pygwinc_clone/gwinc/ifo/aLIGO/__init__.py | ark0015/GWDetectorDesignToolkit | 14 | 36502 | <filename>gwent/vendor/pygwinc_clone/gwinc/ifo/aLIGO/__init__.py
from gwinc.ifo.noises import *
class aLIGO(nb.Budget):
name = "Advanced LIGO"
noises = [
QuantumVacuum,
Seismic,
Newtonian,
SuspensionThermal,
CoatingBrownian,
CoatingThermoOptic,
Substra... | 1.421875 | 1 |
BioSTEAM 2.x.x/biorefineries/TAL/analyze_across_adsorption_design_space.py | yoelcortes/Bioindustrial-Complex | 2 | 36503 | # -*- coding: utf-8 -*-
"""
Created on Thu Mar 10 13:52:52 2022
@author: sarangbhagwat
"""
from biorefineries.TAL.system_TAL_adsorption_glucose import *
from matplotlib import pyplot as plt
import numpy as np
column = AC401
#%% Across regeneration fluid velocity and cycle time
def MPSP_at_adsorption_design(v, t):
... | 2.375 | 2 |
backtracking/python/rat_in_a_maze.py | CHuante/CSCognisanse | 2 | 36504 | #To solve Rat in a maze problem using backtracking
#initializing the size of the maze and soution matrix
N = 4
solution_maze = [ [ 0 for j in range(N) ] for i in range(N) ]
def is_safe(maze, x, y ):
'''A utility function to check if x, y is valid
return true if it is valid move,
return false otherwise
'''
i... | 4.25 | 4 |
locate_cell.py | NCBI-Hackathons/Cells2Image | 0 | 36505 | import matplotlib.pyplot as plt
import numpy as np
from scipy import ndimage
import time
import skimage.draw
import image_data
import image_processing as ip
if __name__ == "__main__":
movgen = image_data.all_movies()
for em,movie in enumerate(movgen):
framegen = image_data.all_frames(movie)
... | 2.546875 | 3 |
03/main.py | ajouellette/advent-of-code21 | 0 | 36506 | <reponame>ajouellette/advent-of-code21
import numpy as np
def bin_to_dec(bin_str):
"""Convert a string of bits to decimal."""
result = 0
for i, bit in enumerate(bin_str[::-1]):
result += int(bit) * 2**i
return result
if __name__ == "__main__":
data = []
with open("input", 'r') as fil... | 3.640625 | 4 |
firmware/m5mw.micropython.py | RAWSEQ/M5MouseWheel | 0 | 36507 | from m5stack import *
from m5stack_ui import *
from uiflow import *
from ble import ble_uart
import face
screen = M5Screen()
screen.clean_screen()
screen.set_screen_bg_color(0x000000)
mb_click = None
rb_click = None
lb_click = None
snd_val = None
st_mode = None
stval = None
prval = None
faces_encode = face.get(face... | 2.0625 | 2 |
python/cvi_toolkit/test/test_model.py | sophgo/tpu_compiler | 3 | 36508 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import os
import shutil
import argparse
import subprocess
import numpy as np
import contextlib
import onnx
from cvi_toolkit.utils.mlir_shell import *
from cvi_toolkit.utils.intermediate_file import IntermediateFile
@contextlib.contextmanager
def pushd(new_dir):
previous... | 2.09375 | 2 |
main.py | FSlowkey/_csmentor_ | 0 | 36509 | <reponame>FSlowkey/_csmentor_
import os
import webapp2
import data
import datetime
from google.appengine.ext.webapp import template
from google.appengine.api import users
from google.appengine.api import images
from google.appengine.api import blobstore
from google.appengine.ext.webapp import blobstore_handlers
from g... | 2.234375 | 2 |
tests/class/alias02.py | ktok07b6/polyphony | 83 | 36510 | from polyphony import testbench
class C:
def __init__(self, x):
self.x = x
class D:
def __init__(self, c):
self.c = c
def alias02(x):
c0 = C(x)
c1 = C(x*x)
d = D(c0)
result0 = d.c.x == x
d.c = c1
result1 = d.c.x == x*x
c1.x = 0
result2 = d.c.x == 0
d.c = c0... | 2.90625 | 3 |
text_scrambler/text_scrambler.py | GuillaumeLNB/text-scrambler | 0 | 36511 | import inspect
import os
import sys
from random import choice
from typing import List
__author__ = "GLNB"
__copyright__ = "GLNB"
__license__ = "mit"
try:
from .dictionaries import invisible_chars, dict_latin
except ImportError:
from dictionaries import invisible_chars, dict_latin
__location__ = os.path.join... | 3.21875 | 3 |
12_find the output/03_In Python/01_GeeksForGeeks/02_Set two/problem_2.py | Magdyedwar1996/python-level-one-codes | 1 | 36512 | <filename>12_find the output/03_In Python/01_GeeksForGeeks/02_Set two/problem_2.py
for i in range(2):
print(i) # print 0 then 1
for i in range(4,6):
print (i) # print 4 then 5
"""
Explanation:
If only single argument is passed to the range method,
Python considers this argument as the end of the range and the defau... | 4.28125 | 4 |
bin/terminology.py | cedzz/python-patterns | 631 | 36513 | #!/usr/bin/env python3
"""Count the frequency of various phrases, given the path to the Python PEPs.
In Python PEPs, the opposite of “subclass” is almost always “base class” — just remember that the builtin is named super(), not base()! Stats:
216 base class
0 child class
10 derived class
12 parent class
372 ... | 3.28125 | 3 |
sources/tests/test_regionsweep.py | tipech/OverlapGraph | 0 | 36514 | #!/usr/bin/env python
"""
Unit tests for Generalized One-Pass Sweep-line Algorithm
- test_regionsweep_simple
- test_regionsweep_random
"""
from typing import List
from unittest import TestCase
from sources.algorithms import \
RegionSweep, RegionSweepDebug, RegionSweepOverlaps
from sources.core import \
Re... | 3.03125 | 3 |
rotkehlchen/externalapis/bisq_market.py | rotkehlchenio/rotkehlchen | 137 | 36515 | import json
import requests
from rotkehlchen.assets.asset import Asset
from rotkehlchen.constants.timing import DEFAULT_TIMEOUT_TUPLE
from rotkehlchen.errors.misc import RemoteError
from rotkehlchen.errors.serialization import DeserializationError
from rotkehlchen.history.deserialization import deserialize_price
from... | 2.671875 | 3 |
game.py | pricob/Strategy-Game | 0 | 36516 | def game_main():
### IMPORTS ###
import colorama
from colorama import Fore
from engine import engineScript
from engine import clearScript
from os import environ
environ['PYGAME_HIDE_SUPPORT_PROMPT'] = '1'
import pygame
### ENGINE INITIALIZATION ###
settings = ["widt... | 2.109375 | 2 |
catalyst/contrib/scripts/tests/test_tag2label.py | ferrine/catalyst | 0 | 36517 | <reponame>ferrine/catalyst<gh_stars>0
import shutil
from pathlib import Path
from ..tag2label import prepare_df_from_dirs
def prepare_dataset():
shutil.rmtree('datasets', ignore_errors=True)
# dummy datasets e.g. root1 and root2
root1 = Path('datasets/root1')
root1.mkdir(parents=True, exist_ok=True)
... | 2.296875 | 2 |
src/elementary_flask/components/general/favicon.py | xaled/flaskly | 0 | 36518 | __all__ = ['FavIcon']
from dataclasses import dataclass, field
from html import escape as html_escape
@dataclass
class FavIcon:
href: str
rel: str = "icon"
mimetype: str = "image/x-icon"
rendered: str = field(init=False, repr=False)
def __post_init__(self):
self.rendered = f'<link rel="{s... | 2.453125 | 2 |
assets/urls.py | ChanTerelLy/broker-account-analist | 0 | 36519 | <filename>assets/urls.py
from django.conf.urls import url
from django.contrib.auth.decorators import login_required
from django.urls import path
from django.views.generic import RedirectView
from .views import *
urlpatterns = [
path('', login_required(assets), name='home'),
path('assets/', login_required(asset... | 1.929688 | 2 |
chapter4/chapter4_pydantic_types_01.py | GoodMonsters/Building-Data-Science-Applications-with-FastAPI | 107 | 36520 | <reponame>GoodMonsters/Building-Data-Science-Applications-with-FastAPI
from pydantic import BaseModel, EmailStr, HttpUrl, ValidationError
class User(BaseModel):
email: EmailStr
website: HttpUrl
# Invalid email
try:
User(email="jdoe", website="https://www.example.com")
except ValidationError as e:
pr... | 2.984375 | 3 |
webware/Tests/TestSessions/Transaction.py | PeaceWorksTechnologySolutions/w4py3 | 11 | 36521 | <gh_stars>10-100
""""Mock Webware Transaction class."""
from .Application import Application
class Transaction:
def __init__(self):
self._application = Application()
def application(self):
return self._application
| 2.359375 | 2 |
src/KENN2/layers/Kenn.py | DanieleAlessandro/KENN2 | 6 | 36522 | import tensorflow as tf
from KENN2.layers.residual.KnowledgeEnhancer import KnowledgeEnhancer
class Kenn(tf.keras.layers.Layer):
def __init__(self, predicates, clauses, activation=lambda x: x, initial_clause_weight=0.5, save_training_data=False, **kwargs):
"""Initialize the knowledge base.
:para... | 2.984375 | 3 |
babysteps/6.combine_strings.py | mvoltz/realpython | 0 | 36523 | <filename>babysteps/6.combine_strings.py
# called concatenation sometimes..
str1 = 'abra, '
str2 = 'cadabra. '
str3 = 'i wanna reach out and grab ya.'
combo = str1 + str1 + str2 + str3
# you probably don't remember the song.
print(combo)
# you can also do it this way
print('I heat up', '\n', "I can't cool down", ... | 3.375 | 3 |
lake/modules/strg_RAM.py | StanfordAHA/Lake | 0 | 36524 | from lake.top.memory_interface import MemoryPort, MemoryPortType
from lake.top.memory_controller import MemoryController
from kratos import *
from lake.attributes.config_reg_attr import ConfigRegAttr
from lake.passes.passes import lift_config_reg
from lake.modules.reg_fifo import RegFIFO
import kratos as kts
class St... | 2.203125 | 2 |
mdot_rest/migrations/0002_auto_20150722_2054.py | uw-it-aca/mdot-rest | 0 | 36525 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('mdot_rest', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='IntendedAudience',
field... | 1.609375 | 2 |
TEMP_PYTHON/lruCache.py | Tianyi6679/mincemeatpy | 3 | 36526 | from functools4 import lru_cache
import pickle
import copy
class CacheData:
def __init__(self, cache=None, root=None,hit=None,full=None):
self.cache = cache
self.root = root
self.hit = hit
self.full = full
# @lru_cache(maxsize=16)
# def fib(n):
# return n
#
# for x in range(16):
# fib(x)
# p... | 3.015625 | 3 |
sandbox/addcoord.py | cmrajan/pygslib | 94 | 36527 | <gh_stars>10-100
# -*- coding: utf-8 -*-
#!/usr/bin/env python
# using naming on http://www.gslib.com/gslib_help/programs.html
import subprocess
import copy
import pandas as pd
import pygslib
import numpy as np
import os
__addcoord_par = \
""" Parameters for ADDCOORD
***************... | 2.75 | 3 |
disarm_gears/validators/array_validators.py | disarm-platform/disarm-gears | 0 | 36528 | import numpy as np
def validate_1d_array(x, size=None):
'''Validate type and dimensions of an object x.'''
assert isinstance(x, np.ndarray), 'Expecting a numpy array.'
assert x.ndim == 1, 'Expecting a one-dimensional array.'
if size is not None:
assert x.size == size, 'Array size is differen... | 3.546875 | 4 |
tests/functional/gcs/test_collections.py | sirosen/globus-sdk-python | 47 | 36529 | <reponame>sirosen/globus-sdk-python<filename>tests/functional/gcs/test_collections.py
import pytest
from globus_sdk import GCSAPIError, GuestCollectionDocument, MappedCollectionDocument
from tests.common import get_last_request, register_api_route_fixture_file
def test_get_collection_list(client):
register_api_r... | 2.1875 | 2 |
extractocr.py | umd-lib/newspaper-batchload | 1 | 36530 | #!/usr/bin/env python3
import argparse
import sys
import yaml
import logging
import logging.config
from datetime import datetime
from classes import pcdm,ocr,util
from handler import ndnp
import rdflib
from rdflib import RDF
from lxml import etree as ET
from classes.exceptions import RESTAPIException, DataReadExceptio... | 2.203125 | 2 |
1101-1200/1121-Divide Array Into Increasing Sequences/1121-Divide Array Into Increasing Sequences.py | jiadaizhao/LeetCode | 49 | 36531 | <reponame>jiadaizhao/LeetCode
import collections
class Solution:
def canDivideIntoSubsequences(self, nums: List[int], K: int) -> bool:
return len(nums) >= K * max(v for v in collections.Counter(nums).values())
| 3.109375 | 3 |
KnowledgeMapping/SpiderExp/1-Code/dianhua.cn/save_prefix_mysql.py | nickliqian/ralph_doc_to_chinese | 8 | 36532 | <reponame>nickliqian/ralph_doc_to_chinese<gh_stars>1-10
"""
所有号码段存入192.168.70.40的mysql
"""
import os
import pymysql
# 获取指定文件夹文件列表
def get_files_name(dir):
all_filename = os.listdir(dir)
return all_filename
# 从文件中提取出号码前缀
def split_number(filename, parents_dir):
print("File name is <{}>".format(filename))... | 2.890625 | 3 |
scripts/control/tray_balance/tray_renderer.py | adamheins/planar-playground | 0 | 36533 | <reponame>adamheins/planar-playground
#!/usr/bin/env python
import numpy as np
from mm2d import util
class TrayRenderer(object):
def __init__(self, radius, p_te_e, p_c1e_e, p_c2e_e, P_ew_w):
self.p_lt_t = np.array([-radius, 0])
self.p_rt_t = np.array([radius, 0])
self.p_te_e = p_te_e
... | 2.640625 | 3 |
src/web/users/forms.py | werelaxe/drapo | 10 | 36534 | <reponame>werelaxe/drapo
from django import forms
from django.utils.translation import ugettext_lazy as _
class LoginForm(forms.Form):
email = forms.CharField(
required=True,
label=_('Email'),
max_length=100,
widget=forms.TextInput(attrs={
'placeholder': _('Your email')... | 2.515625 | 3 |
sample/src/rdt_header.py | PANG-hans/CS305Proj | 0 | 36535 | <reponame>PANG-hans/CS305Proj
#!/usr/bin/env python3
# coding=utf-8
"""
@Github: https://github.com/Certseeds
@Organization: SUSTech
@Author: nanoseeds
@Date: 2020-07-12 17:46:45
@LastEditors : nanoseeds
"""
""" CS305_2019F_Remake
Copyright (C) 2020 nanoseeds
CS305_2019F_Remake is free software: you can re... | 2.0625 | 2 |
functions/analytics_worker/test/conftest.py | epiphone/lambda-terraform-analytics | 0 | 36536 | <gh_stars>0
import os
import sys
here = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(0, os.path.join(here, '..', '..', '..', 'test_utils'))
from fixtures import event, lambda_context
| 1.390625 | 1 |
tests/dialog/test_router.py | uezo/minette-python | 31 | 36537 | <gh_stars>10-100
import sys
import os
sys.path.append(os.pardir)
import pytest
from pytz import timezone
from minette import DialogRouter, DialogService, EchoDialogService, ErrorDialogService
from minette import (
Message,
Context,
PerformanceInfo,
Priority
)
class PizzaDialogService(DialogService):
... | 2.234375 | 2 |
manim2/for_tb_videos/chat.py | tigerking/manim2 | 0 | 36538 | <reponame>tigerking/manim2
from manim2.imports import *
'''
Codigo por <NAME>
https://github.com/mkoconnor/manim
https://www.youtube.com/user/procdalsinazev/feed
'''
class ChatBubble(VMobject):
CONFIG = {
"answer_color":GREEN_B,
"response_color":BLUE_B,
"background_chat_opacity":0.95,
"background_chat_color":ORAN... | 2.5625 | 3 |
scripts/tests.py | hugoren/schedule_client | 0 | 36539 | import requests
import json
def file_sync(target, file_name):
token = 'Schedule0350c8c75ddcd9fafdaA9738df4c9346bec48dc9c4915'
url = 'http://127.0.0.1:10011/api/v1/schedule/file_sync/'
data = {"target": target, "file_name": file_name}
r = requests.get(url, data=json.dumps(data),
header... | 2.5625 | 3 |
projectroles/management/commands/syncgroups.py | holtgrewe/sodar_core | 0 | 36540 | <gh_stars>0
import logging
from django.contrib import auth
from django.core.management.base import BaseCommand
from django.db import transaction
from projectroles.utils import set_user_group
User = auth.get_user_model()
logger = logging.getLogger(__name__)
class Command(BaseCommand):
help = 'Synchronizes user... | 2.328125 | 2 |
config/settings/local.py | MattE-J/django-drf | 0 | 36541 | <filename>config/settings/local.py
from .base import *
SECRET_KEY = env('DJANGO_SECRET_KEY' , default='<KEY>')
DEBUG = env.bool('DJANGO_DEBUG', default=True) | 1.351563 | 1 |
morphablegraphs/constraints/spatial_constraints/splines/segment_list.py | dfki-asr/morphablegraphs | 5 | 36542 | #!/usr/bin/env python
#
# Copyright 2019 DFKI GmbH.
#
# 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, merg... | 2.15625 | 2 |
edera/exceptions.py | thoughteer/edera | 3 | 36543 | <reponame>thoughteer/edera
"""
This module declares all custom exception classes.
"""
import edera.helpers
class Error(Exception):
"""
The base class for all exceptions within Edera.
"""
class ExcusableError(Error):
"""
The base class for all "excusable" errors.
They barely deserve a warni... | 2.578125 | 3 |
src/lib/todo_classes.py | louisroyer/todopy | 0 | 36544 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''Classes for todo files.'''
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
if __debug__:
if __package__:
from . import todo_parser as _todo_parser
else:
import todo_parser as _todo_parser
if __name__ != '__main__':
__author__ = '<NAM... | 2.640625 | 3 |
qmmm_neuralnets/files/__init__.py | adamduster/qmmm_neuralnets | 0 | 36545 | <reponame>adamduster/qmmm_neuralnets
#!/usr/bin/env python
"""
"""
from .bpsf_keys import *
from .h5_file_ops import * | 0.902344 | 1 |
attendees/persons/admin.py | xjlin0/attendees | 1 | 36546 | from django_summernote.admin import SummernoteModelAdmin
from django.contrib.postgres import fields
from django_json_widget.widgets import JSONEditorWidget
from django.contrib import admin
from attendees.occasions.models import *
from attendees.whereabouts.models import *
from .models import *
# Register your models h... | 1.976563 | 2 |
AnalysisDAFM/program/DAFM/dafm.py | rcmurray/WorkflowComponents | 26 | 36547 | from sklearn.metrics import mean_squared_error, log_loss
from keras.models import Model
from keras.models import load_model
from keras.layers import Input, Dense
from keras.layers.recurrent import SimpleRNN
from keras.layers.merge import multiply, concatenate, add
from keras import backend as K
from keras import initia... | 2.171875 | 2 |
python/misc/initialize.py | christopher-burke/warmups | 0 | 36548 | #!/usr/bin/env python3
"""Initialize.
Turn full names into initials.
Source:
https://edabit.com/challenge/ANsubgd5zPGxov3u8
"""
def __initialize(name: str, period: bool=False) -> str:
"""Turn full name string into a initials string.
Private function used by initialize.
Arguments:
name {[str]}... | 4.46875 | 4 |
examples/shapes_from_glsl/cylinder_shape.py | szabolcsdombi/zengl | 116 | 36549 | import zengl
from defaults import defaults
from grid import grid_pipeline
from window import Window
window = Window(1280, 720)
ctx = zengl.context()
image = ctx.image(window.size, 'rgba8unorm', samples=4)
depth = ctx.image(window.size, 'depth24plus', samples=4)
image.clear_value = (0.2, 0.2, 0.2, 1.0)
ctx.includes[... | 2.296875 | 2 |
arq.py | CesarOncala/Exercicios-em-Python | 0 | 36550 | #Funções:__________________________________________________________________
def cadastro():
resp=input(print("Deseja cadastrar alguém?"))
if resp.upper()!= "N":
while resp.upper()!= "N":
arq=open("teste.txt","a")
nome=input(print("Digite seu nome"))
arq.write("... | 4.09375 | 4 |
venv/Lib/site-packages/astroid/__pkginfo__.py | AnxhelaMehmetaj/is219_flask | 0 | 36551 | <gh_stars>0
# Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
# For details: https://github.com/PyCQA/astroid/blob/main/LICENSE
# Copyright (c) https://github.com/PyCQA/astroid/blob/main/CONTRIBUTORS.txt
__version__ = "2.11.2"
version = __version__
| 1.023438 | 1 |
T_dynamic_programming/problems/A_longest_common_subsequence.py | Princeton21/DSA | 58 | 36552 | <filename>T_dynamic_programming/problems/A_longest_common_subsequence.py
def method1(X, Y):
m = len(X)
n = len(Y)
L = [[None] * (n + 1) for i in range(m + 1)]
for i in range(m + 1):
for j in range(n + 1):
if i == 0 or j == 0:
L[i][j] = 0
elif X[i - 1] =... | 3.265625 | 3 |
AtCoder/ABC057/D.py | takaaki82/Java-Lessons | 1 | 36553 | def combination(n, r):
r = min(n - r, r)
result = 1
for i in range(n, n - r, -1):
result *= i
for i in range(1, r + 1):
result //= i
return result
N, A, B = map(int, input().split())
v_list = list(map(int, input().split()))
v_list.sort(reverse=True)
mean_max = sum(v_list[:A]) / A
... | 2.921875 | 3 |
tests/features/steps/triggers_repo/test_triggers_list.py | dataloop-ai/dtlpy | 10 | 36554 | import behave
@behave.when(u"I list triggers")
def step_impl(context):
context.trigger_list = context.service.triggers.list()
@behave.then(u'I receive a Trigger list of "{count}" objects')
def step_impl(context, count):
assert context.trigger_list.items_count == int(count)
if int(count) > 0:
for... | 2.3125 | 2 |
P0053.py | sebastianaldi17/ProjectEuler | 0 | 36555 | # Combinatoric selections
# https://projecteuler.net/problem=53
from collections import defaultdict
from copy import deepcopy
from itertools import permutations
from math import fmod, sqrt, factorial
from time import time
start = time()
f = [factorial(i) for i in range(101)]
ans = 0
for n in range(1, 101):
for r... | 2.703125 | 3 |
prohmr/models/heads/__init__.py | akashsengupta1997/ProHMR | 120 | 36556 | <filename>prohmr/models/heads/__init__.py<gh_stars>100-1000
from .smpl_flow import SMPLFlow
from .skeleton_flow import SkeletonFlow
from .fc_head import FCHead | 1.132813 | 1 |
vibhaga/test/demo_abstract.py | keremkoseoglu/vibhaga | 0 | 36557 | """ Module for demo abstract class """
from abc import ABC, abstractmethod
class DemoAbstract(ABC):
""" Demo abstract class for testing purposes """
@abstractmethod
def demo_abstract_method(self):
""" Demo abstract method """
def demo_method(self):
""" Demo concrete method """
... | 3.3125 | 3 |
Client_side.py | SanRam/server-client-chat-python | 0 | 36558 | <filename>Client_side.py
# The client program connects to server and sends data to other connected
# clients through the server
import socket
import thread
import sys
def recv_data():
"Receive data from other clients connected to server"
while 1:
try:
recv_data = client_socket.... | 3.46875 | 3 |
2D/__animacija2D.py | KSpenko/mafijaVikend_numDelav | 1 | 36559 | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import matplotlib.animation as animation
class animacija2D:
def __init__(self, f, xInterval, yInterval, fN=20):
""" Priprava grafa in skiciranje funkcije. """
self.f = f
self.xlim = xInterval
self.ylim = y... | 3.0625 | 3 |
src/Algorithms/VotingClassifier.py | hirohio/Hello-World-ML | 0 | 36560 | <filename>src/Algorithms/VotingClassifier.py
# External Modules
import numpy as np
from sklearn.ensemble import GradientBoostingClassifier
from sklearn.model_selection import train_test_split
from sklearn.model_selection import GridSearchCV
from sklearn.ensemble import VotingClassifier
from sklearn.metrics import accur... | 3.03125 | 3 |
maysics/preprocess.py | HOKOTATE-pzw/maysics | 4 | 36561 | '''
本模块用于数据预处理
This module is used for data preproccessing
'''
import numpy as np
from maysics.utils import e_distances
from matplotlib import pyplot as plt
plt.rcParams['font.sans-serif'] = ['FangSong']
plt.rcParams['axes.unicode_minus'] = False
from io import BytesIO
from lxml import etree
import base64
import math
... | 2.5625 | 3 |
Application/Model/GridArea.py | Thomas145/PythonWebSocketsGame | 0 | 36562 | from .Styles import NoStyle
class GridArea:
def __init__(self, position_marker):
self.style = NoStyle()
self.position = position_marker
def reset(self):
self.style = NoStyle()
def current_state(self):
print(self.style.display(), end="", flush=True)
def grid_area_sty... | 2.796875 | 3 |
happy/Utils.py | yunhanw-google/happy | 42 | 36563 | <gh_stars>10-100
#!/usr/bin/env python3
#
# Copyright (c) 2015-2017 Nest Labs, 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://ww... | 2.578125 | 3 |
Python Scraping Series/P2_Listing/pull_test.py | kadnan/vidtutorials | 0 | 36564 | import requests
from bs4 import BeautifulSoup
from time import sleep
headers = {
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36'
}
def parse(url):
print('Parsing..' + url)
return 'Parsed..' + url
def pull(category_... | 3.28125 | 3 |
examples/pseudo/stamps/convert.py | golly-splorts/gollyx-maps | 0 | 36565 | <reponame>golly-splorts/gollyx-maps
import os
from pprint import pprint
import json
def main():
patterns = {
"l_pentomino": '[{"30":[30,31],"31":[30],"32":[30],"33":[30]}]',
"flower_pentomino": '[{"30":[31],"31":[30,31],"32":[32],"33":[31]}]',
"kite_heptomino": '[{"30":[30,31],"31":[30],"3... | 2.359375 | 2 |
examples/issues/issue345_docs2.py | tgolsson/appJar | 666 | 36566 | <reponame>tgolsson/appJar
import sys
sys.path.append("../../")
from appJar import gui
def press(btn):
if btn == "FIRST": app.firstFrame("Pages")
elif btn == "NEXT": app.nextFrame("Pages")
elif btn == "PREV": app.prevFrame("Pages")
elif btn == "LAST": app.lastFrame("Pages")
def changed():
msg = "... | 2.796875 | 3 |
backend/tournesol/views/polls.py | Vikka/tournesol | 0 | 36567 | <reponame>Vikka/tournesol<filename>backend/tournesol/views/polls.py
import logging
from django.conf import settings
from django.db.models import Case, F, Prefetch, Q, Sum, When
from drf_spectacular.types import OpenApiTypes
from drf_spectacular.utils import (
OpenApiExample,
OpenApiParameter,
extend_schema... | 1.890625 | 2 |
cabotage/server/ext/config_writer.py | di/cabotage-app | 15 | 36568 | import os
from flask import current_app
from flask import _app_ctx_stack as stack
class ConfigWriter(object):
def __init__(self, app=None, consul=None, vault=None):
self.app = app
self.consul = consul
self.vault = vault
if app is not None:
self.init_app(app, consul, v... | 2.25 | 2 |
HW3/VeronyWise/task3,3.py | kolyasalubov/Lv-677.PythonCore | 0 | 36569 | variable1 = input('Variable 1:')
variable2 = input('Variable 2:')
variable1, variable2 = variable2, variable1
print(f"Variable 1: {variable1}")
print(f"Variable 2: {variable2}") | 3.859375 | 4 |
stats_extractor.py | diegojromerolopez/pystats-trello | 2 | 36570 | # -*- coding: utf-8 -*-
import os
import sys
import re
import settings
from auth.connector import TrelloConnector
from stats import summary
from stats.trelloboardconfiguration import TrelloBoardConfiguration
def extract_stats(configuration_file_path):
"""
Extract stats for a given configuration file that de... | 2.796875 | 3 |
src/housie_game.py | Eclair24/housie | 1 | 36571 | """Convenience file to help start the game when the repo is cloned from git rather than installed via pip
This was required as we needed to run the script from the same level as the housie/ package in order for the imports
to work correctly.
"""
from housie.game import display_main_menu
display_main_menu()
| 1.414063 | 1 |
plyse/parser.py | arcodergh/plyse | 26 | 36572 | <filename>plyse/parser.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
from copy import deepcopy
from .query_tree import Operator, OperatorFactory, Operand, And, Or, Not
from .query import Query
from .term_parser import Term
class QueryParserError(Exception):
pass
class QueryParser(object):
def __init__(self,... | 2.90625 | 3 |
get_aozora.py | lithium0003/Image2UTF8-Transformer | 0 | 36573 | import json
import sys
import urllib.parse
import urllib.request
import os
import zipfile
import io
import csv
import re
from html.parser import HTMLParser
code_list = {}
with open('data/codepoints.csv') as f:
reader = csv.reader(f)
for row in reader:
d1,d2,d3 = row[0].split('-')
d1 = int(d1)
... | 3.0625 | 3 |
python/EggNetExtension/setup.py | marbleton/FPGA_MNIST | 7 | 36574 | #!/usr/bin/env python
"""
setup.py file for SWIG Interface of Ext
"""
import os
import platform
import re
import subprocess
import sys
from distutils.version import LooseVersion
from os import walk
import numpy
import wget
from setuptools import Extension
from setuptools import setup, find_packages
from setuptools.co... | 2.21875 | 2 |
GT-ECONOMY-BOT/economy/trashmoney.py | iFanID/e.Koenomi-DBot | 1 | 36575 | import discord
import subprocess
import os, random, re, requests, json
import asyncio
from datetime import datetime
from discord.ext import commands
class Economy(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_ready(self):
print('[+] Trashmoney Code AC... | 2.828125 | 3 |
third_party/ctmalloc/ctmalloc.gyp | dandv/syzygy | 1 | 36576 | <filename>third_party/ctmalloc/ctmalloc.gyp<gh_stars>1-10
# Copyright 2014 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/lice... | 1.523438 | 2 |
src/chat/tasks.py | klapen/chat | 0 | 36577 | from __future__ import absolute_import, unicode_literals
from celery import shared_task
from asgiref.sync import async_to_sync
from channels.layers import get_channel_layer
import requests
import csv
@shared_task
def getStockQuote(room_group_name, stock_code):
url = 'https://stooq.com/q/l/?s=%s&f=sd2t2ohlcv&h&e=cs... | 2.4375 | 2 |
scripts/tests/test_summarize.py | JoshSkrzypczak/people | 1 | 36578 | <filename>scripts/tests/test_summarize.py<gh_stars>1-10
from summarize import Summarizer
def test_person_summary():
s = Summarizer()
people = [
{
"gender": "F",
"image": "https://example.com/image1",
"party": [{"name": "Democratic"}, {"name": "Democratic", "end_dat... | 2.96875 | 3 |
ex091.py | paulo-caixeta/Exercicios_Curso_Python | 0 | 36579 | <gh_stars>0
"""Exercício Python 091: Crie um programa onde 4 jogadores joguem um dado e tenham resultados aleatórios.
Guarde esses resultados em um dicionário em Python. No final, coloque esse dicionário em ordem,
sabendo que o vencedor tirou o maior número no dado."""
from random import randint
from time import sleep
... | 3.765625 | 4 |
_/Chapter 03/transfrauddetect.py | paullewallencom/hadoop-978-1-7839-8030-7 | 2 | 36580 | <gh_stars>1-10
# Submit to spark using
# spark-submit /Users/anurag/hdproject/eclipse/chapt3/transfrauddetect.py
# You need the full path of the python script
from pyspark import SparkContext
from pyspark import SparkConf
from pyspark.mllib.clustering import KMeans, KMeansModel
from pyspark.streaming import StreamingC... | 2.75 | 3 |
Bioinformatics Stronghold/(3) Complementing a Stand of DNA/Complementing a Stand of DNA/Complementing_a_Stand_of_DNA.py | LawTam/ROSALIND | 0 | 36581 | def main():
# Manage input file
input = open(r"C:\Users\lawht\Desktop\Github\ROSALIND\Bioinformatics Stronghold\Complementing a Stand of DNA\Complementing a Stand of DNA\rosalind_revc.txt","r")
DNA_string = input.readline(); # take first line of input file for counting
# Take in input file of DNA stri... | 4.0625 | 4 |
binary_tree_postorder_traversal/solution.py | mahimadubey/leetcode-python | 528 | 36582 | <filename>binary_tree_postorder_traversal/solution.py
"""
Given a binary tree, return the postorder traversal of its nodes' values.
For example:
Given binary tree {1,#,2,3},
1
\
2
/
3
return [3,2,1].
"""
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# ... | 4.0625 | 4 |
src/test/base.py | inova-tecnologias/jenova | 2 | 36583 | <gh_stars>1-10
import yaml
class BaseTest(object):
def setUp(self):
with open("properties.yaml") as f:
self.cfg = yaml.safe_load(f)
self.general = self.cfg['general']
self.reseller = self.cfg['reseller']
self.client = self.cfg['client']
self.service_zimbra = self.cfg['service_zimbra'... | 2.3125 | 2 |
apps/test_find_application_with_mainflow/views.py | HeMan/jobbergate | 4 | 36584 | from jobbergate import appform
def mainflow(data):
return [appform.Const("val", default=10)]
| 1.695313 | 2 |
crawlerAPI/Stay_Hungry_API/apps.py | epikjjh/Stay_Hungry_Server | 0 | 36585 | from django.apps import AppConfig
class OsoricrawlerapiConfig(AppConfig):
name = 'osoriCrawlerAPI'
| 1.117188 | 1 |
quotes/tests/requests/test_home_page.py | daviferreira/defprogramming | 6 | 36586 | <filename>quotes/tests/requests/test_home_page.py<gh_stars>1-10
# coding: utf-8
from lxml import html
from django.test import TestCase
from django.test.client import Client
from quotes.tests.utils import create_test_quote
class HomePageTestCase(TestCase):
def setUp(self):
self.client = Client()
... | 2.5 | 2 |
src/components/decode_encode/confirm.py | DuckyMomo20012/flask-server | 3 | 36587 | from numpy import char
from function_support import *
def confirm(n,e,d):
s = 'i have publicKey'
temp = ""
encode = []
#encrypt
for i in s:
c = powermod(ord(i),e,n)
encode.append(c)
#decrypt
for i in encode:
m = powermod(i,d,n)
print(m)
temp = temp + ... | 3.140625 | 3 |
luckydonaldUtils/regex/telegram.py | luckydonald/python-utils | 5 | 36588 | # -*- coding: utf-8 -*-
import re
__author__ = 'luckydonald'
__all__ = [
'USERNAME_REGEX', '_USERNAME_REGEX', 'USER_AT_REGEX', '_USER_AT_REGEX',
'FULL_USERNAME_REGEX', '_FULL_USERNAME_REGEX'
]
_USERNAME_REGEX = '[a-zA-Z](?:[a-zA-Z0-9]|_(?!_)){3,30}[a-zA-Z0-9]' # https://regex101.com/r/nZdOHS/2
USERNAME_REGEX... | 2.25 | 2 |
sdk/python/pulumi_azure_nextgen/compute/v20200930/outputs.py | test-wiz-sec/pulumi-azure-nextgen | 0 | 36589 | <reponame>test-wiz-sec/pulumi-azure-nextgen
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Un... | 1.539063 | 2 |
tests/test_datetime_fields.py | 20c/django-syncref | 0 | 36590 | from datetime import datetime, timedelta
import pytest
from django.test import TestCase
from tests.models import Org, Sub, Widget
data_org = {"name": "Acme Widgets"}
class FieldTestCase(TestCase):
def setUp(self):
self.org = Org.objects.create(**data_org)
self.created = datetime.now()
s... | 2.4375 | 2 |
app.py | Antinator11/Creative-Space | 0 | 36591 | from flask import Flask, render_template, request, redirect, url_for, Markup, \
flash # Imports Flask and all required modules
import databasemanager # Provides the functionality to load stuff from the database
app = Flask(__name__)
import errormanager # Enum for types of errors
# DECLARE datamanager as... | 2.84375 | 3 |
electromorpho/structure/graphs.py | CIG-UPM/electro-morpho | 1 | 36592 | import scipy.sparse as ssp
import scipy.sparse.csgraph as csgraph
import networkx as nx
import pylab as pl
import pygraphviz as pgv
from itertools import product, chain
class DiGraph(ssp.lil_matrix):
"""
An implementation of a directed graph with a Sparse Matrix representation using Scipy's sparse module.
... | 3.4375 | 3 |
MyWeather.py | luisegarduno/MyWeather | 0 | 36593 | <reponame>luisegarduno/MyWeather
import sys
import json
import time
import os.path
import subprocess
# Current working directory
cwd = os.path.dirname(os.path.realpath(__file__))
# Boolean flag that tells the program whether the user enabled text notifications
txt_notifs = True
# Clear terminal screeen
... | 2.71875 | 3 |
filter_plugins/containers2volumes.py | gabriel-duque/sadm | 4 | 36594 | <filename>filter_plugins/containers2volumes.py
from ansible.errors import AnsibleFilterError
def container2volumes(container, vol_type="all"):
vol_types = ["generated", "persistent", "volatile"]
catch_all_type = "all"
if vol_type != catch_all_type and vol_type not in vol_types:
raise AnsibleFilter... | 2.578125 | 3 |
cryptofeed_werks/exchanges/bitmex/api.py | globophobe/crypto-tick-data | 0 | 36595 | <reponame>globophobe/crypto-tick-data
import datetime
import json
import re
import time
from decimal import Decimal
import httpx
from cryptofeed_werks.controllers import HTTPX_ERRORS, iter_api
from cryptofeed_werks.lib import parse_datetime
from .constants import API_URL, MAX_RESULTS, MIN_ELAPSED_PER_REQUEST, MONTHS... | 2.109375 | 2 |
lowest-unique.py | leaen/Codeeval-solutions | 0 | 36596 | <filename>lowest-unique.py
import sys
def lowest_unique_number(line):
numbers = sorted(map(int, line.split()))
for e in numbers:
if numbers.count(e) == 1:
return line.index(str(e))//2+1
return 0
def main():
with open(sys.argv[1]) as input_file:
for line in input_file:
... | 3.8125 | 4 |
flask_server.py | MichalYoung/eld-sentence-scramble | 0 | 36597 | <filename>flask_server.py
"""
A simple game for English language development students in
primary school. English sentences are presented with a
scrambled word order. Students click each word to put it in
correct English order (e.g., adjectives come before nouns).
"""
import config
import flask
from flask import r... | 3.734375 | 4 |
tests/test_model.py | RandalJBarnes/OnekaPy | 0 | 36598 | <reponame>RandalJBarnes/OnekaPy
"""
Test the Model class.
Notes
-----
o The specific test values were computed using the MatLab code
from the "Object Based Analytic Elements" project.
Author
------
Dr. <NAME>
Department of Civil, Environmental, and Geo- Engineering
University of Minnesota
Version
-... | 2.328125 | 2 |
Company/thoughtworks/FizzBuzzWhizz/solution-python/FizzBuzzWhizz.py | OctopusLian/leetcode-solutions | 1 | 36599 | # This is python2 version.
def FizzBuzzWhizz(args):
"""args[0] = Fizz, Buzz, Whizz
args[1]= 3, 5, 7"""
def FBW(Number):
return Number%args[1] and Number or args[0]
return FBW
def sayWhat(l_sayWhat,Number):
return l_sayWhat.count(Number)<3 and "".join([s for s in l_sayWhat if type(s) is... | 3.734375 | 4 |