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 |
|---|---|---|---|---|---|---|
Python_Scripts/addDistricts.py | Vitax/SportsClubForMe | 2 | 12769851 | <gh_stars>1-10
import geocoder
import json
with open('/home/caglar/WebStormProjects/SportsClubForMe/assets/data/SportClubForMe_Districts.json') as file:
data = json.load(file)
for club in data["clubdata"]:
if 'district' in club:
continue
try:
g = geocoder.osm(club["address"] + ", " + club... | 2.765625 | 3 |
plugins/data/ssd_plugin/digitsSSD/forms.py | wills2133/digits-ssd | 0 | 12769852 | # Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved.
from __future__ import absolute_import
import os
from digits import utils
from digits.utils import subclass
from flask.ext.wtf import Form
from wtforms import validators
@subclass
class DatasetForm(Form):
"""
A form used to create a Sunnyb... | 2.609375 | 3 |
lstm_dorway/bigram_batch.py | frenzykryger/lstm-dorway | 2 | 12769853 | import itertools
import numpy as np
import string
__all__ = ['BigramGenerator', 'SkipgramGenerator',
'id2bigram', 'vocabulary_size', 'all_bigrams']
letters = sorted(set((string.ascii_letters + string.digits + " ").lower()))
class WhitelistTable(object):
# there will be stories
def __init__(self,... | 3.03125 | 3 |
sdk/python/pulumi_time/__init__.py | tmeckel/pulumi-time | 1 | 12769854 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
from . import _utilities
import typing
# Export this package's modules as members:
from .provider import *
from .time_offset import *
f... | 1.453125 | 1 |
pysnmp/NBS-MIB.py | agustinhenze/mibs.snmplabs.com | 11 | 12769855 | <gh_stars>10-100
#
# PySNMP MIB module NBS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NBS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:07:17 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 2... | 1.671875 | 2 |
scripts/display_temperature.py | cyclogenesis-au/opaware | 0 | 12769856 | <reponame>cyclogenesis-au/opaware
import subprocess
import opaware
from rgbmatrix import graphics, RGBMatrix, RGBMatrixOptions
import time
if __name__ == "__main__":
HOST = "pi@flashpi"
# Ports are handled in ~/.ssh/config since we use OpenSSH
COMMAND = 'tail -n 500 ~/data/testjson.json'
ssh = subproc... | 2.171875 | 2 |
servicenow/icon_servicenow/actions/search_incident_attachment/schema.py | emartin-merrill-r7/insightconnect-plugins | 1 | 12769857 | <filename>servicenow/icon_servicenow/actions/search_incident_attachment/schema.py<gh_stars>1-10
# GENERATED BY KOMAND SDK - DO NOT EDIT
import komand
import json
class Component:
DESCRIPTION = "Search for attachment files with the given name"
class Input:
NAME = "name"
class Output:
ATTACHMENT_IDS... | 2.40625 | 2 |
authlib/specs/rfc5849/__init__.py | tk193192/authlib | 2 | 12769858 | <reponame>tk193192/authlib<filename>authlib/specs/rfc5849/__init__.py
# -*- coding: utf-8 -*-
"""
authlib.specs.rfc5849
~~~~~~~~~~~~~~~~~~~~~
This module represents a direct implementation of The OAuth 1.0 Protocol.
https://tools.ietf.org/html/rfc5849
"""
# flake8: noqa
from authlib.oauth1.rfc5849.e... | 1.367188 | 1 |
eex/translators/amber/amber_utility.py | dgasmith/EEX | 0 | 12769859 | import numpy as np
import eex
import os
from . import amber_metadata as amd
def get_energies(prmtop=None, crd=None, input_file=None, amb_path=None):
"""Evaluate energies of AMBER files. Based on InterMol
Args:
input_file = path to input file (expects data file in same folder)
lmp_path = path t... | 2.421875 | 2 |
ExPy/ExPy/module06.py | brad-h/expy | 0 | 12769860 | """Retirement Calculator"""
from datetime import date
def prompt(difference_check):
"""Calculate the year you can retire
difference_check - a function that takes a number and returns boolean,
the number provided is the difference between current age and retirement age
"""
age = int(input('What is... | 4.0625 | 4 |
python/lsst/integration_test_reporting/utils/__init__.py | lsst-sitcom/integration_test_reporting | 0 | 12769861 | <reponame>lsst-sitcom/integration_test_reporting
# Developed for the LSST System Integration, Test and Commissioning Team.
# This product includes software developed by the LSST Project
# (http://www.lsst.org).
# See the LICENSE file at the top-level directory of this distribution
# for details of code ownership.
#
# U... | 0.835938 | 1 |
src/revops/api/__init__.py | adam-revops/revops-python | 0 | 12769862 | name = "api"
import os
import sys
import requests
import logging
import revops.exceptions
__LOGGING_DEFAULTS__ = {'level': logging.INFO}
__DEFAULT_ENDPOINT__ = 'https://api.revops.io'
logging.basicConfig(**__LOGGING_DEFAULTS__)
class RevOpsAPI(object):
headers = {}
"""
This is the RevOps API Client
... | 2.484375 | 2 |
setup.py | nava45/flask-routelogger | 1 | 12769863 | <reponame>nava45/flask-routelogger<filename>setup.py
#!/usr/bin/env python
"""
Flask-RouteLogger
-----------
Logs the meta route level information with minimal config for flask application
"""
from setuptools import setup
setup(
name='Flask-RouteLogger',
version='0.1',
url='',
license='BSD',
aut... | 2 | 2 |
src/ebonite/ext/sqlalchemy/__init__.py | koskotG/ebonite | 270 | 12769864 | from .repository import SQLAlchemyMetaRepository
__all__ = ['SQLAlchemyMetaRepository']
| 1.125 | 1 |
CoolPlot/Plot/PsychChart.py | CoolProp/CoolPlot | 9 | 12769865 | # -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
"""
This file implements a psychrometric chart for air at 1 atm
"""
from CoolProp.HumidAirProp import HAPropsSI
from .Plots import InlineLabel
import matplotlib, numpy, textwrap
import_template = (
"""
# This file was auto-gener... | 2.90625 | 3 |
client/connectserver.py | ischeinkman/Server-Wall | 0 | 12769866 | #!/usr/bin/python
import socket
import sys
from Crypto.Cipher import AES
from Crypto import Random
from config import Config
def createMsg(cfg, user, ip = None):
ipstring = ''
if ip != None:
ipstring = ';'+ip
salt = Random.new().read(16)
cipher = AES.new(cfg.key, AES.MODE_CFB, salt)
... | 2.8125 | 3 |
gem5-gpu/configs/GPUConfig.py | ayoubg/gem5-graphics_v1 | 1 | 12769867 | # Copyright (c) 2012 <NAME> and <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list of conditions and the fo... | 1.382813 | 1 |
tests/roots/test_roots.py | emaballarin/phytorch | 1 | 12769868 | from functools import partial
from math import inf, nan
from typing import Union
import hypothesis.extra.numpy as npst
import torch
from hypothesis import given, strategies as st
from hypothesis.strategies import SearchStrategy
from pytest import fixture, mark
from torch import allclose, as_tensor, isclose, tensor
fr... | 1.914063 | 2 |
tests/test_idempotent.py | rberenguel/motllo | 17 | 12769869 | <filename>tests/test_idempotent.py
from motllo.ops import Folder, File, tree
from motllo.markdown import build_tree, build_markdown
from motllo.build import _process_markdown
import random
from string import ascii_uppercase
import pytest
RANGE = 5
@pytest.mark.parametrize("execution_number", range(RANGE))
@pytest.m... | 2.3125 | 2 |
forms.py | ljj6218/custom_process | 1 | 12769870 | from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField
from wtforms.validators import DataRequired, EqualTo
class RegisterForm(FlaskForm):
"""登录表单类"""
username = StringField('用户名', validators=[DataRequired()])
password = PasswordField('密码', validators=[DataRequired()])
password... | 3.015625 | 3 |
outsorcing.py | Souta-m/sentence-transformers | 0 | 12769871 | <reponame>Souta-m/sentence-transformers<gh_stars>0
from sentence_transformers import SentenceTransformer,util
#import MeCab
#from sklearn.metrics.pairwise import cosine_similarity
import csv
import pandas as pd
df = pd.read_csv('data/outsourcing.csv',encoding="shift_jis")
model1 = SentenceTransformer('paraphrase-multi... | 2.390625 | 2 |
chip_eight/__init__.py | apalmer/computer-emulation | 0 | 12769872 | from .screen import Screen
from .keyboard import Keyboard
from .memory import Memory
from .cpu import Cpu
from .computer import Computer
from .runner import boot, load, run
| 1.171875 | 1 |
archived_NOT_working/WORKING.py | bendevlin18/sholl-analysis-python | 0 | 12769873 | <gh_stars>0
import os
import numpy as np
import pandas as pd
import cv2
import matplotlib.pyplot as plt
from skimage.morphology import skeletonize
from skimage import morphology
from shapely.geometry import Polygon
import matplotlib.pyplot as plt
from skimage import draw
import matplotlib as mpl
from matpl... | 2.109375 | 2 |
common_python/tests/util/test_item_aggregator.py | ScienceStacks/common_python | 1 | 12769874 | import pandas as pd
import unittest
import common_python.constants as cn
from common_python.util.item_aggregator import ItemAggregator
IGNORE_TEST = False
SIZE = 10
MULT = 5
ITEMS = [(n, MULT*n) for n in range(SIZE)]
class TestItemAggregator(unittest.TestCase):
def setUp(self):
self.aggregator = ItemAggregato... | 2.796875 | 3 |
tests/test_deployment.py | dh7892/yamgraph | 0 | 12769875 | """
Unit tests for Deployment class
"""
from unittest.mock import MagicMock, Mock
import pytest
from colour import Colour
from deployment import Deployment
BLACK = Colour("black")
@pytest.fixture(name="simple_deployment")
def simple_deployment_fixture(simple_box):
"""
This fixture will return a simple Dep... | 3.34375 | 3 |
pyprometheus/values.py | Lispython/pyprometheus | 13 | 12769876 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
pyprometheus.values
~~~~~~~~~~~~~~~~~~~
Prometheus instrumentation library for Python applications
:copyright: (c) 2017 by <NAME>.
:license: , see LICENSE for more details.
:github: http://github.com/Lispython/pyprometheus
"""
import time
from pyprometheus.utils imp... | 2.15625 | 2 |
demo_word_list_topic_model.py | shettyprithvi/scattertext | 1,823 | 12769877 | import scattertext as st
from scattertext import RankDifference
convention_df = st.SampleCorpora.ConventionData2012.get_data()
convention_df['parse'] = convention_df['text'].apply(st.whitespace_nlp_with_sentences)
unigram_corpus = (st.CorpusFromParsedDocuments(convention_df,
... | 2.578125 | 3 |
cinema_environment/server_monolith/server_app/migrations/0007_ticket_code.py | AndrewMalitchuk/cinema-server-monolith | 0 | 12769878 | <reponame>AndrewMalitchuk/cinema-server-monolith
# Generated by Django 3.0.2 on 2020-01-11 18:53
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('server_app', '0006_remove_ticket_code'),
]
operations = [
migr... | 1.65625 | 2 |
src/Config.py | marcoputon/python-api | 0 | 12769879 | import os
import json
'''
Arquivo de configurações.
Os atributos de conexão são criados dinamicamente. Estão definidos apenas
para não dar erro na IDE, mas não é necessário.
Todo - Criptografar senhas.
'''
class Config:
def __init__(self):
# Conection
self.ip = None
self.port = None
... | 3.265625 | 3 |
board.py | Hsu1685/PythonBattleshipGame | 21 | 12769880 | from box import Box
class Board(Box):
def __init__(self):
"""Initialize the board empty."""
self.board = []
self.hitted_not_sunk = [] #Only for CPU
for row in range(10):
line = []
for column in range(10):
element = Box('.', (row, column))
... | 3.546875 | 4 |
sources/VailDEC.py | Vail-Zero/VailDEC3-sources-Linux | 0 | 12769881 |
# Copyright (c) 2020 Vail-Zero. All Rights Resarved.
# 必要なライブラリーインポート
from tkinter import messagebox
from pack import decker
import tkinter
import threading
import os
import sys
from pack import passgen
# from pack import config
# from pack import GUIl
from tkinter import *
from tkinter import ttk
fr... | 2.453125 | 2 |
bridge.py | juangallostra/bridge-the-gaps | 0 | 12769882 | # This is an answer to: https://codegolf.stackexchange.com/questions/189277/bridge-the-gaps
import sys
import os
from PIL import Image
import numpy as np
import scipy.ndimage
def obtain_groups(image, threshold, structuring_el):
"""
Obtain isles of unconnected pixels via a threshold on the R channel
"""
... | 4.03125 | 4 |
PreProcess/Step3-ConvertToOnehot.py | CDboyOne/IHGNN | 5 | 12769883 | <filename>PreProcess/Step3-ConvertToOnehot.py
from typing import Type, Any, List, Dict, Set, Tuple, Union, Optional, Iterator, Iterable
import sys, os, argparse
sys.dont_write_bytecode = True
sys.path.append('.')
os.umask(0)
from Helpers.PreProcessHelper import PreProcessHelper
from Helpers.IOHelper import IOHelper
fr... | 2.484375 | 2 |
src/106a/src/obstacle_brain.py | 106aRoboCupSim/simatch | 1 | 12769884 | #!/usr/bin/env python
import rospy
import sys
import time
import numpy as np
from realtimepseudoAstar import plan
from globaltorobotcoords import transform
from nubot_common.msg import ActionCmd, VelCmd, OminiVisionInfo, BallInfo, ObstaclesInfo, RobotInfo, BallIsHolding
#Initialize desired x depending on obstacle num... | 2.40625 | 2 |
demo/one_shot/train.py | zhuguiqian/PaddleSlim | 926 | 12769885 | <gh_stars>100-1000
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... | 2.125 | 2 |
examples/python/number/minimum.py | rockacola/neo-smart-contract-examples | 15 | 12769886 | """
Date Created: 2018-03-08
Date Modified: 2018-03-08
Version: 1
Contract Hash: 1aa965c53c373ef9d3be065bdb36b234cdcab66a
Available on NEO TestNet: False
Available on CoZ TestNet: False
Available on MainNet: False
Example:
Test Invoke: ... | 2.515625 | 3 |
venv/lib/python3.6/site-packages/ansible_collections/cisco/ios/plugins/module_utils/network/ios/config/route_maps/route_maps.py | usegalaxy-no/usegalaxy | 1 | 12769887 | #
# -*- coding: utf-8 -*-
# Copyright 2021 Red Hat
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#
from __future__ import absolute_import, division, print_function
__metaclass__ = type
"""
The cisco.ios_route_maps config file.
It is in this file where the current conf... | 2.046875 | 2 |
aroma/features.py | vinferrer/aroma | 0 | 12769888 | <reponame>vinferrer/aroma
"""Functions to calculate ICA-AROMA features for component classification."""
import logging
import os
import numpy as np
from nilearn import image, masking
from nilearn._utils import load_niimg
from . import utils
LGR = logging.getLogger(__name__)
def feature_time_series(mel_mix, mc):
... | 2.4375 | 2 |
scripts/cpsg.py | skyhoshi/concfg | 864 | 12769889 | """
cpsg.py
~~~~~~
Concfg Preset Screenshot Generator
Only works in pure powershell/pwsh session, does not work in terminal like cmder.
Prerequisites:
Python3.4+, Pillow, jinja2, pywin32
"""
import os
import sys
import glob
import time
import shutil
import argparse
import win... | 1.976563 | 2 |
radiant/static/modules/mdc/MDCList.py | UN-GCPDS/radiant | 5 | 12769890 | """
Brython MDCComponent: MDCList
=============================
"""
from browser import html
from .core import MDCTemplate
########################################################################
class __listItem__(MDCTemplate):
""""""
MDC_optionals = {
'meta': '<span class="mdc-list-item__meta">... | 2.109375 | 2 |
Session 1/Skeleton Files/exercise_2_with_functions_skeleton.py | Descent098/schulich-ignite-winter-2021 | 1 | 12769891 | """Exercise 2 skeleton: Create a square that bounces when it reaches any boundary of the canvas
Remember to fill out all the TODO's, you can quickly scan for them by pressing CTRL/CMD + F
"""
import sys
import os
import pygame
"""
SETUP section - preparing everything before the main loop runs
"""
pygame.init()
scre... | 4.09375 | 4 |
vecLib/validator.py | chenjl0710/arcpyTools | 1 | 12769892 | <gh_stars>1-10
import arcpy
import os
import sys
class ToolValidator(object):
"""Class for validating a tool's parameter values and controlling
the behavior of the tool's dialog."""
def __init__(self):
"""Setup arcpy and the list of tool parameters."""
self.params = arcpy.GetParameterInfo()
self.curr... | 2.78125 | 3 |
tests/integration/test_rename.py | ytzhangFTD/organize | 1 | 12769893 | import fs
from conftest import rules_shortcut, make_files, read_files
from organize import core
def test_rename_issue52():
# test for issue https://github.com/tfeldmann/organize/issues/51
files = {
"files": {
"19asd_WF_test2.PDF": "",
"other.pdf": "",
"18asd_WFX_tes... | 2.21875 | 2 |
elit/datasets/cws/multi_criteria_cws/mcws_dataset.py | emorynlp/levi-graph-amr-parser | 9 | 12769894 | <filename>elit/datasets/cws/multi_criteria_cws/mcws_dataset.py
# -*- coding:utf-8 -*-
# Author: hankcs
# Date: 2020-10-21 19:11
import os
from typing import Union, List, Callable, Dict, Iterable
from elit.datasets.tokenization.txt import TextTokenizingDataset
from elit.utils.io_util import get_resource
class MultiCr... | 2.28125 | 2 |
sample_data/pytest_examples/calculator_example.py | AyTanase/ILAS- | 0 | 12769895 | def test_calculator_add_returns_correct_result():
result = calc_add(2,2)
assert result == 4
# def calc_add(x,y):
# pass
# return x+y
# if isinstance(x, number_types) and isinstance(y, number_types):
# return x + y
# else:
# raise ValueError("Non-numeric inpu... | 3.328125 | 3 |
python/2020/day_six_part1.py | caw13/adventofcode | 0 | 12769896 | <reponame>caw13/adventofcode
def getGroupCount(line):
#print("Line "+line)
curSet = set(())
for curChar in line:
curSet.add(curChar)
#print("Set: "+str(curSet))
return len(curSet)
filename = "inputs\\2020\\input-day6.txt"
with open(filename) as f:
lines = f.readlines()
group = ""
sum =... | 3.515625 | 4 |
Code/CarLoanCalculator.py | zachlim98/carloancalc | 0 | 12769897 | import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import plotly.express as px
import pandas as pd
app = dash.Dash(__name__)
app.layout = html.Div([
html.H2("True Cost of Car (with Interest and Monthly Expenses)", style={'text-align':'cen... | 3.078125 | 3 |
02.Regression/04.Support-Vector-Regression/support_vector_regression.py | HassanRahim26/Machine-Learning | 0 | 12769898 | <gh_stars>0
# Support Vector Regression (SVR)
# Importing the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Importing the dataset
dataset = pd.read_csv('Position_Salaries.csv')
X = dataset.iloc[:, 1:-1].values
y = dataset.iloc[:, -1].values
print(X)
"""
[[ 1]
[ 2]
[ 3]
[ 4]
[... | 3.109375 | 3 |
testsuite/tests/apicast/auth/rhsso/test_oidc_rhsso_jwt_client_id.py | dlaso99/3scale-tests | 5 | 12769899 | <gh_stars>1-10
"""
Rewrite of the spec/functional_specs/auth/rhsso/oidc_rhsso_jwt_client_id_spec.rb
and spec/functional_specs/auth/rhsso/oidc_rhsso_jwt_client_id_reject_spec.rb
this two specs ware merged in to one parametrized test
"""
import pytest
from threescale_api.resources import Service
@pytest.fixture(param... | 1.703125 | 2 |
raipy/Example.py | threemeninaboat3247/raipy | 0 | 12769900 | <reponame>threemeninaboat3247/raipy
# -*- coding: utf-8 -*-
"""
Created on Sat May 13 21:48:22 2017
@author: Yuki
"""
from PyQt5.QtWidgets import QVBoxLayout,QWidget,QHBoxLayout,QTabWidget,QStatusBar,QTextEdit,QApplication,QPushButton,QMenu,QAction
from PyQt5.QtCore import pyqtSignal
EXAMPLE='Examples' #the folder exi... | 2.390625 | 2 |
django_mfa/middleware.py | juwaini/django-mfa | 0 | 12769901 | from django.urls import reverse
from django.shortcuts import resolve_url
from django.contrib.auth import REDIRECT_FIELD_NAME as redirect_field_name
from .models import is_mfa_enabled, is_u2f_enabled
from .views import verify_rmb_cookie
try:
from django.utils.deprecation import MiddlewareMixin
except ImportError: ... | 1.984375 | 2 |
src/zope/mimetype/__init__.py | zopefoundation/zope.mimetype | 1 | 12769902 | from zope.mimetype import mtypes
types = mtypes # alternate spelling/backwards (1.3) compatible export
| 1.0625 | 1 |
pypd/tests/testutils.py | andyr0id/PyPD | 0 | 12769903 | <gh_stars>0
import os
def getPatchesDir():
d = os.path.dirname(os.path.realpath(__file__))
return d[:d.index('pypd/pypd/')] + 'pypd/patches/' | 2.03125 | 2 |
neuralnetwork/Backpropagation.py | Anselmoo/python-neuralnetwork | 0 | 12769904 | <filename>neuralnetwork/Backpropagation.py
import logging
import numpy as np
class Backpropagation:
"""Backpropagation
The Backpropagation class calculates the minimum value of the error function in relation to the training-set and the activation function.
The technique for achieving this goal is cal... | 4.0625 | 4 |
dependencies/ui/tab3/resume_folder_viewer.py | statisticalbiotechnology/quandenser-pipeline | 8 | 12769905 | <filename>dependencies/ui/tab3/resume_folder_viewer.py
import sys
from PySide2.QtWidgets import QLineEdit
from PySide2.QtGui import QColor
import os
from custom_config_parser import custom_config_parser
class resume_folder_viewer(QLineEdit):
def __init__(self, nf_settings_path, id=0):
super(resume_folder_... | 2.46875 | 2 |
envelopes/utils.py | audiolion/Envelopes-api | 0 | 12769906 | # Third Party Library Imports
from django.conf import settings
from hashids import Hashids
hashid = Hashids(
min_length=8,
salt=getattr(settings, 'HASHIDS_SALT', ''),
alphabet='0123456789ACDEFGHIJKLOQRSTUVWXYZ',
)
def encode(num):
return hashid.encode(num)
| 1.921875 | 2 |
6KYU/up_array.py | yaznasivasai/python_codewars | 4 | 12769907 | <filename>6KYU/up_array.py
def up_array(arr):
if not arr:
return None
else:
string = ''
for item in arr:
if not str(item).isdigit() or item > 9:
return None
else:
string += str(item)
total = []
for char in... | 3.46875 | 3 |
apps/amcm/migrations/0003_auto_20211024_0256.py | agsneutron/asociacion_mexicana_cuarto_milla | 0 | 12769908 | # Generated by Django 3.2.8 on 2021-10-24 02:56
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('amcm', '0002_auto_20211024_0134'),
]
operations = [
migrations.AlterModelOptions(
name='tipofec... | 1.460938 | 1 |
__init__.py | nujabes0321456/Handphone-Ecm-Simulation | 0 | 12769909 | # -*- coding: utf-8 -*-
"""
Created on Thu Nov 12 10:39:07 2020
@author: BK
"""
| 0.992188 | 1 |
deep_rl/double_dqn_agent.py | JonasVervloet/RL-Coverage-Planner | 12 | 12769910 | <reponame>JonasVervloet/RL-Coverage-Planner
import torch
import torch.nn.functional as F
from torch.distributions.categorical import Categorical
from collections import deque
import random
import math
from deep_rl.trainer import Transition as Transition
class DoubleDeepQAgent:
QUEUE_LENGTH = 5000
GAMMA = 0.... | 2.171875 | 2 |
examples/autopipegen2/plugins/cpstuff.py | microns-ariadne/ariadne-pipeline-test-harness | 2 | 12769911 | <filename>examples/autopipegen2/plugins/cpstuff.py
# generated by shell2pipe on 2016-03-17
import os
import plugin
plugin_class='cpstuff'
class cpstuff(plugin.AriadneOp):
name='cpstuff'
def run(self, args):
os.system('cp stuff/contents stuff/otherstuff')
os.system('cp stuff/contents morestu... | 2 | 2 |
tests/core/test_page_id_cache.py | uktrade/directory-cms | 6 | 12769912 | <reponame>uktrade/directory-cms
import pytest
from core.cache import PageIDCache
@pytest.mark.django_db
def test_get_populate_and_delete():
# the cache should be empty
assert PageIDCache.get() is None
# when the page is populated
result = PageIDCache.populate()
# then get returns something use... | 2.171875 | 2 |
trains/utilities/wizard/user_input.py | AdrianoKF/trains | 1 | 12769913 | from typing import Optional
def get_input(
key, # type: str
description="", # type: str
question="Enter", # type: str
required=False, # type: bool
default=None, # type: Optional[str]
new_line=False, # type: bool
):
# type: (...) -> Optional[str]
if new_line:
print()
w... | 4.03125 | 4 |
examples/team-fullmetal/dockerComp/src/server/app/__init__.py | connectthefuture/docker-hacks | 0 | 12769914 | import os
import sys
from flask import Flask, render_template
from flask.ext.mongoengine import MongoEngine
app = Flask(__name__)
app.config.from_object('config')
app.config["MONGODB_SETTINGS"] = {
"DB": os.environ.get("U_DB"),
"USERNAME": os.environ.get("U_USER"),
"PASSWORD": os.environ.get("U_PASS"),
... | 2.421875 | 2 |
wavepy.py | gregbad/WavePy | 1 | 12769915 | <filename>wavepy.py
# WavePy is a Wave Optics Simulation for Atmospheric Optics Modeling
# Authors: <NAME>, <NAME>, <NAME>
# Michigan Technological University (c) 2016
# WavePy 0.1 Initial Release
# Contact: <EMAIL>
# Released under BSD attribution license please reference
# Maintained at www.github.com/jpbos/WavePy
#... | 2.78125 | 3 |
CCF/CSP/2020/20061.py | cnsteven/online-judge | 1 | 12769916 | <reponame>cnsteven/online-judge
from collections import defaultdict
n, m = map(int, input().split())
points = defaultdict(list)
for _ in range(n):
x, y, t = input().split()
points[t].append((int(x), int(y)))
def test(t0, t1, t2):
for t in points:
off = 0
for x, y in points... | 3.265625 | 3 |
archives/admin.py | kingsdigitallab/sdo-django | 0 | 12769917 | from django.contrib import admin
from archives.models import *
from archives.forms import DocumentForm
class AddressInline(admin.StackedInline):
model = Address
extra = 1
class ContainerStatementInline(admin.TabularInline):
model = ContainerStatements
extra = 1
class DocumentStatementInline(admin... | 1.882813 | 2 |
Cnet/SummaryCallback.py | chriamue/Cnet | 0 | 12769918 | import numpy as np
from keras.callbacks import Callback
from keras import backend as K
import tensorflow as tf
class SummaryCallback(Callback):
def __init__(self, trainer, validation=False):
super(SummaryCallback, self)
self.trainer = trainer
self.summarysteps = trainer.config['summarystep... | 2.421875 | 2 |
app/tasks.py | Spin14/wolf-backend | 2 | 12769919 | import logging
logger = logging.getLogger(__name__)
async def do(param: str) -> None:
pass # pragma: no cover
async def log_something() -> None:
logger.debug("debug log")
logger.info("info log")
logger.warning("warning log")
logger.error("debug log")
logger.critical("critical log")
lo... | 2.640625 | 3 |
tests/test_remove_stress.py | absentabyss/ithkuil | 20 | 12769920 | import pytest
from ithkuil.morphology.words import remove_stress
txts_to_test = [
('a', 'a'),
('o', 'o'),
('áu', 'au'),
('ái', 'ai'),
('aú', 'aù'),
('aé', 'ae'),
('á', 'a')
]
@pytest.mark.parametrize('txt, expected', txts_to_test)
def test_word(txt, expected):
assert remove_stress(txt)... | 3.171875 | 3 |
openmdao.lib/src/openmdao/lib/drivers/test/test_newton.py | MrShoks/OpenMDAO-Framework | 1 | 12769921 | <filename>openmdao.lib/src/openmdao/lib/drivers/test/test_newton.py
"""
Test the Newton solver
"""
import unittest
import numpy
# pylint: disable=F0401,E0611
from openmdao.lib.drivers.newton_solver import NewtonSolver
from openmdao.lib.optproblems.scalable import Discipline
from openmdao.lib.optproblems.sellar import... | 2.171875 | 2 |
model/__init__.py | mfacar/controltac | 3 | 12769922 | from .GloVeModel import GloVeModel
from .Word2vecGoogleModel import Word2vecGoogleModel
| 1.070313 | 1 |
openpifpaf/network/factory.py | adujardin/openpifpaf | 0 | 12769923 | import argparse
import logging
import os
from typing import Tuple
import warnings
import torch
import torchvision
from .. import headmeta
from . import basenetworks, heads, nets
# generate hash values with: shasum -a 256 filename.pkl
PRETRAINED_UNAVAILABLE = object()
# Dataset cocokp is implied. All other datasets... | 1.9375 | 2 |
build/genoken/dna/dnautil.py | k3nnywilliam/genoken | 0 | 12769924 | <gh_stars>0
# -*- coding: utf-8 -*-
#!usr/bin/env python3
#Created by <NAME> 2020
from dna import constant
class DNAUtils:
def __init__(self, dna):
super().__init__()
self.dna = dna
def has_stop_codon(self, frame: int) -> bool:
stop_codon_found = False
for i in range(frame, len... | 3.484375 | 3 |
algorithm/leetcode/Python_2.7.10/00003.py | leonard-sxy/algorithm-practice | 1 | 12769925 | #
## https://leetcode.com/problems/longest-substring-without-repeating-characters/
#
class Solution(object):
def lengthOfLongestSubstring(self, s):
"""
:type s: str
:rtype: int
"""
if s is None:
raise ValueError('Parameter should be a String.')
if len(s) < 2:
return len(s)
st... | 3.34375 | 3 |
quotesbot/spiders/toscrape-css.py | benmoorechd/quotesbot | 0 | 12769926 | <filename>quotesbot/spiders/toscrape-css.py
# -*- coding: utf-8 -*-
import scrapy
class ToScrapeCSSSpider(scrapy.Spider):
name = "www.doralkia.com"
allowed_domains = ['www.doralkia.com']
start_urls = ['https://www.doralkia.com/searchnew.aspx']
rules = [
Rule(
LinkExtractor(
... | 2.28125 | 2 |
bandcamp_parser/album.py | strizhechenko/bandcamp-player | 16 | 12769927 | # coding=utf-8
from random import shuffle
from bs4 import BeautifulSoup
from bandcamp_parser.request import Request
class AlbumResult(object):
""" Just for autocompletion and more 'static' structure instead of json/soup """
def __init__(self, soup):
self.title = soup.attrs['title']
self.href... | 3.09375 | 3 |
examples/test_oscpart.py | Tarheel-Formal-Methods/kaa-optimize | 0 | 12769928 | <reponame>Tarheel-Formal-Methods/kaa-optimize
from kaa.reach import ReachSet
from kaa.plotutil import Plot
from models.oscpart import OscPart
from kaa.timer import Timer
def test_OscPart():
model = OscPart()
#trajs = generate_traj(model, 10, 200)
mod_reach = ReachSet(model)
mod_flow = mod_reach.compu... | 2.03125 | 2 |
src/pushbroom/__init__.py | gpanders/Janitor | 4 | 12769929 | __version__ = "v1.0.0"
from .sweep import sweep
| 1.03125 | 1 |
service/models.py | oscar-king/A-Decentralised-Digital-Identity-Architecture | 4 | 12769930 | <filename>service/models.py
from flask_login import UserMixin
from service import db
class User(UserMixin, db.Model):
y = db.Column(db.String(256), primary_key=True)
def __init__(self, y):
self.y = y
def save_to_db(self):
db.session.add(self)
db.session.commit() | 2.765625 | 3 |
data.py | EyeEyeloving/Replication_selfcar-BC_win10 | 0 | 12769931 | <reponame>EyeEyeloving/Replication_selfcar-BC_win10
"""
Python module to load the data for training
"""
import cv2
import csv
import numpy as np
from sklearn.model_selection import train_test_split
import matplotlib.image as mpimg
from sklearn.utils import shuffle
from tqdm import tqdm
# Function to load dataset
def l... | 2.515625 | 3 |
simpleTweetCrawler.py | maicondmenezes/tweetCrawler | 1 | 12769932 | #@title Biblioteca de funções execute este trecho após o cabeçalho
# -*- coding: utf-8 -*-
def login_Twitter(chave_consumidor, segredo_consumidor, token_acesso, token_acesso_segredo):
#gerando objeto de autenticação
autenticacao = tw.OAuthHandler(chave_consumidor, segredo_consumidor)
#gerando tokens
autenticacao.s... | 3.125 | 3 |
tests/api/test-disp.py | arienchen/pytibrv | 12 | 12769933 |
from pytibrv.status import *
from pytibrv.api import *
from pytibrv.disp import *
import unittest
class DispatcherTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
status = tibrv_Open()
assert status == TIBRV_OK, tibrvStatus_GetText(status)
@classmethod
def tearDownClass(cls... | 2.40625 | 2 |
duke-cs671-fall21-coupon-recommendation/outputs/rules/RF/17_features/numtrees_12/rule_7.py | apcarrik/kaggle | 0 | 12769934 | def findDecision(obj): #obj[0]: Passanger, obj[1]: Weather, obj[2]: Time, obj[3]: Coupon, obj[4]: Coupon_validity, obj[5]: Gender, obj[6]: Age, obj[7]: Maritalstatus, obj[8]: Children, obj[9]: Education, obj[10]: Occupation, obj[11]: Income, obj[12]: Bar, obj[13]: Coffeehouse, obj[14]: Restaurant20to50, obj[15]: Direct... | 2.609375 | 3 |
olednaytto/main.py | divergentti/Micropython | 0 | 12769935 | <reponame>divergentti/Micropython
"""
Scripti lukee sensoria ja näyttää kolme eri sivua tietoja sekä sensorista että ESP32:sta ja lähettää arvot
mqtt-brokerille.
Ulkoiset kirjastot:
SPI OLED näytölle: sh1160-kirjastoa, jonka voit ladata täältä https://github.com/robert-hh/SH1106
SPI kytkentä oletukset:
SS... | 1.734375 | 2 |
PyGems Office Utilities.py | Mamuntheprogrammer/PyGems-Office-Utilities | 1 | 12769936 | <gh_stars>1-10
import re
from tkinter import *
import tkinter as tk
from tkinter.font import Font
import webbrowser
from tkinter import ttk
from tkinter import filedialog,messagebox
from PyPDF2 import PdfFileMerger,PdfFileReader, PdfFileWriter
import glob,string,os,sys,collections,time
import pandas as pd
f... | 2.5 | 2 |
modules/PackerController.py | daveherrald/attack_range | 1 | 12769937 |
from packerpy import PackerExecutable
from jinja2 import Environment, FileSystemLoader
from modules import aws_service
import sys
class PackerController():
def __init__(self, config, log):
self.config = config
self.log = log
self.p = PackerExecutable("/usr/local/bin/packer")
sel... | 2.21875 | 2 |
html2sql/html2sql.py | quangpq/discrete_inference | 1 | 12769938 | <reponame>quangpq/discrete_inference<filename>html2sql/html2sql.py
from bs4 import BeautifulSoup
def openHTMLfile(name):
path = "/Users/quangphan/Documents/Projects/discrete_thesis/data/" + name + ".html"
with open(path, "r") as f:
soup = BeautifulSoup(f, features="html.parser")
tags = soup.fi... | 2.6875 | 3 |
bin/twitch_mod_input.py | meznak/twitch-app-for-splunk | 0 | 12769939 | import sys
import requests
import logging
from splunklib.modularinput import *
class MI(Script):
def get_scheme(self):
scheme = Scheme("Twitch Input")
scheme.description = 'Collect Twitch channel stats'
scheme.use_external_validation = True
scheme.use_single_instance = True
... | 2.515625 | 3 |
M5/Black Box vs White Box.py | DouglasCarvalhoPereira/Interact-OS-PYTHON | 0 | 12769940 | #CONCEITO DE TESTE DE CAIXA BRANCA OU TESTE DE CAIXA PRETA
# > Test White Block - Testes baseados em informações do software. Sãos testes unitários feitos com
#base em conhecimentos prévios do software. Geralmente testes de CAIXA BRANCA são feitos após o código
#estar escrito. Sendo ele feito com partes diferentes do ... | 2.6875 | 3 |
yalefaces/rename.py | AseemPandita/TripletLoss | 1 | 12769941 | <filename>yalefaces/rename.py
import os
files = [f for f in os.listdir('.') if os.path.isfile(f)]
for f in files:
if 'subject' in f and '.bmp' not in f:
os.rename(f, f+'.bmp') | 2.5 | 2 |
egs/zeroth/s5/data/local/lm/buildLM/_scripts_/sumStatUniqWords.py | SYHPARK/kaldi | 330 | 12769942 | <filename>egs/zeroth/s5/data/local/lm/buildLM/_scripts_/sumStatUniqWords.py
#!/usr/bin/env python3
# summation all the stat from uniqWord.JOB
# build uniq word dictionary with count
#
# Copyright 2017 Atlas Guide (Author : <NAME>)
#
# Apache 2.0
#
import fileinput
import json
import sys
def main():
nLine = 1
... | 2.796875 | 3 |
csb/io/plots.py | ujjwalsh/CSB | 10 | 12769943 | """
Plotting facilities, based on Python's MPL library.
The L{Chart} object is a facade which provides intuitive access to MPL's plotting
objects. The following examples show a typical use of L{Chart}:
1. Instantiation
>>> chart = Chart() # a chart with a single plot
>>> chart... | 3.484375 | 3 |
src/nwb_conversion_tools/tools/neo/neo.py | NeurodataWithoutBorders/nwbn-conversion-tools | 0 | 12769944 | """Author: <NAME>."""
from typing import Optional, Tuple
import distutils.version
import uuid
from datetime import datetime
from pathlib import Path
import warnings
import numpy as np
import neo.io.baseio
import pynwb
from hdmf.backends.hdf5 import H5DataIO
from ..nwb_helpers import add_device_from_metadata
from ...u... | 2.3125 | 2 |
tasks/openqa/e2eqa/async_indexer.py | DevSinghSachan/emdr2 | 51 | 12769945 | import os
import torch
import torch.distributed as dist
from megatron import get_args
from megatron import print_rank_0
from megatron.indexer_emdr2 import IndexBuilder
from megatron.checkpointing import get_checkpoint_tracker_filename
from megatron.initialize import init_distributed, _init_autoresume, _set_random_see... | 2.15625 | 2 |
track_2_openCV/player_tracking.py | Batlytics/Batlytics | 0 | 12769946 | import cv2
import numpy as np
import mediapipe as mp
mp_drawing = mp.solutions.drawing_utils
mp_drawing_styles = mp.solutions.drawing_styles
mp_pose = mp.solutions.pose
# ---------------------------------------------------------------------
filter = np.array(
[
[0, -1, 0],
[-1, 5, -1],
[0,-1... | 2.484375 | 2 |
data.py | nickgerend/GoodRead | 0 | 12769947 | # Written by: <NAME>, @dataoutsider
# Viz: "Good Read", enjoy!
import pandas as pd
import numpy as np
import requests
from bs4 import BeautifulSoup
import re
import matplotlib.pyplot as plt
import os
#region Site 1: https://mostrecommendedbooks.com/best-books
def crawl(url):
content = requests.get(url)
soup... | 3.15625 | 3 |
GRU/gru.py | AndryRafam/Movie-Sentiment-Analysis | 1 | 12769948 | import tensorflow as tf
import numpy as np
import pandas as pd
import re
import nltk
import string
import random
random.seed(0)
np.random.seed(0)
tf.random.set_seed(42)
tf.random.set_seed(42)
from nltk.tokenize import word_tokenize
from nltk.tokenize.treebank import TreebankWordDetokenizer
df = pd.read_csv("imdb.csv... | 2.90625 | 3 |
src/ner/issa_ner/script/main_threading.py | issa-project/knowledge-graph | 0 | 12769949 | <reponame>issa-project/knowledge-graph
import concurrent.futures
import os
import pathlib
import traceback
import cotools
import tqdm
import pycld2
#TODO: obvious!
import sys
sys.path.append('/mnt/c/Users/abobashe/Documents/ISSA/AgritropToRDF/ner/cord19_ner')
from utils.config import Config
from utils.iodata impor... | 1.90625 | 2 |
disparity.py | penguinmenac3/computervision-toolkit | 1 | 12769950 | <reponame>penguinmenac3/computervision-toolkit
import cv2
import time
stereo = cv2.StereoBM_create(numDisparities=16, blockSize=55)
def depth_map(imgL, imgR):
return stereo.compute(imgL, imgR)
def test():
cap_l = cv2.VideoCapture(2)
cap_r = cv2.VideoCapture(1)
last_time = time.time()
while Tr... | 2.703125 | 3 |