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 |
|---|---|---|---|---|---|---|
tmp/wswp/mongo_queue.py | godontop/python | 0 | 12796651 | <reponame>godontop/python<gh_stars>0
from datetime import datetime, timedelta
from pymongo import MongoClient, errors
class MongoQueue:
# possible states of a download
OUTSTANDING, PROCESSING, COMPLETE = range(3)
def __init__(self, client=None, timeout=300):
self.client = MongoClient() if client is None else cl... | 2.84375 | 3 |
Scripts/s4cl_tests/utils/common_function_utils_tests.py | ColonolNutty/Sims4CommunityLibrary | 118 | 12796652 | """
The Sims 4 Community Library is licensed under the Creative Commons Attribution 4.0 International public license (CC BY 4.0).
https://creativecommons.org/licenses/by/4.0/
https://creativecommons.org/licenses/by/4.0/legalcode
Copyright (c) COLONOLNUTTY
"""
from typing import Any
from sims4communitylib.modinfo impo... | 1.773438 | 2 |
check_db_connection.py | dondemonz/python_training_mantis | 0 | 12796653 | <filename>check_db_connection.py
import pymysql.cursors
db = pymysql.connect(host="127.0.0.1", database="bugtracker", user="root", password="")
try:
cursor = db.cursor()
cursor.execute("select * from mantis_project_table")
for row in cursor.fetchall():
print(row)
finally:
db.close() | 2.6875 | 3 |
sockfilter/error.py | cardforcoin/sockfilter | 1 | 12796654 | __all__ = ['SockFilterError']
import collections
class SockFilterError(Exception):
Tuple = collections.namedtuple('SockFilterError', ['address'])
def __init__(self, address):
self.address = address
def __repr__(self):
return repr(self._tuple)
def __str__(self):
return str(... | 2.953125 | 3 |
searching/search_in_sorter_matrix.py | maanavshah/coding-interview | 0 | 12796655 | <filename>searching/search_in_sorter_matrix.py
# O(m + n) time | O(1) space
# m is row and n is col
def searchInSortedMatrix(matrix, target):
row = 0
col = len(matrix[0]) - 1
while row < len(matrix) and col > -1:
if target == matrix[row][col]:
return [row, col]
if target > matrix... | 3.59375 | 4 |
MC_Event_Generator_with_Vegas/event_output.py | GuojinTseng/MY_MC_Generator | 0 | 12796656 | #==========================================================#
# Process: e+e- -> Z/gamma -> mu+mu-
# Author: <NAME>
# Date: 2018.7.16
# Version: 1.0
#==========================================================#
class Event_Output(object):
def output(self, i, p1, p2, p3, p4):
with open("event.txt","a") as... | 2.375 | 2 |
setup.py | anna-money/aio-background | 7 | 12796657 | import re
from pathlib import Path
from setuptools import setup
install_requires = ["croniter>=1.0.1"]
def read(*parts):
return Path(__file__).resolve().parent.joinpath(*parts).read_text().strip()
def read_version():
regexp = re.compile(r"^__version__\W*=\W*\"([\d.abrc]+)\"")
for line in read("aio_bac... | 2.046875 | 2 |
ex43.py | Marcelo1080p/cev | 0 | 12796658 | peso = float(input('Qual é o seu Peso? Kg'))
altura = float(input('Qual é a sua Altura? m'))
imc = peso / (altura ** 2)
print('O seu Indice de massa muscular é {:.1f}'.format(imc))
if imc <= 18.5:
print('Você esta abaixo do Peso!')
elif imc <= 24.9:
print('Peso ideal. Parabéns!')
elif imc <= 29.9:
print('Le... | 3.875 | 4 |
mocks/usocket.py | stefanhoelzl/alarm-clock | 1 | 12796659 | from socket import * | 1.125 | 1 |
backend/swagger_server/service/ocr.py | LeBoucEtMistere/ICHack20 | 5 | 12796660 | from google.cloud import vision
import io
import re
import os
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "swagger_server/firebase_key.json"
client = vision.ImageAnnotatorClient()
def process_image(image_file):
total = -1
with io.open(image_file, 'rb') as image_file:
content = image_file.read()
... | 2.453125 | 2 |
sceptre/__init__.py | bfurtwa/SCeptre | 5 | 12796661 | from .sceptre import *
__version__ = '1.1' | 1.078125 | 1 |
stripe_payment/models.py | aykutgk/GoNaturalistic | 0 | 12796662 | <reponame>aykutgk/GoNaturalistic
from django.db import models
from django.contrib.auth.models import User
#Stripe###########################
class Stripe_Error(models.Model):
user = models.ForeignKey(User, verbose_name="User", blank=True, null=True,on_delete=models.SET_NULL)
date = models.DateTimeField... | 2.171875 | 2 |
tql/algo_ml/models/classifier/baseline_xgb.py | Jie-Yuan/1_DataMining | 14 | 12796663 | <filename>tql/algo_ml/models/classifier/baseline_xgb.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
__title__ = 'xgb'
__author__ = 'JieYuan'
__mtime__ = '19-1-2'
"""
import xgboost as xgb
class BaselineXGB(object):
"""
待补充: https://xgboost.readthedocs.io/en/release_0.81/tutorials/feature_interaction_... | 2.34375 | 2 |
neb/util.py | cstein/neb | 20 | 12796664 | import numpy
""" Utility variables and functions
"""
aa2au = 1.8897261249935897 # bohr / AA
# converts nuclear charge to atom label
Z2LABEL = {
1: 'H', 2: 'He',
3: 'Li', 4: 'Be', 5: 'B', 6: 'C', 7: 'N', 8: 'O', 9: 'F', 10: 'Ne',
11: 'NA', 12: 'Mg... | 2.71875 | 3 |
tests/cid_service_test.py | futoin/citool | 13 | 12796665 | <reponame>futoin/citool<gh_stars>10-100
#
# Copyright 2015-2020 <NAME> <<EMAIL>>
#
# 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... | 1.742188 | 2 |
Tugas 0/Invoice/main.py | hafidh561/Pemrograman-Berorientasi-Objek | 0 | 12796666 | from Invoice import Invoice
def main():
items = [Invoice("RTX 2080", "VGA", 5, 10000000), Invoice("Intel i9 10900K", "Processor", 10, 8000000)]
for item in items:
print(item.part_num)
print(item.part_desc)
print(item.quantity)
print(item.price)
print("Total tagihanmu adalah", item.get_invoice_am... | 3.1875 | 3 |
src/command_modules/azure-cli-network/azure/cli/command_modules/network/zone_file/record_processors.py | enterstudio/azure-cli | 2 | 12796667 | <gh_stars>1-10
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -----------------------------------------------------... | 1.4375 | 1 |
python/PlacingMarbles.py | teinen/atcoder-beginners-selection-answers | 0 | 12796668 | <filename>python/PlacingMarbles.py
l = list(input())
c = 0
if l[0] == '1':
c+=1
if l[1] == '1':
c+=1
if l[2] == '1':
c+=1
print(c)
| 3.390625 | 3 |
csat/acquisition/admin.py | GaretJax/csat | 0 | 12796669 | from django.contrib import admin
from polymorphic.admin import PolymorphicParentModelAdmin
from polymorphic.admin import PolymorphicChildModelAdmin
from csat.acquisition import get_collectors, models
class AcquisitionSessionConfigAdmin(admin.ModelAdmin):
list_display = ('id', 'name', 'started', 'completed', 'te... | 1.953125 | 2 |
eval_pf_willow.py | OliviaWang123456/ncnet | 0 | 12796670 | from __future__ import print_function, division
import os
from os.path import exists
import numpy as np
import torch
import torch.nn as nn
from torch.utils.data import Dataset, DataLoader
from collections import OrderedDict
from lib.model import ImMatchNet
from lib.pf_willow_dataset import PFDataset
from lib.normaliza... | 2.15625 | 2 |
Stock/Data/Engine/Common/DyStockDataCommonEngine.py | Leonardo-YXH/DevilYuan | 135 | 12796671 | <filename>Stock/Data/Engine/Common/DyStockDataCommonEngine.py
from .DyStockDataCodeTable import *
from .DyStockDataTradeDayTable import *
from .DyStockDataSectorCodeTable import *
class DyStockDataCommonEngine(object):
""" 代码表和交易日数据引擎 """
def __init__(self, mongoDbEngine, gateway, info):
self._mongoD... | 2.0625 | 2 |
LC3-Longest Substring Without Repeating Characters.py | karthyvenky/LeetCode-Challenges | 0 | 12796672 | <filename>LC3-Longest Substring Without Repeating Characters.py
class Solution:
def lengthOfLongestSubstring(self, s: str) -> int:
#Leetcode 3 - Longest substring without repeating characters
st = en = poi = 0
substr = temp = ''
maxlen = 0
for i in range(len(s)):
... | 3.59375 | 4 |
lib_collection/graph/dfs_order.py | caser789/libcollection | 0 | 12796673 | <reponame>caser789/libcollection
class DFSOrder(object):
def __init__(self, graph):
self.marked = [False for _ in range(graph.v)]
self.pre = [0 for _ in range(graph.v)]
self.post = [0 for _ in range(graph.v)]
self.pre_order = []
self.post_order = []
self.pre_counter =... | 2.578125 | 3 |
pyvalidator/utils/to_float.py | theteladras/py.validator | 15 | 12796674 | from typing import Union
from ..is_float import is_float
def to_float(input: str) -> Union[float, None]:
if not is_float(input):
return None
else:
return float(input)
| 3.546875 | 4 |
src/sw_adder.py | DavidRivasPhD/mrseadd | 0 | 12796675 | <filename>src/sw_adder.py
from spacy.lang.en.stop_words import STOP_WORDS
def add_sw(new_sw):
STOP_WORDS.add(new_sw)
return
| 1.9375 | 2 |
tests/test_dhcp.py | abaruchi/WhoIsConnected | 0 | 12796676 | import unittest
from ipaddress import IPv4Address, IPv6Address
from unittest.mock import patch
from utils.dhcp import parse_dhcp_lease_file
from utils.config_reader import ConfigData
def config_file_with_black_list(self):
return {
'dhcp': {
'lease_file': './dhcp_leases_test',
... | 2.828125 | 3 |
pincer/middleware/activity_join_request.py | ashu96902/Pincer | 0 | 12796677 | <reponame>ashu96902/Pincer
# Copyright Pincer 2021-Present
# Full MIT License can be found in `LICENSE` at the project root.
"""sent when the user receives a Rich Presence Ask to Join request"""
# TODO: Implement event
| 0.902344 | 1 |
ip/ip_solver.py | bridgelessqiu/NMIN-FPE | 0 | 12796678 | <filename>ip/ip_solver.py
import algo
import numpy as np
import scipy as sp
import networkx as nx
import sys
if __name__ == "__main__":
# --------------------------- #
# Command line inputs #
# --------------------------- #
network_name = str(sys.argv[1])
exp_type = str(sys.argv[2]) # rand... | 2.703125 | 3 |
tests/test_shape_filter.py | fabiommendes/easymunk | 1 | 12796679 | import pickle
import easymunk as p
class TestShapeFilter:
def test_init(self) -> None:
f = p.ShapeFilter()
assert f.group == 0
assert f.categories == 0xFFFFFFFF
assert f.mask == 0xFFFFFFFF
f = p.ShapeFilter(1, 2, 3)
assert f.group == 1
assert f.categories... | 2.46875 | 2 |
makeIGVToolsSortScript.py | imk1/MethylationQTLCode | 0 | 12796680 | <reponame>imk1/MethylationQTLCode
def makeIGVToolsSortScript(bismarkFileNameListFileName, suffix, scriptFileName, codePath):
# Make a script that will use gatk to convert Hapmap files to VCF files
bismarkFileNameListFile = open(bismarkFileNameListFileName)
scriptFile = open(scriptFileName, 'w+')
for line in bisma... | 2.6875 | 3 |
ex2_02.py | FMarnix/Py4Ev | 0 | 12796681 | <reponame>FMarnix/Py4Ev
name = input("Enter your name: ")
print("Hi", name) | 1.984375 | 2 |
dlme_airflow/drivers/oai_xml.py | sul-dlss/dlme-airflow | 0 | 12796682 | <reponame>sul-dlss/dlme-airflow
import intake
import logging
import pandas as pd
from sickle import Sickle
from lxml import etree
class OAIXmlSource(intake.source.base.DataSource):
container = "dataframe"
name = "oai_xml"
version = "0.0.1"
partition_access = True
def __init__(self, collection_url... | 2.234375 | 2 |
app/routers/authentication.py | maktoobgar/fastapi | 1 | 12796683 | <reponame>maktoobgar/fastapi
from fastapi import APIRouter, Depends, status, HTTPException
from fastapi.security import OAuth2PasswordRequestForm
from app import schemas, database, models, token
from app.hashing import Hash
from sqlalchemy.orm import Session
from app.repository import user
router = APIRouter(prefix="/... | 2.5 | 2 |
pycalclib/type/Integer.py | Hedroed/PyCalculator | 1 | 12796684 | #!/usr/bin/env python3
# coding: utf-8
from .BaseType import BaseType
from ..Manager import Register
import re
class Integer(BaseType):
'''Integer type
An Integer is a number that can be written without a fractional component.
An Integer is only compose of digits from 0 to 9.
'''
name = '... | 3.953125 | 4 |
src/backend/database_repository.py | Irsutoro/Where-is-my-money | 0 | 12796685 | <reponame>Irsutoro/Where-is-my-money
from database_management import Database, ResultSet
import configparser
DBINFO = configparser.ConfigParser()
DBINFO.read('database.config')
WMM_MAIN_DB = Database(DBINFO['Database']['Name'], DBINFO['User']['Name'], DBINFO['Database']['Host'], DBINFO['Database']['Port']) | 2.3125 | 2 |
server/app/models.py | byeonggukgong/wintercoding-todolist | 0 | 12796686 | <filename>server/app/models.py
# -*- coding: utf-8 -*-
from app.extensions import db, ma
class Todo(db.Model):
__tablename__ = 'todo'
id = db.Column(db.Integer, primary_key=True)
title = db.Column(db.String, nullable=False)
contents = db.Column(db.String, nullable=False)
priority = db.Column(db.... | 2.40625 | 2 |
plugins/plugin_manager_plugin/__init__.py | StarryPy/StarryPy-Historic | 38 | 12796687 | <filename>plugins/plugin_manager_plugin/__init__.py
from plugin_manager_plugin import PluginManagerPlugin
| 1.25 | 1 |
hackerrank/data-structures/2d-array.py | Ashindustry007/competitive-programming | 506 | 12796688 | #!/usr/bin/env python3
# https://www.hackerrank.com/challenges/2d-array
a=[0]*6
for i in range(6): a[i]=[int(x) for x in input().split()]
c=-9*9
for i in range(1,5):
for j in range(1,5):
c=max(c,a[i-1][j-1]+a[i-1][j]+a[i-1][j+1]+a[i][j]+a[i+1][j-1]+a[i+1][j]+a[i+1][j+1])
print(c)
| 3.15625 | 3 |
evohome_rf/systems.py | NotBobTheBuilder/evohome_rf | 0 | 12796689 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
"""Evohome RF - The evohome-compatible system."""
import logging
from asyncio import Task
from datetime import timedelta as td
from threading import Lock
from typing import List, Optional
from .command import Command, FaultLog, Priority
from .const import (
ATTR_DE... | 2.03125 | 2 |
promise2012/Vnet2d/layer.py | kant/VNet | 64 | 12796690 | <gh_stars>10-100
'''
covlution layer,pool layer,initialization。。。。
'''
import tensorflow as tf
import numpy as np
# Weight initialization (Xavier's init)
def weight_xavier_init(shape, n_inputs, n_outputs, activefuncation='sigmoid', uniform=True, variable_name=None):
if activefuncation == 'sigmoid':
... | 2.5625 | 3 |
encoder.py | Devanshu-singh-VR/Chat_Bot_Attention | 0 | 12796691 | <filename>encoder.py<gh_stars>0
import tensorflow as tf
class Encoder(tf.keras.Model):
def __init__(self, vocab_size, embedding, enc_units, batch_size):
super(Encoder, self).__init__()
self.batch_size = batch_size
self.enc_units = enc_units # Size of the hidden units present in GRU.... | 2.953125 | 3 |
ex6_sd3.py | jlaw8504/lp3thw | 0 | 12796692 | <reponame>jlaw8504/lp3thw
# the other instances of formatting strings used variables that were not
# strings. To prove it, I'll use the function type to print out the
# type of each variable used in a formatted string
# recreate the variables from ex6
types_of_people = 10
x = f"There are {types_of_people} type of peo... | 4.1875 | 4 |
algorithms_datastructures/graphs/implementations/structures.py | vaishnavprachi98/technical-interviews | 65 | 12796693 | <reponame>vaishnavprachi98/technical-interviews<filename>algorithms_datastructures/graphs/implementations/structures.py
"""
@author: <NAME>
@since: 23/08/2016
@modified:
Based Vertex and Edge clases
- a bit too generic too be honest
- should be speific for use
"""
class Vertex:
def __init__(self, x=None, point=No... | 3.734375 | 4 |
data/aml-pipelines-scripts/train.py | ajakupov/DataHawkPipelines | 0 | 12796694 | <gh_stars>0
import argparse
import os
import pandas as pd
import numpy as np
import math
import pickle
from sklearn.model_selection import train_test_split
from sklearn.ensemble import GradientBoostingRegressor
from sklearn.pipeline import Pipeline
from sklearn.impute import SimpleImputer
from sklearn.preprocessing im... | 2.6875 | 3 |
tests/run.py | kapilgarg1996/gmc | 2 | 12796695 | import argparse
import unittest
import os
import importlib
import sys
from gmc.conf import settings, ENVIRONMENT_VARIABLE
from gmc.core import handler
def build_suite(test_labels=None):
suite = unittest.TestSuite()
test_loader = unittest.defaultTestLoader
test_labels = test_labels or ['.']
discover_kw... | 2.46875 | 2 |
config.py | bert386/rpi-flask-bluez-controller | 0 | 12796696 | # -*- coding: utf-8 -*-
""" Singleton class to manage configuration
Description:
Todo:
"""
import json
import os
import sys
import logging
import constant
class Config(object):
# Here will be the instance stored.
__instance = None
@classmethod
def getInstance(cls):
""" Static access method.... | 2.96875 | 3 |
eunice012716/Week1/ch3/3.2/exercise1.py | coookie89/Intern-Training | 1 | 12796697 | <reponame>coookie89/Intern-Training
if __name__ == "__main__":
print(
"Zero Initialization:",
"Since the derivatives will remain same for every w in W[l],",
"this method serves almost no purpose as it causes neurons to perform the same calculation in each iterations and produces same out... | 2.953125 | 3 |
05-matplotlib/q02/question.py | EdwinJUGomez/CDA_2021_EdwinJUGomez | 0 | 12796698 | ##
## Graficacion usando Matplotlib
## ===========================================================================
##
## Construya una gráfica similar a la presentada en el archivo `original.png`
## usando el archivo `data.csv`. La gráfica generada debe salvarse en el
## archivo `generada.png`.
##
## Salve la f... | 3.15625 | 3 |
bin/write_options.py | davidcorne/markdown-editor | 0 | 12796699 | #!/usr/bin/env python
# Written by: DGC
#
#D This is purely for developer use, it will not be included in the program it
#D is just for adding/changing options in the standard Options.pickle file.
#
# python imports
from __future__ import unicode_literals
import os
import csv
import pickle
import sys
import re
# lo... | 2.59375 | 3 |
registration/migrations/0003_student_registration.py | NUKSI911/School-Mng | 0 | 12796700 | <reponame>NUKSI911/School-Mng<gh_stars>0
# Generated by Django 3.0.8 on 2020-07-18 06:14
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('registration', '0002_auto_20200717_1825'),
]
operations = [
migrations.CreateModel(
nam... | 1.757813 | 2 |
main.py | JonathaTrue/Python_par | 0 | 12796701 | import os
clear = lambda: os.system('clear')
clear()
opcao = 1
while(opcao != 0):
print("Atividade de PARADIGMAS")
print(" 1 - QUESTÃO 01")
print(" 2 - QUESTÃO 02")
print(" 3 - QUESTÃO 03")
print(" 4 - QUESTÃO 04")
print(" 5 - QUESTÃO 05")
print(" 0 - PARA SAIR")
prin... | 3.921875 | 4 |
lib/pushtree/pushtree_nfa.py | zepheira/amara | 6 | 12796702 | <reponame>zepheira/amara<gh_stars>1-10
import itertools
from amara.xpath import parser as xpath_parser
from amara.xpath import locationpaths
from amara.xpath.locationpaths import axisspecifiers
from amara.xpath.locationpaths import nodetests
from amara.xpath.functions import nodesets
from amara.xpath.expressions impor... | 2.5625 | 3 |
test/unit/agent/pipelines/syslog.py | empiricompany/nginx-amplify-agent | 1 | 12796703 | # -*- coding: utf-8 -*-
import time
import logging
from logging.handlers import SysLogHandler
from hamcrest import *
from amplify.agent.pipelines.syslog import SyslogTail, SYSLOG_ADDRESSES, AmplifyAddresssAlreadyInUse
from test.base import BaseTestCase, disabled_test
__author__ = "<NAME>"
__copyright__ = "Copyright... | 1.960938 | 2 |
tests/test_sdf_gradient_field_wrt_twist.py | Algomorph/LevelSetFusion-Python | 8 | 12796704 | <gh_stars>1-10
# import unittest
from unittest import TestCase
import numpy as np
from rigid_opt.sdf_gradient_field import calculate_gradient_wrt_twist
from math_utils.transformation import twist_vector_to_matrix2d
def sdf_gradient_wrt_to_twist(live_field, y_field, x_field, twist_vector, offset, voxel_size):
sdf_... | 2.171875 | 2 |
surveytoolbox/PointStore.py | JayArghArgh/survey-toolbox | 0 | 12796705 | <gh_stars>0
class NewPointStore:
# TODO implement local database storage options.
def __init__(self):
self.point_store = {}
self.number_points = 0
def set_new_point(self, point):
point_name = point.get_point_name()
self.point_store[point_name] = point
return True
... | 2.6875 | 3 |
Ex_52.py | soldierloko/Curso-em-Video | 0 | 12796706 | #Faça um programa que leia um número inteiro e diga se ele é ou não um número primo.
num = int(input('Digite um número: '))
tot = 0
for i in range(1,num+1):
if num % i == 0:
print('\033[33m', end='')
tot += 1
else:
print('\033[31m', end='')
print('{} '.format(i), end='')
print('\n\... | 3.96875 | 4 |
shoutout/models.py | samarv/travo | 0 | 12796707 | <reponame>samarv/travo
from django.db import models
class organization(models.Model):
def __str__(self):
return self.name
name = models.CharField(max_length=50, unique=True)
slack_org_id = models.CharField(max_length=50, unique=True)
channel_name = models.CharField(max_length=50)
channel_i... | 2.125 | 2 |
utils.py | emilv/magic-carpet | 0 | 12796708 | import datetime
from enum import Enum
import hitherdither
from PIL import Image
from inky.inky_uc8159 import Inky
WIDTH, HEIGHT = 600, 448
SATURATION = 1.0
start_log = datetime.datetime.now()
last_log = start_log
def log(msg: str) -> None:
global last_log
now = datetime.datetime.now()
diff = (now - las... | 2.75 | 3 |
artifactory_cleanup/context_managers.py | martinm82/artifactory-cleanup | 0 | 12796709 | <gh_stars>0
from contextlib import contextmanager
from teamcity import is_running_under_teamcity
from teamcity.messages import TeamcityServiceMessages
@contextmanager
def block(name):
"""
As TC.block use "name" as a parameter, contextlib.nullcontext() can not be
used directly
"""
yield
@contextma... | 2.1875 | 2 |
tools/doc2md.py | wiltonlazary/Nidium | 1,223 | 12796710 | #!/usr/bin/env python2.7
import json
from pprint import pprint
import os
import sys
import re
import dokumentor
import subprocess
def parseParam(arg, indent=0, isReturn=False):
out = ""
if isReturn:
out += "Returns (%s): %s\n" % (parseParamsType(arg["typed"]), arg["description"])
else:
out... | 2.859375 | 3 |
gokart_pipeliner/pipeliner.py | vaaaaanquish/gokart-pipeliner | 8 | 12796711 | <filename>gokart_pipeliner/pipeliner.py<gh_stars>1-10
from typing import List
import logging
import sys
import luigi
import gokart
from gokart_pipeliner.instantiation_task import InstantiationTask
from gokart_pipeliner.enum import TYPING
from gokart_pipeliner.config_manager import ConfigManager
class GokartPipeline... | 2.234375 | 2 |
apps/combineCSVElectrochem.py | ryanpdwyer/pchem | 0 | 12796712 |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import plotly.express as px
import plotly.graph_objects as go
import streamlit as st
import io
import base64
from util import process_file
def limit_x_values(data, x_column, settings):
st.markdown("### Limit x Range")
x_min = st.number_in... | 2.90625 | 3 |
4_Recursion/recursive_palindrome.py | AnthonyRChao/Problem-Solving-With-Algorithms-And-Data-Structures | 6 | 12796713 | """
Write a function that takes a string as a parameter and returns True if the
string is a palindrome, False otherwise.
"""
from string import ascii_lowercase
def palindrome(mystr):
mystr = mystr.lower()
mystr_char_list = []
for char in mystr:
if char in ascii_lowercase:
mystr_cha... | 3.96875 | 4 |
consensus/entities/member.py | flaudanum/consensus | 0 | 12796714 | <gh_stars>0
from typing import Sequence, Optional
from consensus.entities.alternative import Alternative
from consensus.entities.ranking import Ranking
class Member:
@property
def name(self):
return self._name
@property
def ranking(self) -> Ranking:
return self._ranking
def __in... | 2.75 | 3 |
pipescaler/processors/threshold_processor.py | KarlTDebiec/PipeScaler | 1 | 12796715 | <reponame>KarlTDebiec/PipeScaler<gh_stars>1-10
#!/usr/bin/env python
# pipescaler/processors/threshold_processor.py
#
# Copyright (C) 2020-2021 <NAME>
# All rights reserved.
#
# This software may be modified and distributed under the terms of the
# BSD license.
from __future__ import annotations
from argpars... | 2.78125 | 3 |
example_problems/tutorial/graph_connectivity/bots/certificate_of_connectivity_bot.py | romeorizzi/TAlight | 3 | 12796716 | #!/usr/bin/env python3
from sys import stderr, exit
import sys
import graph_connectivity_lib as gcl
def startAlgo():
numNodes = None
spoon = input().strip()
# Getting graph
while spoon[:len("graph:")] != "graph:":
# Getting number of nodes
if spoon[:len("# number of nodes:")] == "# ... | 3.296875 | 3 |
examples/text_classificaiton/functional.py | Zzoay/YaoNLP | 0 | 12796717 | <filename>examples/text_classificaiton/functional.py
from torch import max
from torch.nn.functional import cross_entropy
def compute_acc(logit, y_gt):
predicts = max(logit, 1)[1]
corrects = (predicts.view(y_gt.size()).data == y_gt.data).float().sum()
accuracy = 100.0 * float(corrects/len(y_gt))
retu... | 2.671875 | 3 |
ml/notebook_examples/functions/main.py | bhjeong-goldenplanet/automl | 146 | 12796718 | <filename>ml/notebook_examples/functions/main.py
import logging
import datetime
import logging
import time
import kfp
import kfp.compiler as compiler
import kfp.dsl as dsl
import requests
# TODO: replace yours
# HOST = 'https://<yours>.pipelines.googleusercontent.com'
HOST = 'https://7c7f7f3e3d11e1d4-dot-us-centr... | 2.34375 | 2 |
tha2/nn/batch_module/batch_input_module.py | luuil/talking-head-anime-2-demo | 626 | 12796719 | from abc import ABC, abstractmethod
from typing import List
from torch import Tensor
from torch.nn import Module
from tha2.nn.base.module_factory import ModuleFactory
class BatchInputModule(Module, ABC):
def __init__(self):
super().__init__()
@abstractmethod
def forward_from_batch... | 2.5625 | 3 |
Externals/micromegas_4.3.5/Packages/smodels-v1.1.0patch1/smodels/tools/externalNllFast.py | yuanfangtardis/vscode_project | 0 | 12796720 | <gh_stars>0
#!/usr/bin/env python
"""
.. module:: externalNllFast
:synopsis: Wrapper for all nllfast versions.
.. moduleauthor:: <NAME> <<EMAIL>>
"""
from __future__ import print_function
try:
import commands as executor
except ImportError:
import subprocess as executor
import os
from smodels.tools.exter... | 2.03125 | 2 |
musicmod/__init__.py | alfonsof/music-list | 1 | 12796721 | # __init__.py
__all__ = ['createlist', 'viewlist'] | 1.09375 | 1 |
pysnmp/TRENDMICRO-NVW-MIB.py | agustinhenze/mibs.snmplabs.com | 11 | 12796722 | <reponame>agustinhenze/mibs.snmplabs.com
#
# PySNMP MIB module TRENDMICRO-NVW-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TRENDMICRO-NVW-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:20:11 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang... | 1.429688 | 1 |
tools/sample.py | VanessaDo/cloudml-samples | 1,552 | 12796723 | <gh_stars>1000+
# Copyright 2018 Google LLC
#
# 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 ... | 2.5625 | 3 |
FreeCodeCamp.org/Inheritance/ChineseChef.py | MizaN13/PythonAbc | 0 | 12796724 | from Chef import Chef
# inheriting Chef class from ChineseChef class
class ChineseChef(Chef):
def make_special_dish(self):
print("The chef makes orange chicken")
def make_fried_rice(self):
print("The Chef makes fried rice.") | 3.390625 | 3 |
00_Code/01_LeetCode/525_ContiguousArray.py | KartikKannapur/Data_Structures_and_Algorithms_Python | 1 | 12796725 | """
Given a binary array, find the maximum length of a contiguous subarray with equal number of 0 and 1.
Example 1:
Input: [0,1]
Output: 2
Explanation: [0, 1] is the longest contiguous subarray with equal number of 0 and 1.
Example 2:
Input: [0,1,0]
Output: 2
Explanation: [0, 1] (or [1, 0]) is a longest contiguous sub... | 4.0625 | 4 |
test/drafts/2017-09-29_1852 Overall Testing/002.py | friedrichromstedt/upy | 3 | 12796726 | import numpy
import upy2
from upy2 import u, U
from upy2.typesetting import ScientificTypesetter
# This test probably doesn't demonstrate the intended behaviour
# anymore since :func:`upy2.numpy_operators.install_numpy_operators`
# is now called unconditionally upon importing ``upy2``.
U(2).default()
ScientificTypese... | 2.28125 | 2 |
tests/test_piece_builder.py | victor-paltz/embedding-reader | 6 | 12796727 | <filename>tests/test_piece_builder.py
from embedding_reader.piece_builder import build_pieces
import random
import pytest
import pandas as pd
def build_random_filecounts(min_count=100, max_count=10000):
count_before = 0
results = []
for i in range(1000):
r = random.randint(min_count, max_count)
... | 2.34375 | 2 |
iota/commands/extended/broadcast_and_store.py | EasonC13/iota.py | 347 | 12796728 | <reponame>EasonC13/iota.py<gh_stars>100-1000
from iota.commands import FilterCommand
from iota.commands.core.broadcast_transactions import \
BroadcastTransactionsCommand
from iota.commands.core.store_transactions import StoreTransactionsCommand
import asyncio
__all__ = [
'BroadcastAndStoreCommand',
]
class B... | 2.46875 | 2 |
lol.py | BDOGS2000/website_spamer-reloader | 1 | 12796729 | <filename>lol.py
import time
from selenium import webdriver
import requests
driver = webdriver.Chrome("driver.exe")
def main():
url = input("URL: ")
driver.get(url)
count = 0
input()
tap_closer()
while True:
count += 1
r = requests.get(url)
print(str(count) + " : " + ... | 2.984375 | 3 |
ImitationLearning/VisualAttention/Decoder.py | Suryavf/SelfDrivingCar | 11 | 12796730 | <reponame>Suryavf/SelfDrivingCar<gh_stars>10-100
import torch
import torch.nn as nn
from IPython.core.debugger import set_trace
import ImitationLearning.VisualAttention.network.Gate as G
""" Basic Decoder Module
--------------------
Ref: <NAME>., & <NAME>. (2017). "Interpretable learning for self-driving
... | 2.859375 | 3 |
d3.py | Otavioarp/Desafio | 0 | 12796731 | '''
<NAME>
Email: <EMAIL>
'''
def retorna_pessoas_preferem_um_unico_palco(quantidade_pessoas_evento):
return int ( 25 / 100 * quantidade_pessoas_evento ) | 1.632813 | 2 |
tests/regressiontests/forms/localflavor/jp.py | huicheese/Django-test3 | 23 | 12796732 | <filename>tests/regressiontests/forms/localflavor/jp.py
# -*- coding: utf-8 -*-
# Tests for the contrib/localflavor/ JP form fields.
tests = r"""
# JPPostalCodeField ###############################################################
A form field that validates its input is a Japanese postcode.
Accepts 7 digits(with/out... | 2.25 | 2 |
__init__.py | codefresh-customer-success/yeti | 0 | 12796733 | #!/usr/local/bin/python3
### IMPORTS ###
### FUNCTIONS ###
### CLASSES ###
| 1.554688 | 2 |
generate_encodings.py | AsimMessi/FaceRecognition | 0 | 12796734 | <gh_stars>0
from tqdm import tqdm
import face_recognition
import glob
import csv
import numpy as np
def generate_training_data(folder):
r=0
print("Generating encodings for db images..")
image_encodings=[]
with tqdm(total=len(glob.glob(folder+"/*.jpg"))) as pbar:
for img in glob.glob(folder+"/*.... | 2.859375 | 3 |
tests/lib/util/test_utils.py | CMSgov/qpp-claims-to-quality-public | 13 | 12796735 | <filename>tests/lib/util/test_utils.py
"""Test util files."""
import json
from claims_to_quality.lib.util import new_relic_insights, slack
import mock
def test_new_relic_insights_payload():
"""Test NR insights payload creation."""
event = {
'environment': 'TEST',
'success': 'True'
}
... | 2.234375 | 2 |
sung.pw/test_shellcode32.py | rmagur1203/exploit-codes | 0 | 12796736 | from pwn import *
context.log_level = 'debug'
e = ELF('./test_shellcode32')
r = remote("sunrin.site", 9017)#process('./test_shellcode32')
context(arch='i386', os='linux')
sc = shellcraft.pushstr('/home/pwn/flag')
sc += shellcraft.open("esp", 0, 0) # fd = open("./flag", 0, 0);
sc += shellcraft.read("eax", "esp", 100... | 1.609375 | 2 |
roomba_600_driver/launch/teleop.launch.py | 3ccd/create_autonomy | 0 | 12796737 | <reponame>3ccd/create_autonomy
from launch import LaunchDescription
from launch_ros.actions import Node
from launch.actions import DeclareLaunchArgument, SetEnvironmentVariable
from launch.substitutions import LaunchConfiguration, ThisLaunchFileDir
config = LaunchConfiguration(
'params', default=[ThisLaunchFi... | 2.140625 | 2 |
check_colors.py | IgaLewandowska/Check_colors | 1 | 12796738 | #import Pillow
#from colors.py import generate_colors
import colorthief
from colorthief import ColorThief
import glob
from pathlib import Path
def get_colors(image):
dominant_color = ColorThief(image).get_palette(color_count=3, quality=3)
return dominant_color
#print (get_colors('blockchains/polygon/info/logo.png'... | 3.09375 | 3 |
english.py | procedure2012/MyDict | 0 | 12796739 | import pandas as pd
from crawler import MyDict
class MyEnglishDict(MyDict):
def __init__(self, url):
super(MyEnglishDict, self).__init__(url)
def lookup(self, word):
output = {}
raw_text = self.get_web_result(self.url, word)
phonetic_symbols = raw_text.find(name='ul', class... | 3.203125 | 3 |
weatherstation/misc/utils.py | CombatMage/weatherstation_py | 0 | 12796740 | <filename>weatherstation/misc/utils.py
"""utils for setting locale and getting well formated time"""
import os
import platform
import locale
import time
def read_api_key(path):
"""read api key from given path"""
path = os.path.abspath(path)
if not os.path.exists(path):
raise ValueError("no key fo... | 3.09375 | 3 |
cyllene/g_graphclass.py | liuzhengqi1996/math452 | 3 | 12796741 | import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid.axislines import SubplotZero
import numpy as np
import cyllene.f_functionclass as f_funct
import sympy as sp
'''
A lot of problems need to be resolved:
1)Can we keep a record of the graphs graphed? this can be done by just keeping the numpy arrays ?
2)w... | 3.046875 | 3 |
ex055.py | PedroHPAlmeida/exercicios-Python-CEV | 0 | 12796742 | <reponame>PedroHPAlmeida/exercicios-Python-CEV
#entrada & processamento
for i in range(0, 5):
peso = float(input(f'Peso da 1ª pessoa: '))
if i == 0:
maior = menor = peso
else:
if peso > maior:
maior = peso
if peso < menor:
menor = peso
#saida
print(f'O maior ... | 3.78125 | 4 |
src/denzel/app/logic/pipeline.py | eliorc/denzel | 17 | 12796743 | <filename>src/denzel/app/logic/pipeline.py
# -------- Handled by api container --------
def verify_input(json_data):
"""
Verifies the validity of an API request content
:param json_data: Parsed JSON accepted from API call
:type json_data: dict
:return: Data for the the process function
"""
... | 2.703125 | 3 |
main.py | CarlFredriksson/sentiment_classification | 0 | 12796744 | import sc_utils
import model_factory
import numpy as np
from keras.preprocessing.text import Tokenizer
from keras.preprocessing.sequence import pad_sequences
INPUT_LENGTH = 100
# Prepare data
X_train, Y_train, X_test, Y_test = sc_utils.load_data()
X_train, Y_train, X_val, Y_val, X_test, Y_test, tokenizer = sc_utils.p... | 2.8125 | 3 |
snakefmt/__main__.py | jeremiahlewis-vw/snakefmt | 83 | 12796745 | <filename>snakefmt/__main__.py
import sys
from snakefmt import snakefmt
if __name__ == "__main__":
sys.exit(snakefmt.main())
| 1.65625 | 2 |
reddit2telegram/new_channel.py | soulofrubber/reddit2telegram | 187 | 12796746 | #encoding:utf-8
import os
import utils.channels_stuff
def run_script(channel):
os.system('python supplier.py --sub ' + channel.lower())
def med_fashioned_way():
subreddit_name = input('Subreddit name: ')
channel_name = input('Channel name: ')
tags = input('#Tags #in #that #way: ')
print('Subm... | 2.515625 | 3 |
paper_code/distributed_evolution/policies/core.py | adam-katona/QualityEvolvabilityES | 1 | 12796747 | #Copyright (c) 2019 Uber Technologies, Inc.
#
#Licensed under the Uber Non-Commercial License (the "License");
#you may not use this file except in compliance with the License.
#You may obtain a copy of the License at the root directory of this project.
#
#See the License for the specific language governing permission... | 2.078125 | 2 |
client/scripts/assets/generator_strings.py | thefstock/FirstockPy | 1 | 12796748 | DATASOURCE = """
\"\"\"
Datasource for handling {module} operations
\"\"\"
from ...utils.datasources import NorenRestDataSource
from . import endpoints
from .models import *
class {classname}DataSource(NorenRestDataSource):
\"\"\"
Datasource for handling {module} operations
\"\"\"
pass
"""
ENDPOINTS = """
\"\... | 2.421875 | 2 |
saltcontainers/models.py | dincamihai/pytest-containers | 7 | 12796749 | <filename>saltcontainers/models.py
import re
import json
import yaml
import tarfile
import logging
import six
import subprocess
from .utils import retry, load_json
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
class ContainerModel(dict):
def _get_container_pid(self, pid):
container_... | 1.90625 | 2 |
chronometer/test_rx.py | andrewgryan/bokeh-playground | 3 | 12796750 | import unittest
import rx
class History(rx.Stream):
def __init__(self):
self.events = []
super().__init__()
def notify(self, value):
self.events.append(value)
class TestRx(unittest.TestCase):
def test_combine_streams(self):
clicks = rx.Stream()
indices = rx.Strea... | 2.84375 | 3 |