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 |
|---|---|---|---|---|---|---|
2009/plotting_data_monitor/_distrib.py | mikiec84/code-for-blog | 1,199 | 20000 | from eblib import libcollect
# Create a LibCollect object
lc = libcollect.LibCollect()
# Prepare arguments for do_collect
#
# Path to the script (can be absolute or relative)
scriptname = 'plotting_data_monitor.pyw'
# Ask the resulting distribution to be placed in
# directory distrib
targetdir = 'distr... | 1.945313 | 2 |
tests/conftest.py | cread/aws-parallelcluster-node | 33 | 20001 | # Copyright 2019 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "LICENSE.txt" file accom... | 2.640625 | 3 |
scripts/fastrfaa.py | Facenapalm/NapalmBot | 4 | 20002 | <reponame>Facenapalm/NapalmBot
"""
Maintainer script for ruwiki's administrator attention requests table
([[:ru:ВП:ЗКАБ]]).
Log file is used for saving "администратор" field in deleted requests.
Usage:
python fastrfaa.py [logfile]
"""
import re
import sys
from datetime import datetime
import pywikibot
REGEXP = ... | 1.960938 | 2 |
rssfly/tests/common.py | lidavidm/rssfly | 1 | 20003 | # Copyright 2021 <NAME>
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... | 2.109375 | 2 |
scripts/generate.py | maruina/diagrams | 0 | 20004 | import os
import sys
from typing import Iterable
from jinja2 import Environment, FileSystemLoader, Template
import config as cfg
from . import app_root_dir, doc_root_dir, resource_dir, template_dir
_usage = "Usage: generate.py <onprem|aws|gcp|azure|k8s|alibabacloud|oci|programming|saas>"
def load_tmpl(tmpl: str) -... | 2.328125 | 2 |
src/GUI/menuTypes.py | Vidhu007/Cloud-Encryption | 7 | 20005 | import users
import sys
import encryption
import googleDriveAPI
u= users
e= encryption
g= googleDriveAPI
#Function to generate menu for privileged (admin) user
def privilegeMenu():
try:
while True:
#Menu system used to navigate the management console
user_In = input("|U - Upload fi... | 3.3125 | 3 |
eap_backend/eap_api/migrations/0005_alter_eapuser_is_active.py | alan-turing-institute/AssurancePlatform | 5 | 20006 | # Generated by Django 3.2.8 on 2022-05-31 10:13
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("eap_api", "0004_auto_20220531_0935"),
]
operations = [
migrations.AlterField(
model_name="eapuser",
name="is_active"... | 1.585938 | 2 |
lucid_torch/transforms/monochrome/TFMSMonochromeTo.py | HealthML/lucid-torch | 1 | 20007 | import torch
class TFMSMonochromeTo(torch.nn.Module):
def __init__(self, num_dimensions: int = 3):
super(TFMSMonochromeTo, self).__init__()
if not isinstance(num_dimensions, int):
raise TypeError()
elif num_dimensions < 2:
raise ValueError()
self.num_dimensi... | 2.9375 | 3 |
python/paddle/v2/framework/tests/test_modified_huber_loss_op.py | AI-books/Paddle | 0 | 20008 | import unittest
import numpy as np
from op_test import OpTest
def modified_huber_loss_forward(val):
if val < -1:
return -4 * val
elif val < 1:
return (1 - val) * (1 - val)
else:
return 0
class TestModifiedHuberLossOp(OpTest):
def setUp(self):
self.op_type = 'modified_... | 2.71875 | 3 |
bots.py | FatherUsarox/generadorqr | 0 | 20009 | <reponame>FatherUsarox/generadorqr
#!/usr/bin/env python
# pylint: disable=C0116,W0613
# This program is dedicated to the public domain under the CC0 license.
"""
First, a few callback functions are defined. Then, those functions are passed to
the Dispatcher and registered at their respective places.
Then, the bot is ... | 2.984375 | 3 |
src/tests/TestQuadratureRule.py | WaveBlocks/WaveBlocks | 0 | 20010 | """The WaveBlocks Project
Plot some quadrature rules.
@author: <NAME>
@copyright: Copyright (C) 2010, 2011 <NAME>
@license: Modified BSD License
"""
from numpy import squeeze
from matplotlib.pyplot import *
from WaveBlocks import GaussHermiteQR
tests = (2, 3, 4, 7, 32, 64, 128)
for I in tests:
Q = Gauss... | 2.734375 | 3 |
neural_network.py | lee-winchester/deep-neural-network | 0 | 20011 | import os
import cv2
import numpy as np
import matplotlib.pyplot as plt
import scipy
ROWS = 64
COLS = 64
CHANNELS = 3
TRAIN_DIR = 'Train_data/'
TEST_DIR = 'Test_data/'
train_images = [TRAIN_DIR+i for i in os.listdir(TRAIN_DIR)]
test_images = [TEST_DIR+i for i in os.listdir(TEST_DIR)]
def read_image(file_path):
... | 2.9375 | 3 |
main.py | UstymHanyk/NearbyMovies | 1 | 20012 | """
A module for generating a map with 10 nearest movies
"""
from data_reader import read_data, select_year
from locations_finder import coord_finder, find_nearest_movies
from map_generator import generate_map
def start():
year = int(input("Please enter a year you would like to have a map for:"))
user_location... | 4.09375 | 4 |
wbtools/lib/nlp/entity_extraction/ntt_extractor.py | WormBase/wbtools | 1 | 20013 | import math
import re
from typing import List, Dict
from wbtools.db.generic import WBGenericDBManager
from wbtools.lib.nlp.common import EntityType
from wbtools.lib.nlp.literature_index.abstract_index import AbstractLiteratureIndex
ALL_VAR_REGEX = r'({designations}|m|p|It)(_)?([A-z]+)?([0-9]+)([a-zA-Z]{{1,4}}[0-9]*)?... | 2.109375 | 2 |
tests/feature_extractors/test_bitteli.py | yamathcy/motif | 21 | 20014 | """Test motif.features.bitteli
"""
import unittest
import numpy as np
from motif.feature_extractors import bitteli
def array_equal(array1, array2):
return np.all(np.isclose(array1, array2, atol=1e-7))
class TestBitteliFeatures(unittest.TestCase):
def setUp(self):
self.ftr = bitteli.BitteliFeatures... | 2.53125 | 3 |
data-structures/trees/node/node.py | b-ritter/python-notes | 1 | 20015 | <gh_stars>1-10
class Node():
def __init__(self, value=None):
self.children = []
self.parent = None
self.value = value
def add_child(self, node):
if type(node).__name__ == 'Node':
node.parent = self
self.children.append(node)
else:
... | 3.515625 | 4 |
qf_lib/backtesting/events/time_event/regular_date_time_rule.py | webclinic017/qf-lib | 198 | 20016 | # Copyright 2016-present CERN – European Organization for Nuclear Research
#
# 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... | 2.328125 | 2 |
example_project/blog/migrations/0001_initial.py | allran/djangorestframework-appapi | 4 | 20017 | # Generated by Django 2.2.6 on 2019-10-16 02:53
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... | 1.867188 | 2 |
hamming/hamming.py | olepunchy/exercism-python-solutions | 1 | 20018 | """Hamming Distance from Exercism"""
def distance(strand_a, strand_b):
"""Determine the hamming distance between two RNA strings
param: str strand_a
param: str strand_b
return: int calculation of the hamming distance between strand_a and strand_b
"""
if len(strand_a) != len(strand_b):
... | 3.921875 | 4 |
python/scopePractice.py | 5x5x5x5/Back2Basics | 0 | 20019 | <reponame>5x5x5x5/Back2Basics
#def spam():
# eggs = 31337
#spam()
#print(eggs)
"""
def spam():
eggs = 98
bacon()
print(eggs)
def bacon():
ham = 101
eggs = 0
spam()
"""
"""
# Global variables can be read from local scope.
def spam():
print(eggs)
eggs = 42
spam()
print(eggs)
"""
"""
# Loca... | 4.21875 | 4 |
utils/csv_generator.py | stegmaierj/CellSynthesis | 1 | 20020 | # -*- coding: utf-8 -*-
"""
# 3D Image Data Synthesis.
# Copyright (C) 2021 <NAME>, <NAME>, <NAME>, <NAME>, <NAME>
#
# 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 Liceense at
#
# http://www.apache.... | 2.609375 | 3 |
test/test_VersionUpdaterWindow.py | jmarrec/IDFVersionUpdater2 | 0 | 20021 | <filename>test/test_VersionUpdaterWindow.py
import os
import sys
import tempfile
import unittest
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', 'IDFVersionUpdater'))
from VersionUpdaterWindow import VersionUpdaterWindow
class TestGetIDFVersion(unittest.TestCase):
def setUp(self)... | 2.71875 | 3 |
Algorithm/Mathematical/453. Minimum Moves to Equal Array Elements.py | smsubham/Data-Structure-Algorithms-Questions | 0 | 20022 | <filename>Algorithm/Mathematical/453. Minimum Moves to Equal Array Elements.py
# https://leetcode.com/problems/minimum-moves-to-equal-array-elements/
# Explanation: https://leetcode.com/problems/minimum-moves-to-equal-array-elements/discuss/93817/It-is-a-math-question
# Source: https://leetcode.com/problems/minimum-mov... | 3.5625 | 4 |
tests/test_decisions.py/test_binary_decision.py | evanofslack/pyminion | 5 | 20023 | <gh_stars>1-10
from pyminion.decisions import binary_decision
def test_yes_input(monkeypatch):
monkeypatch.setattr("builtins.input", lambda _: "y")
assert binary_decision(prompt="test") is True
def test_no_input(monkeypatch):
monkeypatch.setattr("builtins.input", lambda _: "n")
assert binary_decisio... | 2.5 | 2 |
commands/limit.py | nstra111/autovc | 177 | 20024 | <filename>commands/limit.py
import utils
import functions as func
from commands.base import Cmd
help_text = [
[
("Usage:", "<PREFIX><COMMAND>\n"
"<PREFIX><COMMAND> `N`"),
("Description:",
"Use when already in a channel - Limit the number of users allowed in your channel ... | 2.609375 | 3 |
salt/tests/unit/modules/test_metalk8s_solutions.py | zarumaru/metalk8s | 0 | 20025 | import errno
import os.path
import yaml
from parameterized import param, parameterized
from salt.exceptions import CommandExecutionError
from salttesting.mixins import LoaderModuleMockMixin
from salttesting.unit import TestCase
from salttesting.mock import MagicMock, mock_open, patch
import metalk8s_solutions
from... | 2.359375 | 2 |
fun.py | Krishna-Aaseri/Python_Logical_Questions | 0 | 20026 | <filename>fun.py
#def add(num,num1):
# add1=num+num1
# print add1
#add(6,7)
#def welcome():
# print "python kaisa lagta h aapko"
# print "but please reply na kare aap"
#welcome()
user = int(raw_input("enter a number"))
i = 0
new = []
while i < (user):
user1 = int(raw_input("enter a number"))
new.append(user1)
i =... | 3.734375 | 4 |
app.py | 00MB/lottocoin | 2 | 20027 | from lottocoin import app
| 0.855469 | 1 |
api/views_v2.py | GeRDI-Project/HarvesterControlCenter | 0 | 20028 | <reponame>GeRDI-Project/HarvesterControlCenter<gh_stars>0
"""
This is the views module which encapsulates the backend logic
which will be riggered via the corresponding path (url).
"""
import collections
import json
import logging
from django.conf import settings
from django.contrib import messages
from django.contrib... | 1.945313 | 2 |
rin/modules/setu/lolicon.py | oralvi/rinyuuki | 0 | 20029 | <filename>rin/modules/setu/lolicon.py
import datetime
import io
import json
import os
import random
import traceback
import aiohttp
from PIL import Image
import rin
from rin import R
from .config import get_api_num, get_config, key_vaildable_query, set_key_invaild
quota_limit_time = datetime.datetime.now()
def gen... | 2.109375 | 2 |
Python Backend/diarization/build/lib/s4d/__init__.py | AdityaK1211/Final_Year_Project_SCET | 1 | 20030 | <filename>Python Backend/diarization/build/lib/s4d/__init__.py
__author__ = 'meignier'
import s4d.clustering.hac_bic
import s4d.clustering.hac_clr
import s4d.clustering.hac_iv
import s4d.clustering.hac_utils
import s4d.model_iv
from s4d.clustering.cc_iv import ConnectedComponent
from s4d.diar import Diar
from s4d.segm... | 1.390625 | 1 |
docs/demos/theme_explorer/list_group.py | sthagen/facultyai-dash-bootstrap-components | 50 | 20031 | <reponame>sthagen/facultyai-dash-bootstrap-components<gh_stars>10-100
import dash_bootstrap_components as dbc
from dash import html
from .util import make_subheading
list_group = html.Div(
[
make_subheading("ListGroup", "list_group"),
dbc.ListGroup(
[
dbc.ListGroupItem(... | 2.5 | 2 |
products/migrations/0004_auto_20210715_2006.py | keeks-mtl/go-tennis | 0 | 20032 | <gh_stars>0
# Generated by Django 3.2.3 on 2021-07-15 20:06
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('products', '0003_auto_20210709_0117'),
]
operations = [
migrations.AlterField(
model_name='category',
na... | 1.53125 | 2 |
task_landscape.py | aspnetcs/RecurJac-and-CROWN | 54 | 20033 | <filename>task_landscape.py
## task_landscape.py
##
## Run RecurJac/FastLip bounds for exploring local optimization landscape
##
## Copyright (C) 2018, <NAME> <<EMAIL>> and contributors
##
## This program is licenced under the BSD 2-Clause License,
## contained in the LICENCE file in this directory.
## See CREDITS fo... | 2.171875 | 2 |
tests/test_prepareDeploymentContainerDefinitionsStep.py | AdventielFr/ecs-crd-cli | 1 | 20034 | import pytest
from unittest.mock import MagicMock
import logging
from ecs_crd.canaryReleaseInfos import CanaryReleaseInfos
from ecs_crd.prepareDeploymentContainerDefinitionsStep import PrepareDeploymentContainerDefinitionsStep
from ecs_crd.canaryReleaseInfos import ScaleInfos
logger = logging.Logger('mock')
infos = C... | 2.109375 | 2 |
Sim/A_star/A_star.py | Chains99/Battlefield-Simulator | 0 | 20035 | <filename>Sim/A_star/A_star.py
from Sim.A_star.heap import node_heap,heapify_down,heapify_up,extract_min,append_node
from math import inf
from math import pow
# Recibe x, y componentes de la matriz y devuelve la distancia euclideana entre ellos
def euclidean_distance(x, y):
distance = pow(x[0] - y[0], 2) + pow(x... | 2.609375 | 3 |
setup.py | danielcliu/youtube-transcript-channel-api | 7 | 20036 | <filename>setup.py
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="youtube-channel-transcript-api", # Replace with your own username
version="0.0.1",
author="<NAME>",
author_email="<EMAIL>",
description="A python package the utilizes th... | 1.90625 | 2 |
51-100/67.py | yshshadow/Leetcode | 0 | 20037 | <reponame>yshshadow/Leetcode
# Given two binary strings, return their sum (also a binary string).
#
# For example,
# a = "11"
# b = "1"
# Return "100".
class Solution:
def addBinary(self, a, b):
"""
:type a: str
:type b: str
:rtype: str
"""
la = len(a)
lb = l... | 3.484375 | 3 |
src/mds/query.py | phs-rcg/metadata-service | 10 | 20038 | from fastapi import HTTPException, Query, APIRouter
from starlette.requests import Request
from starlette.status import HTTP_404_NOT_FOUND
from .models import db, Metadata
mod = APIRouter()
@mod.get("/metadata")
async def search_metadata(
request: Request,
data: bool = Query(
False,
descript... | 2.6875 | 3 |
src/RTmission/storeinfo/forms.py | shehabkotb/RTmission_backend | 0 | 20039 | <reponame>shehabkotb/RTmission_backend<gh_stars>0
from django import forms
from django.core import validators
from .models import UserInfo
class UserInfoForm(forms.ModelForm):
class Meta:
model = UserInfo
fields = [
'name',
'email',
'phone',
'age',
... | 2.6875 | 3 |
python/54.spiral-matrix.py | kadaliao/leetcode | 0 | 20040 | # @lc app=leetcode.cn id=54 lang=python3
#
# [54] 螺旋矩阵
#
# https://leetcode-cn.com/problems/spiral-matrix/description/
#
# algorithms
# Medium (43.22%)
# Total Accepted: 129.4K
# Total Submissions: 284.1K
# Testcase Example: '[[1,2,3],[4,5,6],[7,8,9]]'
#
# 给你一个 m 行 n 列的矩阵 matrix ,请按照 顺时针螺旋顺序 ,返回矩阵中的所有元素。
#
#
# 示例 ... | 3.84375 | 4 |
tests/test_path.py | Infinidat/infi.gevent-utils | 0 | 20041 | <reponame>Infinidat/infi.gevent-utils
from __future__ import absolute_import
from infi.gevent_utils.os import path
import sys
import os
sys.path.append(os.path.dirname(__file__))
from utils import GreenletCalledValidatorTestCase
class PathTestCase(GreenletCalledValidatorTestCase):
def test_exists(self):
... | 2.078125 | 2 |
download-from-web/govori.py | miroslavradojevic/python-snippets | 0 | 20042 | #!/usr/bin/env python
# Download .mp3 podcast files of Radio Belgrade show Govori da bih te video (Speak so that I can see you)
# grab all mp3s and save them with parsed name and date to the output folder
import requests
import os
import time
import xml.dom.minidom
from urllib.parse import urlparse
url = "https://www.... | 3.265625 | 3 |
setup.py | uhlerlab/conditional_independence | 4 | 20043 | <filename>setup.py
import setuptools
setuptools.setup(
name='conditional_independence',
version='0.1a.4',
description='Parametric and non-parametric conditional independence tests.',
long_description='',
author='<NAME>',
author_email='<EMAIL>',
packages=setuptools.find_packages(exclude=['te... | 1.132813 | 1 |
feedbacks/urls.py | mpyatishev/djfeedback | 0 | 20044 | <gh_stars>0
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
from . import views
urlpatterns = patterns(
'',
url(r'feedback$', views.FeedbackView.as_view(), name='feedback-post')
)
| 1.4375 | 1 |
pygeoapi/provider/mongo.py | paul121/pygeoapi | 0 | 20045 | <filename>pygeoapi/provider/mongo.py
# =================================================================
#
# Authors: <NAME> <<EMAIL>>
#
# Copyright (c) 2019 <NAME>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), ... | 1.78125 | 2 |
examples/ecs/server_interface.py | wangrui1121/huaweicloud-sdk-python | 43 | 20046 | <filename>examples/ecs/server_interface.py<gh_stars>10-100
# -*-coding:utf-8 -*-
from openstack import connection
# create connection
username = "xxxxxx"
password = "<PASSWORD>"
projectId = "xxxxxxxxxxxxxxxxxxxxxxxxxxxx" # tenant ID
userDomainId = "xxxxxxxxxxxxxxxxxxxxxxxxxxxx" # user account ID
auth_url = "xxx... | 2.515625 | 3 |
sdk/python/pulumi_google_native/dlp/v2/stored_info_type.py | AaronFriel/pulumi-google-native | 44 | 20047 | # 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, Union, overload
from ... import _utilities
fro... | 2.140625 | 2 |
python/GafferSceneUI/SceneHistoryUI.py | pier-robot/gaffer | 0 | 20048 | ##########################################################################
#
# Copyright (c) 2019, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistrib... | 0.933594 | 1 |
core/middleware/scheduler.py | jiangxuewen16/hq-crawler | 1 | 20049 | <reponame>jiangxuewen16/hq-crawler<filename>core/middleware/scheduler.py
from django.utils.deprecation import MiddlewareMixin
from django.utils.autoreload import logger
class Scheduler(MiddlewareMixin):
def process_request(self, request):
pass
# logger.info(request)
def process_response(sel... | 1.65625 | 2 |
python/cw/letterfreq2.py | vesche/snippets | 7 | 20050 | #!/usr/bin/env python
from __future__ import division
import sys
from string import ascii_lowercase
with open(sys.argv[1]) as f:
data = f.read().splitlines()
d = {}
for line in data:
for letter in line:
letter = letter.lower()
if letter not in ascii_lowercase+' ':
continue
... | 3.234375 | 3 |
function/python/brightics/function/extraction/test/label_encoder_test.py | GSByeon/studio | 0 | 20051 | import unittest
from brightics.function.extraction.encoder import label_encoder, \
label_encoder_model
from brightics.common.datasets import load_iris
import random
def get_iris_randomgroup():
df = load_iris()
random_group1 = []
random_group2 = []
random_group2_map = {1:'A', 2:'B'}
for i in ra... | 2.828125 | 3 |
data/query-with-params/parameter_supported_query_results.py | samelamin/setup | 7 | 20052 | import hashlib
import json
import logging
import re
import sqlite3
from typing import List, Optional, Tuple
import pystache
from redash.models import Query, User
from redash.query_runner import TYPE_STRING, guess_type, register
from redash.query_runner.query_results import Results, _load_query, create_table
from reda... | 2.078125 | 2 |
notes/migrations/0005_auto_20160130_0015.py | nicbou/markdown-notes | 121 | 20053 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.db.models.deletion
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('notes', ... | 1.578125 | 2 |
Coursework_02/Q3/airport/scenarios.py | eBe02/COMP0037-21_22 | 0 | 20054 | <reponame>eBe02/COMP0037-21_22
'''
Created on 25 Jan 2022
@author: ucacsjj
'''
from .airport_map import MapCellType
from .airport_map import AirportMap
# This file contains a set of functions which build different maps. Only
# two of these are needed for the coursework. Others are ones which were
# used for developi... | 2.90625 | 3 |
setup.py | abkfenris/adm_locations | 0 | 20055 | <filename>setup.py
from setuptools import setup
setup(
name='csv_locate',
version='0.1',
py_modules=['csv_to_json'],
install_requires=[
'click',
'colorama',
'geocoder',
'geojson',
'jinja2',
],
entry_points='''
[console_scripts]
csv_locate=... | 1.679688 | 2 |
app.py | LuizGGoncalves/Corona-Graphics-Python | 0 | 20056 | from flask import Flask
from Config import app_config, app_active
from flask import render_template
from flask_sqlalchemy import SQLAlchemy
import Forms
import LDB
import gGraficos
config = app_config[app_active]
def create_app(config_name):
app = Flask(__name__, template_folder='templates')
app.secret_key... | 2.453125 | 2 |
kitti_meters/frustum.py | HaochengWan/PVT | 27 | 20057 | import numpy as np
import torch
from modules.frustum import get_box_corners_3d
from kitti_meters.util import get_box_iou_3d
__all__ = ['MeterFrustumKitti']
class MeterFrustumKitti:
def __init__(self, num_heading_angle_bins, num_size_templates, size_templates, class_name_to_class_id,
metric='iou_... | 2.125 | 2 |
Base/__init__.py | jasrub/panorama-worker | 2 | 20058 | import os
import json
import ConfigParser
import logging.config
base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# load the shared settings file
settings_file_path = os.path.join(base_dir, 'config', 'settings.config')
settings = ConfigParser.ConfigParser()
settings.read(settings_file_path)
# s... | 2.515625 | 3 |
src/main.py | Grant-Steinfeld/python-ubi-openshift | 7 | 20059 | from flask import Flask
from flask_restplus import Api, Resource, fields
from services.serviceHandler import convertCurrency, getCurrencyExchangeRates
from services.countryCurrencyCodeHandler import (
getCountryAndCurrencyCode,
getCurrencyNameAndCode,
)
app = Flask(__name__)
api = Api(
app,
version="1.... | 2.875 | 3 |
orchestration/run/BrokerActions.py | pjk25/RabbitTestTool | 0 | 20060 | <gh_stars>0
import sys
import io
import subprocess
import threading
import time
import uuid
import os.path
import requests
import json
from random import randint
from UniqueConfiguration import UniqueConfiguration
from CommonConfiguration import CommonConfiguration
from printer import console_out
class BrokerActions:
... | 2.140625 | 2 |
bin/wls_users.py | rstyczynski/wls-tools | 0 | 20061 | <reponame>rstyczynski/wls-tools
#!$BEA_HOME/oracle_common/common/bin/wlst.sh
# default values
admin_name = 'AdminServer'
admin_address = 'localhost'
admin_port = 7001
admin_protocol = 't3'
admin_url = admin_protocol + "://" + admin_address + ":" + str(admin_port)
def usage():
print "dump_users [-s|--server -p|-... | 2.15625 | 2 |
scripts/drop_low_coverage.py | godzilla-but-nicer/SporeLoss | 0 | 20062 | import numpy as np
import pandas as pd
from Bio import AlignIO, Seq
# parameter to determine the maximum missing proportion that we keep
missing_thresh = 0.4
# load the alignments and turn them into a numpy array
alignments = AlignIO.read(snakemake.input[0], 'fasta')
align_arr = np.array([list(rec) for rec in alignme... | 2.671875 | 3 |
get_proc_users.py | dangtrinhnt/gem | 0 | 20063 | <reponame>dangtrinhnt/gem
#! /usr/bin/env python
import sys
from commons import *
def print_proc_users(csv_path, condition_number):
csv_dat = get_dict_data_from_csv_file(csv_path)
if csv_dat:
print "Processing user with condition %s\n" % condition_number
for email in csv_dat:
num = str_to_num(email['src']) ... | 2.78125 | 3 |
fix_ccJSON.py | boada/wmh | 0 | 20064 | import pandas as pd
import sys
def fix(lists):
df = pd.read_json(lists)
df2 = pd.DataFrame([p for p1 in df.players for p in p1])
df2['theme1'] = ''
df2['theme2'] = ''
for i, l in df2.list2.iteritems():
try:
df2.theme2.iloc[i] = l['theme']
except KeyError:
c... | 2.84375 | 3 |
01-Lesson-Plans/03-Python-Pandas/1/Activities/12-functions-02/Unsolved/functions-02.py | tatianegercina/FinTech | 1 | 20065 | <gh_stars>1-10
# Define a function "warble" that takes in a string as an argument, adds " arglebargle" to the end of it, and returns the result.
# Print the result of calling your "warble" function with the argument "hello".
# Define a function "wibble" that takes a string as an argument, prints the argument, prepe... | 3.765625 | 4 |
Section 6 - Modular Programming/Green eggs and ham v4.py | gitjot/python-for-lccs | 10 | 20066 | <reponame>gitjot/python-for-lccs<filename>Section 6 - Modular Programming/Green eggs and ham v4.py
# Event: LCCS Python Fundamental Skills Workshop
# Date: Dec 2018
# Author: <NAME>, PDST
# eMail: <EMAIL>
# Purpose: To find (and fix) two syntax errors
# A program to display Green Eggs and Ham (v4)
def showCho... | 3.125 | 3 |
internal/handlers/singapore.py | fillingthemoon/cartogram-web | 0 | 20067 | <filename>internal/handlers/singapore.py
import settings
import handlers.base_handler
import csv
class CartogramHandler(handlers.base_handler.BaseCartogramHandler):
def get_name(self):
return "Singapore (by Region)"
def get_gen_file(self):
return "{}/singapore_map_processedmap.json".format(se... | 2.703125 | 3 |
code.py | aashray18521/parallelModifiedGrepPython | 0 | 20068 | import multiprocessing
import os
import time
rootdir = input()
keyword = input()
batch_size = 1
def try_multiple_operations(file_path):
try:
with open(file_path, "rb") as f: # open the file for reading
for line in f: # use: for i, line in enumerate(f) if you need line numbers
... | 3.015625 | 3 |
flask_youku/__init__.py | xiaoyh121/program | 176 | 20069 | <filename>flask_youku/__init__.py
from flask import Blueprint, Markup
from flask import render_template
class Youku(object):
"""Flask-Youku extents."""
def __init__(self, app=None, **kwargs):
"""Init Flask-Youku's instance via app object"""
if app:
self.init_app(app)
def init... | 3.125 | 3 |
main.py | DasAnish/TutorMatch | 0 | 20070 | <filename>main.py
from backend import Backend, Tutor, Parent
from kivy.app import App
from kivy.base import Builder
from kivy.uix.widget import Widget
from kivy.uix.label import Label
from kivy.uix.button import Button
from kivy.properties import ObjectProperty
from kivy.core.window import Window
from kivy.uix.image im... | 2.296875 | 2 |
routes/routes.py | aryan9600/SimpleMath-Flask | 0 | 20071 | from flask import Blueprint, request
router = Blueprint("router", __name__)
@router.route("/check")
def check():
return "Congratulations! Your app works. :)"
@router.route("/add", methods=["POST"])
def add():
first_number = request.form['FirstNumber']
second_number = request.form['SecondNumber']
re... | 2.9375 | 3 |
configs/repdet/repdet_repvgg_b1g2_nanopan_nanohead_1x_coco.py | karthiksharma98/mmdetection | 0 | 20072 | _base_ = [
'../_base_/models/repdet_repvgg_pafpn.py',
'../_base_/datasets/coco_detection.py',
'../_base_/schedules/schedule_poly.py', '../_base_/default_runtime.py'
]
# model settings
model = dict(
type='RepDet',
pretrained='/data/kartikes/repvgg_models/repvgg_b1g2.pth',
backbone=dict(
... | 1.265625 | 1 |
tests/test_calculate_branch.py | ivergara/python-abc | 2 | 20073 | <reponame>ivergara/python-abc
import pytest
from tests import assert_source_returns_expected
BRANCH_CASES = [
# Call
('print("hello world")', 'b | print("hello world")'),
# Await
("await noop()", "b | await noop()"),
# Class instantiation
("Noop()", "b | Noop()"),
]
@pytest.mark.parametrize... | 2.859375 | 3 |
client/src/obc.py | estcube/telemetry-forwarding-client | 3 | 20074 | <gh_stars>1-10
# This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild
from pkg_resources import parse_version
from kaitaistruct import __version__ as ks_version, KaitaiStruct, KaitaiStream, BytesIO
if parse_version(ks_version) < parse_version('0.7'):
raise Exception("I... | 1.953125 | 2 |
SourceWatch/buffer.py | spezifanta/SourceWatch | 6 | 20075 | import io
import struct
class SteamPacketBuffer(io.BytesIO):
"""In-memory byte buffer."""
def __len__(self):
return len(self.getvalue())
def __repr__(self):
return '<PacketBuffer: {}: {}>'.format(len(self), self.getvalue())
def __str__(self):
return str(self.getvalue())
... | 2.765625 | 3 |
scripts/npc/holyStone.py | G00dBye/YYMS | 54 | 20076 | # Holy Stone - Holy Ground at the Snowfield (3rd job)
questIDs = [1431, 1432, 1433, 1435, 1436, 1437, 1439, 1440, 1442, 1443, 1445, 1446, 1447, 1448]
hasQuest = False
for qid in questIDs:
if sm.hasQuest(qid):
hasQuest = True
break
if hasQuest:
if sm.sendAskYesNo("#b(A mysterious energy surroun... | 2.203125 | 2 |
pyvmodule/expr.py | tanhongze/pyvmodule | 0 | 20077 | <filename>pyvmodule/expr.py
#-- coding:utf-8
from .ast import ASTNode
from .compute.value import expr_value_calc_funcs,expr_value_prop_funcs
from .compute.width import expr_width_calc_funcs,expr_width_fix_funcs
from .compute.width import expr_match_width,expr_calc_width
from .tools.utility import count_one
import... | 2.34375 | 2 |
Common_3/Tools/ForgeShadingLanguage/generators/d3d.py | divecoder/The-Forge | 3,058 | 20078 | """ GLSL shader generation """
from utils import Stages, getHeader, getShader, getMacro, genFnCall, fsl_assert, get_whitespace
from utils import isArray, getArrayLen, getArrayBaseName, getMacroName, DescriptorSets, is_groupshared_decl
import os, sys, importlib, re
from shutil import copyfile
def pssl(fsl, dst, rootSi... | 2.109375 | 2 |
test/relationships/test_minhash.py | bateman-research/search-sifter | 1 | 20079 | <reponame>bateman-research/search-sifter
import pytest
import searchsifter.relationships.minhash as mh
import searchsifter.relationships.jaccard as jc
@pytest.mark.parametrize("a, b, result", [
({1, 2}, {2}, 0.5),
({1, 2}, {2, 3}, 1/3),
({1}, {2}, 0),
({1}, {1}, 1)
])
def test_jaccard(a, b, result):
... | 2.3125 | 2 |
cartographer/utils/collections.py | Patreon/cartographer | 29 | 20080 | def filter_dict(dictionary_to_filter):
return dict((k, v) for k, v in dictionary_to_filter.items() if v is not None)
| 2.59375 | 3 |
tests/integration/test_between_tags.py | liorbass/pydriller | 583 | 20081 | # Copyright 2018 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softwa... | 2.234375 | 2 |
tests/modules/command/button/test_wa_url_parameter.py | d3no/mocean-sdk-python | 0 | 20082 | <filename>tests/modules/command/button/test_wa_url_parameter.py
from unittest import TestCase
from moceansdk.modules.command.button.wa_url_parameter_button import (
WaUrlParameterButton,
)
class TestWaUrlParameter(TestCase):
def test_type(self):
self.assertEqual(WaUrlParameterButton().type(), "url")
... | 3.09375 | 3 |
src/python/pants/backend/go/target_types.py | Eric-Arellano/pants | 0 | 20083 | <filename>src/python/pants/backend/go/target_types.py
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import os
from dataclasses import dataclass
from typing import Sequence
from pants.core.goals.pac... | 1.953125 | 2 |
iris/src/iris/main.py | headma5ter/wall-e | 0 | 20084 | <filename>iris/src/iris/main.py
from matplotlib import pyplot as plt
import matplotlib.lines as lines
from statistics import mode, StatisticsError
from csv import QUOTE_ALL
import pandas as pd
import pathlib
import json
from iris import logger
from iris import config
from iris import classifier
from iris.he... | 2.71875 | 3 |
data_loader/util.py | lixiaoyu0575/physionet_challenge2020_pytorch | 1 | 20085 | <filename>data_loader/util.py<gh_stars>1-10
from scipy.io import loadmat
import numpy as np
import os
import torch
from torch.utils.data import Dataset, TensorDataset
from torchvision import transforms
# Find unique classes.
def get_classes(input_directory, filenames):
classes = set()
for filename in filenames... | 2.328125 | 2 |
pyrez/exceptions.py | EthanHicks1/Pyrez | 0 | 20086 | class CustomException(Exception):
def __init__(self, *args, **kwargs):
return super().__init__(self, *args, **kwargs)
def __str__(self):
return str(self.args [1])
class DeprecatedException(CustomException):
def __init__(self, *args, **kwargs):
return super().__init__(*args, **kwargs)... | 2.5 | 2 |
solutions/binarysearch.io/hard/collecting-coins/main.py | zwliew/ctci | 4 | 20087 | class Solution:
2 def solve(self, matrix):
3 from functools import lru_cache
4 @lru_cache(None)
5 def dp(i, j):
6 if i < 0 or j < 0:
7 return 0
8 return max(dp(i - 1, j), dp(i, j - 1)) + matrix[i][j]
9 return dp(len(matrix) - 1, len(matrix[0]) - 1)
| 2.984375 | 3 |
Python 3/First_steps_on_machine_learning/Maze_using_Bellman_equation/Test_Maze.py | DarkShadow4/python | 0 | 20088 | <reponame>DarkShadow4/python
import pygame, sys, maze_builder, random
class Maze(object):
def __init__(self, width, height, grid_length, penalizacion = 0.9): # width and height of the window and the grid size (x, y) so there would be a maximum number of nodes which would be x*y
super(Maze, self).__init__()... | 3.625 | 4 |
powderday/nebular_emission/abund.py | mccbc/powderday | 0 | 20089 | from __future__ import (division, print_function, absolute_import,
unicode_literals)
import numpy as np
from scipy.interpolate import InterpolatedUnivariateSpline as InterpUS
from powderday.nebular_emission.cloudy_tools import sym_to_name
"""
---------------------------------------------------... | 2.015625 | 2 |
character/migrations/0004_alter_character_alignment.py | scottBowles/dnd | 0 | 20090 | # Generated by Django 3.2.5 on 2021-08-12 02:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('character', '0003_alter_character_id'),
]
operations = [
migrations.AlterField(
model_name='character',
name='alignm... | 1.632813 | 2 |
graphs_trees/check_balance/test_check_balance.py | filippovitale/interactive-coding-challenges | 0 | 20091 | from nose.tools import assert_equal
class TestCheckBalance(object):
def test_check_balance(self):
node = Node(5)
insert(node, 3)
insert(node, 8)
insert(node, 1)
insert(node, 4)
assert_equal(check_balance(node), True)
node = Node(5)
insert(node, 3)
... | 2.984375 | 3 |
D_predict.py | shanqu91/microseismic_event_detection_via_CNN | 0 | 20092 | import keras
from keras.models import Sequential, load_model, Model
from keras.layers import Dense, Dropout, Flatten
from keras.layers import Conv2D, MaxPooling2D
from scipy import io
mat_contents = io.loadmat('Data/X_test_0.mat')
X_test_0 = mat_contents['X_test_0']
mat_contents = io.loadmat('Data/X_test_1.mat')
X_tes... | 3.140625 | 3 |
app/db_manager/apps.py | PragmaticCoder/Linkedin-Analytics | 13 | 20093 | from django.apps import AppConfig
class DbManagerConfig(AppConfig):
name = 'db_manager'
| 1.1875 | 1 |
examples/dialogs.py | tgolsson/appJar | 666 | 20094 | from appJar import gui
def press(btn):
if btn == "info": app.infoBox("Title Here", "Message here...")
if btn == "error": app.errorBox("Title Here", "Message here...")
if btn == "warning": app.warningBox("Title Here", "Message here...")
if btn == "yesno": app.yesNoBox("Title Here", "Message here...")
... | 2.6875 | 3 |
src_RealData/Nets/ObjectOriented.py | XYZsake/DRFNS | 42 | 20095 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import tensorflow as tf
import numpy as np
import os
from sklearn.metrics import confusion_matrix
from datetime import datetime
class ConvolutionalNeuralNetwork:
"""
Generic object for create DNN models.
This class instinciates all functions
needed for D... | 2.8125 | 3 |
flaskr/test/unit/webapp/test_change_light_color.py | UnibucProjects/SmartAquarium | 6 | 20096 | from flask import request
import pytest
import json
from app import create_app, create_rest_api
from db import get_db
from change_light import is_aquarium_id_valid
@pytest.fixture
def client():
local_app = create_app()
create_rest_api(local_app)
client = local_app.test_client()
yield client
def get_... | 2.234375 | 2 |
commands/inventory.py | zbylyrcxr/DennisMUD | 2 | 20097 | #######################
# <NAME> #
# inventory.py #
# Copyright 2018-2020 #
# <NAME> #
#######################
# **********
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software ... | 2.21875 | 2 |
tests/polynomials.py | mernst/cozy | 188 | 20098 | <filename>tests/polynomials.py
import unittest
from cozy.polynomials import Polynomial
class TestPolynomials(unittest.TestCase):
def test_sorting(self):
self.assertLess(Polynomial([2019, 944, 95]), Polynomial([2012, 945, 95]))
self.assertGreater(Polynomial([2012, 945, 95]), Polynomial([2019, 944,... | 2.515625 | 3 |
presenters/calculator_presenter.py | RamonWill/portfolio-management-project | 14 | 20099 | from custom_objects import FinanceCalculator
from tkinter import messagebox
class CalculationsPresenter(object):
def __init__(self, view):
self.view = view
def convert_price(self, price):
try:
converted_price = FinanceCalculator.decimal_to_treasury(price)
self.view.dis... | 3.1875 | 3 |