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 |
|---|---|---|---|---|---|---|
app/admin/daq_admin.py | quanpower/sitp | 0 | 12768551 | <gh_stars>0
from flask_admin import Admin, BaseView, expose
from flask_admin.contrib.sqla import ModelView
from app.models import Temperature
import flask_login as login
class TemperatureModelView(ModelView):
def __init__(self, session, **kwargs):
# You can pass name and other parameters if you want to
... | 2.21875 | 2 |
Lintcode/Ladder_49_Binary_Index_Tree/207. Interval Sum II.py | ctc316/algorithm-python | 0 | 12768552 | <reponame>ctc316/algorithm-python<gh_stars>0
class BITree:
def __init__(self, nums):
self.n = len(nums)
self.arr = [0 for _ in range(self.n)]
self.bitree = [0 for _ in range(self.n + 1)]
for i in range(self.n):
self.update(i, nums[i])
def update(self, i, va... | 3.328125 | 3 |
plot_max.py | IanHawke/three-lies | 0 | 12768553 | from matplotlib import pyplot
import numpy
x = numpy.linspace(-1, 1, 1000)
y1 = numpy.exp(-x**2 * 10) * (1 + 0.05 * numpy.random.rand(len(x)))
y2 = (numpy.exp(10*(-(x-0.3)**2 - 0.75*x**4 - 0.25*x**6)) + numpy.piecewise(x, [x < 0.3, x >= 0.3], [lambda x: -(x-0.3)*numpy.sqrt(1+x), 0])) * (1 + 0.05 * numpy.random.rand(le... | 3.3125 | 3 |
main.py | hssergey/timeslideshow | 0 | 12768554 | <reponame>hssergey/timeslideshow
from flask import Flask, render_template, send_from_directory
import glob
app = Flask(__name__)
@app.route("/")
def hello_world():
images = glob.glob("images/*.*")
return render_template('main.html', images = images)
@app.route("/images/<path:name>")
def download_file(name... | 2.4375 | 2 |
plugins/dragknife.py | hdo/bCNC | 0 | 12768555 | #!/usr/bin/python
# -*- coding: ascii -*-
# Author: @harvie <NAME>
# Date: 25 sept 2018
__author__ = "@harvie <NAME>"
#__email__ = ""
__name__ = _("DragKnife")
__version__ = "0.3.0"
import math
import os.path
import re
from CNC import CNC,Block
from bmath import Vector
from bpath import eq, Path, Segment
from Tool... | 2.484375 | 2 |
missions_to_mars/scrape_mars.py | paola1395/web-scraping-challenge | 0 | 12768556 | #Dependencies
from bs4 import BeautifulSoup as bs
import requests
from webdriver_manager.chrome import ChromeDriverManager
from splinter import Browser
import pandas as pd
import os
def init_browser():
executable_path = {'executable_path': ChromeDriverManager().install()}
return Browser("chrome", **executable... | 3.15625 | 3 |
tests/v2/test_incident_team_create_data.py | MichaelTROEHLER/datadog-api-client-python | 0 | 12768557 | # coding: utf-8
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
import sys
import unittest
import datadog_api_client.v2
from datadog... | 2.125 | 2 |
src/crop_UCF_QNRF.py | xwjBupt/Counting-ICCV-DSSINet | 63 | 12768558 | import cv2
import scipy.io as scio
from scipy.ndimage import imread
from scipy.misc import imsave
import os
import re
import numpy as np
import itertools
def crop():
image_path = '/UCF-QNRF_ECCV18/Train/images'
label_path = '/UCF-QNRF_ECCV18/Train/ground_truth'
image_save_path = '/UCF-QNRF_ECCV18/Train/cro... | 2.5 | 2 |
src/zswag/app.py | gvarga2/zswag | 0 | 12768559 | <filename>src/zswag/app.py
import connexion
import os
import yaml
import inspect
import zserio
import base64
import sys
from types import ModuleType
from typing import Type
from .doc import get_doc_str, IdentType, md_filter_definition
from zswag_client.spec import ZserioSwaggerSpec, ParamFormat, ParamLocation, ZSERIO_... | 2.34375 | 2 |
problems/191.Number_of_1_Bits/li.py | subramp-prep/leetcode | 0 | 12768560 | class Solution(object):
def hammingWeight(self, n):
"""
:type n: int
:rtype: int
"""
res = 0
while n:
res += 1
n &= (n-1)
return res
def hammingWeight(self, n):
for i in range(33):
if not n: return i
... | 3.46875 | 3 |
maple/core/__init__.py | UT-Austin-RPL/maple | 9 | 12768561 | """
General classes, functions, utilities that are used throughout maple.
"""
from maple.core.logging import logger
__all__ = ['logger']
| 0.851563 | 1 |
cnn_denoiser/model_definitions/moussaka.py | ramonfmir/deblurring-public | 0 | 12768562 | import tensorflow as tf
import cnn_denoiser.input_data as input_data
import glob
import os
# Parameters
channels = 1
dataset_path = 'data/pretraining'
image_width = 270
image_height = 90
batch_size = 64
image_data = input_data.load_images(dataset_path, image_width, image_height)
pretrain_steps_first_layer = 1000
pr... | 2.796875 | 3 |
api/serializers.py | IzmdI/yamdb_reviews_api_service | 0 | 12768563 | <gh_stars>0
from django.contrib.auth import password_validation
from django.contrib.auth.hashers import make_password
from django.core import exceptions
from rest_framework import serializers
from .models import Category, Comment, Genre, Review, Title, User
class UserSerializer(serializers.ModelSerializer):
pass... | 2.390625 | 2 |
python_practice/data_structure/queue/queue_linked_listTest.py | jeremykid/FunAlgorithm | 0 | 12768564 | <gh_stars>0
from queue_link_list import queue_linked_list
def test1():
QLL = queue_linked_list()
QLL.enqueue('A')
QLL.enqueue('B')
QLL.enqueue('C')
print "1. QLL = ",QLL
QLL.enqueue('D')
print "2. After QLL.enqueue('D') QLL = ",QLL
print "3. After QLL.empty() = ",QLL.empty()
QLL.dequeue()
print "4. After Q... | 3.34375 | 3 |
notebook/opencv_threshold.py | vhn0912/python-snippets | 174 | 12768565 | import cv2
im = cv2.imread('data/src/lena_square_half.png')
th, im_th = cv2.threshold(im, 128, 255, cv2.THRESH_BINARY)
print(th)
# 128.0
cv2.imwrite('data/dst/opencv_th.jpg', im_th)
# True
th, im_th_tz = cv2.threshold(im, 128, 255, cv2.THRESH_TOZERO)
print(th)
# 128.0
cv2.imwrite('data/dst/opencv_th_tz.jpg', im_... | 2.828125 | 3 |
src/statistics.py | Thefalas/disksMD | 0 | 12768566 | <reponame>Thefalas/disksMD
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 8 17:33:47 2018
@author: malopez
"""
import math
import numpy as np
from scipy.stats import kurtosis
import matplotlib.pyplot as plt
import seaborn
from tools import readData
def getStationaryState(n_collisions, data_folder):
""" Here we r... | 3.03125 | 3 |
approval_system/settings.py | rmboot/approvalsystem | 3 | 12768567 | <reponame>rmboot/approvalsystem<gh_stars>1-10
import os
import sys
basedir = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
WIN = sys.platform.startswith('win')
if WIN:
prefix = 'sqlite:///'
else:
prefix = 'sqlite:////'
class BaseConfig:
SQLALCHEMY_TRACK_MODIFICATIONS = False
SECRET_KEY... | 1.851563 | 2 |
cgls.py | iggyuga/raisr2 | 275 | 12768568 | import numpy as np
def cgls(A, b):
height, width = A.shape
x = np.zeros((height))
while(True):
sumA = A.sum()
if (sumA < 100):
break
if (np.linalg.det(A) < 1):
A = A + np.eye(height, width) * sumA * 0.000000005
else:
x = np.linalg.inv(A).d... | 2.40625 | 2 |
test/python/topology/test2_spl_window.py | markheger/streamsx.topology | 31 | 12768569 | # Licensed Materials - Property of IBM
# Copyright IBM Corp. 2016
import unittest
import sys
import itertools
import threading
from streamsx.topology.topology import *
from streamsx.topology.tester import Tester
from streamsx.topology import schema
import streamsx.topology.context
from streamsx.topology.context import... | 2.078125 | 2 |
adt/core.py | catethos/adt | 0 | 12768570 | from pampy import match, _
from dataclasses import dataclass
from typing import TypeVar, Generic
T = TypeVar('T')
class Matcher:
def __init__(self):
self.pattern = []
def __setitem__(self, pat, method):
self.pattern.append(pat)
self.pattern.append(method)
def __call__(... | 2.578125 | 3 |
networks/activations.py | Chappie733/MLPack | 0 | 12768571 | <reponame>Chappie733/MLPack
import numpy as np
from numbers import Number
ACTIVATIONS = {}
def parser(func):
def wrapper(x, deriv=False, **kwargs):
if not isinstance(deriv, bool):
raise TypeError("Expected the parameter \'deriv\' to be a boolean, but received {type} instead!".format(type=type(deriv)))... | 2.75 | 3 |
manage.py | PapaCharlie/SteamReviews | 0 | 12768572 | import nltk
import os
from flask_script import Manager
from app import app
from app.dynamodb.utils import create_dynamo_table
from app.models.review import Review
from app.models.game import Game
from app.models.tag import Tag
manager = Manager(app)
@manager.command
def create_tables():
create_dynamo_table(Revie... | 1.875 | 2 |
sumo/tools/sumolib/route.py | iltempe/osmosi | 0 | 12768573 | #!/usr/bin/env python
"""
@file route.py
@author <NAME>
@date 2013-10-23
@version $Id$
Route helper functions.
SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
Copyright (C) 2009-2017 DLR (http://www.dlr.de/) and contributors
This file is part of SUMO.
SUMO is free software; you can redistribute it... | 2.75 | 3 |
app/db/models.py | aarangop/floraqua-backend | 0 | 12768574 | <filename>app/db/models.py
from typing import Optional
from bson import ObjectId
from pydantic import BaseModel, Field
class PyObjectId(ObjectId):
@classmethod
def __get_validators__(cls):
yield cls.validate
@classmethod
def validate(cls, v):
if not ObjectId.is_valid(v):
r... | 2.4375 | 2 |
loremipsum.py | connordelacruz/python-loremipsum | 2 | 12768575 | <gh_stars>1-10
import argparse
from urllib import request, error
import pyperclip
URL = 'https://loripsum.net/api/'
class ParagraphLength():
"""Constants for the ``paragraph_length`` parameter in generate()"""
#: List of values for paragraph lengths. Used internally.
OPTIONS = [
'short',
... | 3.515625 | 4 |
Pyrado/pyrado/environments/rcspysim/base.py | jacarvalho/SimuRLacra | 0 | 12768576 | import numpy as np
from abc import abstractmethod
from init_args_serializer import Serializable
from rcsenv import RcsSimEnv, JointLimitException
import pyrado
from pyrado.environments.sim_base import SimEnv
from pyrado.spaces.base import Space
from pyrado.spaces.box import BoxSpace
from pyrado.spaces.empty import Emp... | 2.34375 | 2 |
customers/services/sms_notification_service.py | City-of-Helsinki/berth-reservations | 3 | 12768577 | import requests
from django.conf import settings
from django_ilmoitin.models import NotificationTemplate
from django_ilmoitin.utils import render_notification_template
NOTIFICATION_SERVICE_API_URL = "NOTIFICATION_SERVICE_API_URL"
NOTIFICATION_SERVICE_SENDER_NAME = "NOTIFICATION_SERVICE_SENDER_NAME"
NOTIFICATION_SERVIC... | 2.140625 | 2 |
cursors/coords.py | Jonas164/PSpaMM | 0 | 12768578 | <filename>cursors/coords.py<gh_stars>0
from collections import namedtuple
# The relationship between blocks and cells has become too complicated to
# safely bake into a coordinate system. The semantics has been moved to the
# cursor movement commands. A NewCoords object may represent a logical cell,
# a logical block ... | 3.140625 | 3 |
src/pydap/server/devel_ssl.py | Juanlu001/pydap | 83 | 12768579 | <gh_stars>10-100
import multiprocessing
import time
import requests
import warnings
from werkzeug.serving import run_simple
from ..wsgi.ssf import ServerSideFunctions
from ..handlers.lib import BaseHandler
from .devel import DefaultDataset, LocalTestServer
def run_simple_server(application=BaseHandler(DefaultDatase... | 2.171875 | 2 |
security/migrations/0001_initial.py | CASDON-MYSTERY/studentapp | 0 | 12768580 | # Generated by Django 3.1.5 on 2021-09-04 23:52
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Security_Alert',
fields=[
('id', models.Aut... | 1.765625 | 2 |
bin/export_guest.py | Kairiw/karesansui | 0 | 12768581 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of Karesansui.
#
# Copyright (C) 2012 HDE, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, incl... | 1.375 | 1 |
TwitterScraperAPI/packages/__init__.py | vaskrneup/TwitterScraperAPI | 1 | 12768582 | from . import default_data
from . import extractor
| 1.101563 | 1 |
src/jbdl/rbdl/math/x_rotz.py | yz-mao/jbdl | 21 | 12768583 | import jax.numpy as jnp
from jax.api import jit
@jit
def x_rotz(theta):
c = jnp.cos(theta)
s = jnp.sin(theta)
x = jnp.array([[c, s, 0.0, 0.0, 0.0, 0.0],
[-s, c, 0.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 1.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, c, s, 0.0],
... | 2.875 | 3 |
src/pyexpressions/highlevel/PyScoped.py | Xiddoc/ComPy | 0 | 12768584 | <reponame>Xiddoc/ComPy
"""
Python object which manages it's own private scope.
"""
from _ast import AST
from abc import ABCMeta
from typing import Optional
from src.pyexpressions.abstract.PyExpression import PyExpression
from src.scopes.Scope import Scope
from src.structures.TypeRenames import GENERIC_PYEXPR_TYPE
cl... | 2.546875 | 3 |
image-segmentation/custom-recipes/score_image/recipe.py | gbetegon88/dataiku-contrib | 93 | 12768585 | <filename>image-segmentation/custom-recipes/score_image/recipe.py<gh_stars>10-100
# -*- coding: utf-8 -*-
import dataiku
from dataiku.customrecipe import *
import os
import json
import skimage.io
import logging
from mrcnn import utils, visualize
import mrcnn.model as modellib
from coco import coco
from utils import jso... | 1.71875 | 2 |
tests/test_handwrite.py | ReveRoyl/Handright-generator | 706 | 12768586 | <reponame>ReveRoyl/Handright-generator<filename>tests/test_handwrite.py
# coding: utf-8
import copy
import PIL.Image
import PIL.ImageDraw
from handright import *
from tests.util import *
BACKGROUND_COLOR = "white"
WIDTH = 32
HEIGHT = 32
SIZE = (WIDTH, HEIGHT)
SEED = "Handright"
def get_default_template():
temp... | 2.59375 | 3 |
slump.py | szwieback/FVEH | 0 | 12768587 | '''
Created on 19 Nov 2017
@author: Simon
'''
from fipy import Variable, FaceVariable, CellVariable, TransientTerm, DiffusionTerm
import numpy as np
import datetime
import pickle
from scipy.interpolate import interp1d
from boundary import BoundaryConditionCollection1D
from diagnostic import DiagnosticModu... | 1.757813 | 2 |
reinvent-2019/connected-photo-booth/py_client/config.py | chriscoombs/aws-builders-fair-projects | 0 | 12768588 | <gh_stars>0
import boto3
import botocore
import os
import glob
import json
import requests
from datetime import datetime
from time import sleep
from time import gmtime, strftime
import sys, getopt
import argparse
import subprocess
from shutil import copyfile, rmtree
import logging
import configparser
__CONFIG_... | 2.0625 | 2 |
goorm-api/product/urls.py | labiss96/goorm-service | 0 | 12768589 | <gh_stars>0
from django.urls import include, path
from rest_framework.routers import DefaultRouter
from . import views
router = DefaultRouter()
router.register('brand', views.BrandViewSet)
router.register('tobacco', views.TobaccoViewSet)
router.register('review', views.ReviewViewSet)
urlpatterns = [
path('', incl... | 1.765625 | 2 |
vpp/vppapi.py | pimvanpelt/vppcfg | 0 | 12768590 | #
# Copyright (c) 2022 <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, so... | 2.265625 | 2 |
watcher.py | ATLJoeReed/eventbrite_watcher | 0 | 12768591 | #!/usr/bin/python3.6
import datetime
import time
import requests
from twilio.rest import Client
from config import settings
class EventbriteWatcher(object):
"""
This class is used to watch Eventbrite for new events at a specified
organization.
"""
def __init__(self, watch_time, organizer_id, key... | 2.59375 | 3 |
expertise/setup/__init__.py | mspector/expertise | 12 | 12768592 | from .core import setup_model
| 1.03125 | 1 |
assignment3/code/Task3_PCA.py | cjy513203427/SML_Assignment | 0 | 12768593 | <reponame>cjy513203427/SML_Assignment
# -*- encoding: utf-8 -*-
'''
@File : __init__.py.py
@Modify Time @Author @Desciption
------------ ------- -----------
2021/6/27 13:35 Jonas None
'''
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
data = pd.r... | 2.46875 | 2 |
src/rubrix/metrics/text_classification/metrics.py | anunn1417/Rubrix | 0 | 12768594 | from rubrix import _client_instance as client
from rubrix.metrics import helpers
from rubrix.metrics.models import MetricSummary
def f1(name: str) -> MetricSummary:
"""Computes the single label f1 metric for a dataset
Args:
name:
The dataset name.
Returns:
The f1 metric summa... | 2.859375 | 3 |
src/masonite_commerce/migrations/create_commerce_comments_table.py | yubarajshrestha/masonite-commerce | 1 | 12768595 | <reponame>yubarajshrestha/masonite-commerce
"""CreateCommerceCommentsTable Migration."""
from masoniteorm.migrations import Migration
class CreateCommerceCommentsTable(Migration):
def up(self):
"""
Run the migrations.
"""
with self.schema.create("commerce_comments") as table:
... | 2.484375 | 2 |
PhysicsTools/NanoAOD/python/custom_jme_cff.py | scodella/cmssw | 1 | 12768596 | import FWCore.ParameterSet.Config as cms
from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff import run2_miniAOD_80XLegacy
from Configuration.Eras.Modifier_run2_nanoAOD_94X2016_cff import run2_nanoAOD_94X2016
from PhysicsTools.NanoAOD.common_cff import Var, P4Vars
from PhysicsTools.NanoAOD.jets_cff import jet... | 1.828125 | 2 |
transaction_service/transactions/migrations/0010_rename_date_transactions_date_provided.py | deorz/TransactionService | 0 | 12768597 | # Generated by Django 4.0.3 on 2022-03-13 15:43
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('transactions', '0009_wallets_date_created'),
]
operations = [
migrations.RenameField(
model_name='transactions',
old_name='d... | 1.679688 | 2 |
tests/datasets/seq_labeling/test_conll_yago_dataset.py | sean-dingxu/sciwing | 50 | 12768598 | import pytest
from sciwing.datasets.seq_labeling.conll_yago_dataset import ConllYagoDatasetsManager
from sciwing.datasets.seq_labeling.conll_yago_dataset import ConllYagoDataset
import sciwing.constants as constants
import pathlib
from sciwing.tokenizers.word_tokenizer import WordTokenizer
PATHS = constants.PATHS
DATA... | 2.046875 | 2 |
DEW/build/lib/dependencyGraph/dg.py | STEELISI/DEW-public | 0 | 12768599 | <gh_stars>0
import networkx as nx
import sys
from appJar import gui
try:
# Python 3
import tkinter as tk
import tkinter.messagebox as tkm
import tkinter.simpledialog as tkd
from tkinter.font import Font
except ImportError:
# Python 2
from tkFont import Font
import Tkinter as tk
impo... | 2.46875 | 2 |
pgweb/urls.py | WeilerWebServices/PostgreSQL | 0 | 12768600 | from django.conf.urls import include, url
from django.views.generic import RedirectView
from pgweb.util.signals import register_basic_signal_handlers
import pgweb.contributors.views
import pgweb.core.views
import pgweb.docs.views
import pgweb.downloads.views
import pgweb.events.views
import pgweb.featurematrix.views
... | 1.75 | 2 |
python/orp/orp/authority_ner/__init__.py | UKGovernmentBEIS/open-regulation-platform-alpha | 0 | 12768601 | <filename>python/orp/orp/authority_ner/__init__.py<gh_stars>0
#from .extractAuthorities import extract_entities_from_string
from .new_extractAuthorities import extract_entities_from_string
| 1.507813 | 2 |
platform_agent/wireguard/wg_conf.py | leogsilva/syntropy-agent | 0 | 12768602 | import json
import os
import socket
import base64
import logging
import subprocess
import re
from pathlib import Path
import pyroute2
from pyroute2 import IPDB, WireGuard, NetlinkError
from nacl.public import PrivateKey
from platform_agent.cmd.iptables import add_iptable_rules, delete_iptable_rules, add_iptables_forw... | 1.859375 | 2 |
run.py | GabrielDornelles/SEULGI-SR | 0 | 12768603 | import discord
from discord.ext import commands, tasks
from discord.voice_client import VoiceClient
import youtube_dl
import urllib.parse, urllib.request
import re
import json
from random import choice
youtube_dl.utils.bug_reports_message = lambda: ''
ytdl_format_options = {
'format': 'bestaudio/best',
'outtm... | 2.421875 | 2 |
axonius_api_client/cli/grp_system/grp_activity_logs/grp_common.py | kf-careem/axonius_api_client | 11 | 12768604 | <reponame>kf-careem/axonius_api_client
# -*- coding: utf-8 -*-
"""Command line interface for Axonius API Client."""
import csv
import io
from ....api.json_api.audit_logs import AuditLog
from ....tools import json_dump
from ...context import click
EXPORT = [
click.option(
"--export-format",
"-xf",
... | 2.15625 | 2 |
system_mapper/provider_azure/azure_mapper.py | dalthviz/query-azure-resource-graph | 0 | 12768605 | <gh_stars>0
# -*- coding: utf-8 -*-
# Licensed under the terms of the MIT License
"""
Azure infrastructure domain mapping.
"""
# Standard library imports
import json
import logging
# Third-party imports
from pandas import DataFrame
from neomodel import DoesNotExist
import requests
from requests.packages.urllib3.except... | 2 | 2 |
sandbox/bing_news_api.py | lofmat/history_now | 0 | 12768606 | <reponame>lofmat/history_now
import json
import requests
url = "https://bing-news-search1.p.rapidapi.com/news"
querystring = {"safeSearch": "Off", "textFormat": "Raw"}
headers = {
'x-bingapis-sdk': "true",
'x-rapidapi-key': "<KEY>",
'x-rapidapi-host': "bing-news-search1.p.rapidapi.com"
}
from bs4 im... | 2.828125 | 3 |
src/utils/templates/threadwithstop.py | KeithAzzopardi1998/BFMC_Startup | 1 | 12768607 | # Copyright (c) 2019, Bosch Engineering Center Cluj and BFMC organizers
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, ... | 1.703125 | 2 |
LeetCode/0074. Search a 2D Matrix/solution.py | InnoFang/oh-my-algorithms | 19 | 12768608 | <filename>LeetCode/0074. Search a 2D Matrix/solution.py
"""
133 / 133 test cases passed.
Runtime: 56 ms
Memory Usage: 15.1 MB
"""
class Solution:
def searchMatrix(self, matrix: List[List[int]], target: int) -> bool:
m, n = len(matrix), len(matrix[0])
l, r = 0, m * n - 1
while l < r:
... | 3.625 | 4 |
scripts/validate_events.py | aureus5/mimiciII | 2 | 12768609 | <gh_stars>1-10
import os
import argparse
def is_subject_folder(x):
for c in x:
if (c < '0' or c > '9'):
return False
return True
def main():
parser = argparse.ArgumentParser()
parser.add_argument('subjects_root_path', type=str,
help='Directory containing s... | 2.703125 | 3 |
genedisco/evaluation/hitratio.py | genedisco/genedisco | 11 | 12768610 | <gh_stars>10-100
"""
Copyright (C) 2022 <NAME>, GlaxoSmithKline plc
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy, modi... | 1.742188 | 2 |
Lib/test/test_compiler/test_static/final.py | isabella232/cinder-1 | 1,886 | 12768611 | <gh_stars>1000+
from compiler.errors import TypedSyntaxError
from typing import ClassVar
from .common import StaticTestBase
class FinalTests(StaticTestBase):
def test_final_multiple_typeargs(self):
codestr = """
from typing import Final
from something import hello
x: Final[int, s... | 2.640625 | 3 |
labs/6/py/integrate.py | Sky-Nik/numerical-analysis | 1 | 12768612 | #!/usr/bin/env python
import numpy as np
from typing import Callable
def rectangle(a: float, b: float, f: Callable[[np.array], np.array],
h: float) -> float:
return h * np.sum(f(np.arange(a + h / 2, b + h / 2, h)))
def trapezoid(a: float, b: float, f: Callable[[np.array], np.array],
h: float) ... | 2.859375 | 3 |
game/views.py | ruippgoncalves/CS2048 | 0 | 12768613 | """Views"""
import json
from math import log2
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.decorators import login_required
from django.views.decorators.csrf import csrf_exempt
from django.shortcuts import render
from django.db import IntegrityError
from django.http import Json... | 2.28125 | 2 |
extlibs/freetype-2.5.2/src/tools/docmaker/PaxHeaders.20920/docmaker.py | halak/bibim | 3 | 12768614 | 30 atime=1386526222.135502298
30 ctime=1374498496.154314241
| 0.898438 | 1 |
service.py | rjaus/XeroPhaxio | 0 | 12768615 | # -*- coding: utf-8 -*-
import os
from phaxio import PhaxioApi
from xero import Xero
from xero.auth import PrivateCredentials
# Setup the Xero Private App
# Ensure your private key is listed in your .gitignore, so you doesn't end up in your repo.
# Xero API Consumer Key is retrieved via an environmental variable
# Ens... | 2.453125 | 2 |
custom/icds_reports/utils/aggregation_helpers/distributed/availing_service_forms.py | satyaakam/commcare-hq | 0 | 12768616 | from dateutil.relativedelta import relativedelta
from custom.icds_reports.const import AGG_AVAILING_SERVICES_TABLE
from custom.icds_reports.utils.aggregation_helpers import month_formatter
from custom.icds_reports.utils.aggregation_helpers.distributed.base import (
StateBasedAggregationDistributedHelper,
)
class... | 2.015625 | 2 |
desktop/core/src/desktop/api_public_urls.py | renovate-bot/hue | 1 | 12768617 | #!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | 1.648438 | 2 |
peerscout/server/services/manuscript_subject_areas.py | elifesciences/peerscout | 3 | 12768618 | class ManuscriptSubjectAreaService:
def __init__(self, df):
self._df = df
self._subject_areas_by_id_map = df.groupby(
'version_id')['subject_area'].apply(sorted).to_dict()
@staticmethod
def from_database(db, valid_version_ids=None):
df = db.manuscript_subject_area.read_f... | 2.53125 | 3 |
app.py | rselent/schrodingers-server | 2 | 12768619 | <reponame>rselent/schrodingers-server
# Schrödinger's Server
# by <NAME>
#
# Purpose: register and ping URL, and display UP/DOWN status
# (this is expected to change over time)
#
# Requirements: Python (3.9)
#
#
#
# ==========================================================
# =======================================... | 2.65625 | 3 |
src/examples/python/gen_py/datahub/ttypes.py | RogerTangos/datahub-stub | 192 | 12768620 | #
# Autogenerated by Thrift Compiler (0.9.2)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
# options string: py
#
from thrift.Thrift import TType, TMessageType, TException, TApplicationException
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol, TProtocol
tr... | 1.71875 | 2 |
test/day_10/test_pt1.py | teagles/teagles-advent-2021 | 0 | 12768621 | import unittest
from test.std_test_utils import STDIOTest
from teagles_advent_2021.day_10.pt1 import main
TEST_INPUT = """[({(<(())[]>[[{[]{<()<>>
[(()[<>])]({[<{<<[]>>(
{([(<{}[<>[]}>{[]{[(<()>
(((({<>}<{<{<>}{[]{[]{}
[[<[([]))<([[{}[[()]]]
[{[{({}]{}}([{[{{{}}([]
{<[[]]>}<{[{[{[]{()[[[]
[<(<(<(<{}))><([]([]()
<{([(... | 2.703125 | 3 |
pymarsys/connections.py | transcovo/pymarsys | 12 | 12768622 | <reponame>transcovo/pymarsys<filename>pymarsys/connections.py
from abc import ABC, abstractmethod
import base64
import datetime
import hashlib
import json
from urllib.parse import urljoin
import uuid
import aiohttp
import requests
EMARSYS_URI = 'https://api.emarsys.net/'
class ApiCallError(Exception):
pass
cl... | 2.71875 | 3 |
services/core/MasterDriverAgent/master_driver/tests/test_revert_mixin.py | Entek-Technical-Services/BEMOSS3.5 | 73 | 12768623 | # -*- coding: utf-8 -*- {{{
# vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et:
#
# Copyright (c) 2015, Battelle Memorial Institute
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistrib... | 0.851563 | 1 |
djenga/management/commands/clean_command_output.py | 2ps/djenga | 6 | 12768624 | <reponame>2ps/djenga<gh_stars>1-10
from .statuscommand import StatusCommand
from ...models import ManagementCommand
from ...models import CommandOutput
class Command(StatusCommand):
help = (
'Cleans up the djenga.models.CommandOutput '
'values by removing old entries'
)
def __init__(self... | 2.328125 | 2 |
src/components/client/logica/logica_client.py | adp1002/practica-dms-2019-2020 | 0 | 12768625 | from conexiones.auth_client import AuthClient
from conexiones.hub_client import HubClient
from conexiones.game_client import GameClient
"""
Clase LogicaCliente es un clase con metodos estaticos.
Es la clase que lleva la logica y la que se comunica con la capa de datos.
"""
class LogicaCliente:
""" Reg... | 2.671875 | 3 |
experiments/geneticProgramming/packing.py | quintonweenink/gp-1d-bin-packing-objective-func | 0 | 12768626 | import pandas as pd
import numpy as np
class Packing(object):
def getMappedFitness(self, chromosome):
mappedChromosome = self.items[chromosome]
spaces = np.zeros(len(mappedChromosome), dtype=int)
result = np.cumsum(mappedChromosome) - self.BIN_CAPACITY
index_of_old_bin = 0
b... | 2.625 | 3 |
src/xbot/cli/__init__.py | qq751220449/xbot | 2 | 12768627 | import click
from .. import __version__
@click.command()
@click.option("--count", default=1, help="Number of greetings.")
@click.version_option(version=__version__)
def main(count):
print(count)
click.echo("Hello, Xbot!")
| 2.359375 | 2 |
rciam_probes/shared/templates.py | rciam/rciam_probes | 2 | 12768628 | <filename>rciam_probes/shared/templates.py<gh_stars>1-10
from string import Template
"""Nagios template output for Login health check"""
login_health_check_nagios_tmpl = Template("SP Login succeeded(${time}${type} time) | 'Login'=${time}${type}")
defaults_login_health_check = {
"time": -1,
"type": "s"
}
"""N... | 2.171875 | 2 |
kotus_json_file_generator.py | timokoola/suomicollectorscripts | 0 | 12768629 | import xmltodict, json, collections, typing, random, time
f = open("kotus-sanalista_v1.xml")
kotus_ = f.read()
f.close()
kotus = xmltodict.parse(kotus_)
def toTn(tn):
pass
def toLine(item):
if "s" not in item or "t" not in item:
return (item["s"], -1,"_")
word = item["s"]
type_ = item["t"]
... | 2.8125 | 3 |
Q443.py | Linchin/python_leetcode_git | 0 | 12768630 | """
443
medium
string compression
"""
from typing import List
class Solution:
def compress(self, chars: List[str]) -> int:
cnt = 1
output = 0
for i in range(len(chars) - 1):
if chars[i] == chars[i+1]:
cnt += 1
else:
chars[output] ... | 3.421875 | 3 |
dft/potentials.py | jordan-melendez/dft_emulator | 0 | 12768631 | <reponame>jordan-melendez/dft_emulator
from __future__ import division
import numpy as np
from .constants import pi
def harmonic_oscillator_potential(r, mass, omega):
return mass * (omega * r) ** 2 / 2.0
# def harmonic_oscillator_hamiltonian_ho_basis(omega, ):
# return mass * (omega * r) ** 2 / 2.0
def k... | 2.375 | 2 |
backend/dynamicanalysis/codecoverage/serializers.py | IsmatAl/thesisProject | 1 | 12768632 | from rest_framework import serializers
class CodeCoverageSerializer(serializers.Serializer):
entry = serializers.CharField()
# id = serializers.CharField()
# inputs = serializers.ListField()
# expectedOutputs = serializers.ListField(required=False)
| 2.078125 | 2 |
index.bzl | zaucy/rules_cc_stamp | 1 | 12768633 | def _cc_stamp_header(ctx):
out = ctx.outputs.out
args = ctx.actions.args()
args.add("--stable_status", ctx.info_file)
args.add("--volatile_status", ctx.version_file)
args.add("--output_header", out)
ctx.actions.run(
outputs = [out],
inputs = [ctx.info_file, ctx.version_file],
... | 1.929688 | 2 |
z2/part3/updated_part2_batch/jm/parser_errors_2/507857314.py | kozakusek/ipp-2020-testy | 1 | 12768634 | from part1 import (
gamma_board,
gamma_busy_fields,
gamma_delete,
gamma_free_fields,
gamma_golden_move,
gamma_golden_possible,
gamma_move,
gamma_new,
)
"""
scenario: test_random_actions
uuid: 507857314
"""
"""
random actions, total chaos
"""
board = gamma_new(5, 4, 4, 3)
assert board is... | 2.140625 | 2 |
platform_agent/rerouting/rerouting.py | leogsilva/syntropy-agent | 0 | 12768635 | import threading
import time
import logging
import pyroute2
import ipaddress
import json
import re
from pyroute2 import WireGuard
from platform_agent.cmd.lsmod import module_loaded
from platform_agent.cmd.wg_info import WireGuardRead
from platform_agent.files.tmp_files import read_tmp_file
from platform_agent.routes ... | 2.046875 | 2 |
LDA_qje/policy_relevant_topics.py | erialc-cal/NLP-FOMC | 0 | 12768636 | <filename>LDA_qje/policy_relevant_topics.py<gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 11 11:47:23 2021
@author: <NAME>
Selecting Topics : paper suggest topic selection policy-wise using Meade (2017)
work on dissent in policies. We may want to use the same method to select
Usin... | 1.851563 | 2 |
app/application.py | LinkedList/postgis-baselayers | 33 | 12768637 | <filename>app/application.py
import sys
import os
import logging
import json
import shutil
import psycopg2
import time
import subprocess
import copy
import markdown
import tempfile
import functools
from threading import Timer
from glob import glob
from functools import wraps
from io import StringIO, BytesIO
from ps... | 2.3125 | 2 |
auraliser/auralisation.py | FRidh/auraliser | 2 | 12768638 | <gh_stars>1-10
"""
The auralisation module provides tools to perform an auralisation.
The :class:`Auraliser` is a powerful interface for performing auralisations.
It allows one to define a soundscape consisting of several sources and
receivers and performing auralisations at the receivers due to the specified sources.... | 2.53125 | 3 |
python/src/permute.py | xwkuang5/code-fragments | 0 | 12768639 | <filename>python/src/permute.py<gh_stars>0
def permute(obj_list, l, r, level):
"""Helper function to implement the nAr permutation operation
Arguments:
obj_list -- the list of objects from which the permutation should be generated
l -- left end point of current permutation
r ... | 4.0625 | 4 |
cogan/cogan.py | Taoerwang/tensorflow-models-with-simple-ways | 2 | 12768640 | <reponame>Taoerwang/tensorflow-models-with-simple-ways<filename>cogan/cogan.py
from __future__ import print_function, division
import tensorflow as tf
from tensorflow import keras
import numpy as np
from keras.utils import np_utils
import matplotlib.pyplot as plt
import os
import scipy
class COGAN:
model_name = "... | 2.828125 | 3 |
pKa/run_pKa_calc_dist_nummuts.py | shambo001/peat | 3 | 12768641 | <filename>pKa/run_pKa_calc_dist_nummuts.py<gh_stars>1-10
#!/usr/bin/env python
#
# pKa - various programs and scripts for pKa value analysis, calculation and redesign
# Copyright (C) 2010 <NAME>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Licen... | 1.945313 | 2 |
experiment.py | daleas0120/PT-MCIMS | 0 | 12768642 | import os
import json
import sys
import PTMCIM_A
import PTMCIM_B
import PTMCIM_C
print(sys.path)
class parameters:
def __init__(self):
# Spin lattice parameters
self.M = 300 # Number of rows
self.N = 300 # Number of cols
self.J = 1 # Coupling between locations
self.mu ... | 2.421875 | 2 |
Python101/Challenges/14.py | Yuma-Tsushima07/Python101 | 1 | 12768643 | print('Challenge 14: WAF to check if a number is present in a list or not.')
test_list = [ 1, 6, 3, 5, 3, 4 ]
print("Checking if 6 exists in list: ")
# Checking if 6 exists in list
# using loop
for i in test_list:
if(i == 6) :
print ("Element Exists") | 4.09375 | 4 |
api/urls.py | jaredmichaelsmith/aussie | 0 | 12768644 | from django.conf.urls import include, url
urlpatterns = [
] | 1.15625 | 1 |
scenarios/scripts/plot_var_wifiload.py | ZeronSix/nru-wifi-coexistence-simulator | 0 | 12768645 | #!/usr/bin/env python3
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
df = pd.read_csv('../results/var_wifi_load.tsv', sep='\t', index_col=False, header=0)
nodes = [1, 2, 5, 10]
num_carriers = 20
for n in nodes:
data = df[(df['numEnbs'] == n)]
plt.cla()
for wifi_carriers in [5, ... | 2.421875 | 2 |
statistics/stat_multiv_solutions.py | gautard/pystatsml | 123 | 12768646 | '''
Munivariate statistics exercises
================================
'''
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
#%matplotlib inline
np.random.seed(seed=42) # make the example reproducible
'''
### Dot product and Euclidean norm
'''
a = np.array([2,1])
b = np.array([1,1])
def euclidia... | 3.625 | 4 |
scarletio/utils/weak_core.py | HuyaneMatsu/scarletio | 3 | 12768647 | __all__ = ('WeakCallable', 'WeakHasher', 'WeakReferer', 'is_weakreferable', 'weak_method',)
from .compact import NEEDS_DUMMY_INIT
from .docs import has_docs
from .method_like import MethodLike
try:
from _weakref import ref as WeakrefType
except ImportError:
from weakref import ref as WeakrefType
@has_docs
d... | 2.140625 | 2 |
yeast/core/media/yp/ypte_no_glc.py | irahorecka/sga-fba | 0 | 12768648 | <reponame>irahorecka/sga-fba
"""
Defines upper bounds of YPTE with no glucose media for FBA
"""
from yeast.core.media.constants import reagents
from yeast.core.media.yp.base import yp
te_no_glc = {
reagents["ergosterol"]: 0.0026,
reagents["zymosterol"]: 0.0026,
reagents["palmitoleate"]: 0.005,
reagent... | 1.351563 | 1 |
testing/slices.py | aheadley/pynemap | 6 | 12768649 | #!/usr/bin/python
import numpy
import nbt
blocks = numpy.fromstring(nbt.NBTFile('/home/aheadley/.minecraft/saves/World1/0/0/c.0.0.dat','rb')['Level']['Blocks'].value, dtype=numpy.uint8).reshape(16,16,128)
print blocks
| 2.328125 | 2 |
examples/tickOptionBox.py | tgolsson/appJar | 666 | 12768650 | <gh_stars>100-1000
import sys
sys.path.append("../")
new_ticks = ["Dogs2", "Cats2", "-", " ", "Hamsters2", "Fish2", "Spiders2", "", " "]
orig_ticks = ["Dogs", "Cats", "Hamsters", "Fish", "Spiders"]
from appJar import gui
def get(btn):
print(app.getOptionBox("Favourite Pets"))
print(app.getOptionBox("The Acti... | 2.296875 | 2 |