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 |
|---|---|---|---|---|---|---|
pymutual/__init__.py | kimballh/pymutual | 0 | 2200 | from .session import Session, MutualAPI | 1.101563 | 1 |
forms.py | Joshua-Barawa/pitches-IP | 0 | 2201 | from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, SubmitField
from wtforms.validators import InputRequired, Email, ValidationError
from models import User
class RegistrationForm(FlaskForm):
email = StringField('Your Email Address', validators=[InputRequired(), Email()])
username ... | 3.3125 | 3 |
plugins/barracuda_waf/komand_barracuda_waf/actions/create_security_policy/schema.py | lukaszlaszuk/insightconnect-plugins | 46 | 2202 | # GENERATED BY KOMAND SDK - DO NOT EDIT
import komand
import json
class Component:
DESCRIPTION = "Creates a security policy with the default values"
class Input:
NAME = "name"
class Output:
ID = "id"
class CreateSecurityPolicyInput(komand.Input):
schema = json.loads("""
{
"type": "o... | 2.5625 | 3 |
examples/dhc/rule_example.py | fruttasecca/hay_checker | 2 | 2203 | <reponame>fruttasecca/hay_checker<filename>examples/dhc/rule_example.py<gh_stars>1-10
#!/usr/bin/python3
from pyspark.sql import SparkSession
from haychecker.dhc.metrics import rule
spark = SparkSession.builder.appName("rule_example").getOrCreate()
df = spark.read.format("csv").option("header", "true").load("example... | 2.765625 | 3 |
secure_message/common/utilities.py | uk-gov-mirror/ONSdigital.ras-secure-message | 0 | 2204 | import collections
import logging
import urllib.parse
from structlog import wrap_logger
from secure_message.constants import MESSAGE_BY_ID_ENDPOINT, MESSAGE_LIST_ENDPOINT, MESSAGE_QUERY_LIMIT
from secure_message.services.service_toggles import party, internal_user_service
logger = wrap_logger(logging.getLogger(__nam... | 2.4375 | 2 |
notegame/games/nonogram/core/renderer.py | notechats/notegame | 0 | 2205 | <reponame>notechats/notegame
# -*- coding: utf-8 -*-
"""
Defines various renderers for the game of nonogram
"""
from abc import ABC
from sys import stdout
from notetool.tool.log import logger
from six import integer_types, itervalues, text_type
from ..utils.iter import max_safe, pad
from ..utils.other import two_pow... | 3.0625 | 3 |
sympy/printing/lambdarepr.py | Carreau/sympy | 4 | 2206 | <filename>sympy/printing/lambdarepr.py
from __future__ import print_function, division
from .str import StrPrinter
from sympy.utilities import default_sort_key
class LambdaPrinter(StrPrinter):
"""
This printer converts expressions into strings that can be used by
lambdify.
"""
def _print_MatrixB... | 2.84375 | 3 |
python/fill_na_v2.py | fredmell/CS229Project | 0 | 2207 | <filename>python/fill_na_v2.py
"""
Fill na with most common of the whole column
"""
import numpy as np
import pandas as pd
import time
import matplotlib.pyplot as plt
from datetime import datetime
import re
from collections import Counter
from statistics import median
from tqdm import tqdm
def find_most_common_value... | 3.09375 | 3 |
GUI Applications/calc.py | jaiswalIT02/pythonprograms | 0 | 2208 | <filename>GUI Applications/calc.py
from tkinter import Tk
from tkinter import Entry
from tkinter import Button
from tkinter import StringVar
t=Tk()
t.title("<NAME>")
t.geometry("425x300")
t.resizable(0,0)
t.configure(background="black")#back ground color
a=StringVar()
def show(c):
a.set(a.get()+c)
def equal():... | 3.484375 | 3 |
core/models.py | uktrade/great-cms | 10 | 2209 | import hashlib
import mimetypes
from urllib.parse import unquote
from django.conf import settings
from django.core.exceptions import ValidationError
from django.db import models
from django.http import HttpResponseRedirect
from django.template.loader import render_to_string
from django.urls import reverse
from django.... | 1.359375 | 1 |
CV/Effective Transformer-based Solution for RSNA Intracranial Hemorrhage Detection/easymia/transforms/transforms.py | dumpmemory/Research | 0 | 2210 | # -*-coding utf-8 -*-
##########################################################################
#
# Copyright (c) 2022 Baidu.com, Inc. All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of th... | 2.140625 | 2 |
tests/ui/terms/test_views.py | galterlibrary/InvenioRDM-at-NU | 6 | 2211 | # -*- coding: utf-8 -*-
#
# This file is part of menRva.
# Copyright (C) 2018-present NU,FSM,GHSL.
#
# menRva is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Test terms views.py"""
from cd2h_repo_project.modules.terms.views import ... | 2.203125 | 2 |
main.py | alamin3637k/Searcher | 1 | 2212 | <gh_stars>1-10
import webbrowser
import wikipedia
import requests
def yt_search(search: str):
webbrowser.open_new_tab(f"https://www.youtube.com/results?search_query={search}")
def google_search(search: str):
webbrowser.open_new_tab(f"https://www.google.com/search?q={search}")
def bing_search(search: str):
... | 3.265625 | 3 |
hw1.py | ptsurko/coursera_crypt | 0 | 2213 | <reponame>ptsurko/coursera_crypt<filename>hw1.py
import string
from timeit import itertools
s1 = '<KEY>'
s2 = '<KEY>'
s3 = '32510ba9a7b2bba9b8005d43a304b5714cc0bb0c8a34884dd91304b8ad40b62b07df44ba6e9d8a2368e51d04e0e7b207b70b9b8261112bacb6c866a232dfe257527dc29398f5f3251a0d47e503c66e935de81230b59b7afb5f41afa8d661cb'
s4 ... | 3.421875 | 3 |
moe/bandit/ucb/ucb_interface.py | dstoeckel/MOE | 966 | 2214 | # -*- coding: utf-8 -*-
"""Classes (Python) to compute the Bandit UCB (Upper Confidence Bound) arm allocation and choosing the arm to pull next.
See :mod:`moe.bandit.bandit_interface` for further details on bandit.
"""
import copy
from abc import abstractmethod
from moe.bandit.bandit_interface import BanditInterfac... | 3.515625 | 4 |
Hedge/Shell.py | RonaldoAPSD/Hedge | 2 | 2215 | <reponame>RonaldoAPSD/Hedge
import Hedge
while True:
text = input('Hedge > ')
if text.strip() == "":
continue
result, error = Hedge.run('<stdin>', text)
if (error):
print(error.asString())
elif result:
if len(result.elements) == 1:
print(repr(result.elements[0]))
else:
print(repr(resu... | 3.125 | 3 |
yt/frontends/enzo/io.py | Xarthisius/yt | 1 | 2216 | import numpy as np
from yt.geometry.selection_routines import GridSelector
from yt.utilities.io_handler import BaseIOHandler
from yt.utilities.logger import ytLogger as mylog
from yt.utilities.on_demand_imports import _h5py as h5py
_convert_mass = ("particle_mass", "mass")
_particle_position_names = {}
class IOHan... | 2.125 | 2 |
cidr_enum.py | arisada/cidr_enum | 0 | 2217 | <gh_stars>0
#!/usr/bin/env python3
"""
cidr_enum.py is a very simple tool to help enumerate IP ranges when being used with other tools
"""
import argparse
import netaddr
def enum_ranges(ranges, do_sort):
cidrs=[]
for r in ranges:
try:
cidrs.append(netaddr.IPNetwork(r))
except Exception as e:
print("Error... | 3.390625 | 3 |
configs/k400-fixmatch-tg-alignment-videos-ptv-simclr/8gpu/r3d_r18_8x8x1_45e_k400_rgb_offlinetg_1percent_align0123_1clip_no_contrast_precisebn_ptv.py | lambert-x/video_semisup | 0 | 2218 | # model settings
model = dict(
type='Semi_AppSup_TempSup_SimCLR_Crossclip_PTV_Recognizer3D',
backbone=dict(
type='ResNet3d',
depth=18,
pretrained=None,
pretrained2d=False,
norm_eval=False,
conv_cfg=dict(type='Conv3d'),
norm_cfg=dict(type='SyncBN', requires... | 1.71875 | 2 |
experiments/rpi/gertboard/dtoa.py | willingc/pingo | 0 | 2219 | <gh_stars>0
#!/usr/bin/python2.7
# Python 2.7 version by <NAME> of http://RasPi.TV
# functionally equivalent to the Gertboard dtoa test by <NAME> & <NAME>
# Use at your own risk - I'm pretty sure the code is harmless, but check it yourself.
# This will not work unless you have installed py-spidev as in the README.txt ... | 2.984375 | 3 |
modules/statusbar.py | themilkman/GitGutter | 0 | 2220 | <gh_stars>0
# -*- coding: utf-8 -*-
import sublime
from . import blame
from . import templates
class SimpleStatusBarTemplate(object):
"""A simple template class with the same interface as jinja2's one."""
# a list of variables used by this template
variables = frozenset([
'repo', 'branch', 'comp... | 2.796875 | 3 |
polls/tests.py | bunya017/Django-Polls-App | 0 | 2221 | <reponame>bunya017/Django-Polls-App<gh_stars>0
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase
class RandomTestCase(TestCase):
def test_one_plus_one1(self):
self.assertEqual(1+1, 2)
| 1.78125 | 2 |
test.py | LeonHodgesAustin/video_stream_processor | 0 | 2222 | <gh_stars>0
# import logging
# import hercules.lib.util.hercules_logging as l
# from hercules.lib.util import sso as sso
import opencv2 as cv2
import urllib
import numpy as np
# log = l.setup_logging(__name__)
def main(args=None):
# username, passowrd = sso.get_login_credentials("WATCHER")
# Open a sample vid... | 2.734375 | 3 |
ribbon/exceptions.py | cloutiertyler/RibbonGraph | 2 | 2223 | <filename>ribbon/exceptions.py
from rest_framework.exceptions import APIException
from rest_framework import status
class GraphAPIError(APIException):
"""Base class for exceptions in this module."""
pass
class NodeNotFoundError(GraphAPIError):
status_code = status.HTTP_404_NOT_FOUND
def __init__(se... | 2.75 | 3 |
kobe-trading-bot/app.py | LeonardoM011/kobe-trading-bot | 0 | 2224 | #!/usr/bin/env python3
# Crypto trading bot using binance api
# Author: LeonardoM011<<EMAIL>>
# Created on 2021-02-05 21:56
# Set constants here:
DELTA_TIME = 300 # How long can we check for setting up new trade (in seconds)
# ----------------------
# Imports:
import os
import sys
import time as t
... | 3 | 3 |
imported_files/plotting_edh01.py | SoumyaShreeram/Locating_AGN_in_DM_halos | 0 | 2225 | <filename>imported_files/plotting_edh01.py
# -*- coding: utf-8 -*-
"""Plotting.py for notebook 01_Exploring_DM_Halos
This python file contains all the functions used for plotting graphs and maps in the 1st notebook (.ipynb) of the repository: 01. Exploring parameters in DM halos and sub-halos
Script written by: <NAME... | 2.421875 | 2 |
asv_bench/benchmarks/omnisci/io.py | Rubtsowa/modin | 0 | 2226 | <gh_stars>0
# Licensed to Modin Development Team under one or more contributor license agreements.
# See the NOTICE file distributed with this work for additional information regarding
# copyright ownership. The Modin Development Team licenses this file to you under the
# Apache License, Version 2.0 (the "License"); y... | 1.882813 | 2 |
benchmarks/rotation/rotated_cifar.py | ypeng22/ProgLearn | 1 | 2227 | import matplotlib.pyplot as plt
import random
import pickle
from skimage.transform import rotate
from scipy import ndimage
from skimage.util import img_as_ubyte
from joblib import Parallel, delayed
from sklearn.ensemble.forest import _generate_unsampled_indices
from sklearn.ensemble.forest import _generate_sample_indic... | 1.929688 | 2 |
sklearn_pandas/transformers/monitor.py | toddbenanzer/sklearn_pandas | 0 | 2228 | import numpy as np
import pandas as pd
from sklearn.base import BaseEstimator, TransformerMixin, clone
from sklearn_pandas.util import validate_dataframe
class MonitorMixin(object):
def print_message(self, message):
if self.logfile:
with open(self.logfile, "a") as fout:
fout.w... | 2.765625 | 3 |
Packs/ProofpointThreatResponse/Integrations/ProofpointThreatResponse/ProofpointThreatResponse_test.py | cbrake1/content | 1 | 2229 | import pytest
from CommonServerPython import *
from ProofpointThreatResponse import create_incident_field_context, get_emails_context, pass_sources_list_filter, \
pass_abuse_disposition_filter, filter_incidents, prepare_ingest_alert_request_body, \
get_incidents_batch_by_time_request, get_new_incidents, get_tim... | 1.992188 | 2 |
macholib/macho_methname.py | l1haoyuan/macholib | 0 | 2230 | import sys
import os
import json
from enum import Enum
from .mach_o import LC_SYMTAB
from macholib import MachO
from macholib import mach_o
from shutil import copy2
from shutil import SameFileError
class ReplaceType(Enum):
objc_methname = 1
symbol_table = 2
def replace_in_bytes(method_bytes, name_dict, type... | 2.40625 | 2 |
archive/data-processing/archive/features/sd1.py | FloFincke/affective-chat | 0 | 2231 | <gh_stars>0
#!/usr/bin/env python
import math
import numpy as np
def sd1(rr):
sdnn = np.std(rr)
return math.sqrt(0.5 * sdnn * sdnn) | 2.28125 | 2 |
forms/snippets/delete_watch.py | soheilv/python-samples | 255 | 2232 | # Copyright 2021 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 2.25 | 2 |
data_structures/disjoint_set/disjoint_set.py | egagraha/python-algorithm | 0 | 2233 | <gh_stars>0
"""
Disjoint set.
Reference: https://en.wikipedia.org/wiki/Disjoint-set_data_structure
"""
class Node:
def __init__(self, data: int) -> None:
self.data = data
self.rank: int
self.parent: Node
def make_set(x: Node) -> None:
"""
Make x as a set.
"""
# ra... | 3.953125 | 4 |
cw_EPR.py | tkeller12/spin_physics | 0 | 2234 | # <NAME>
# S = 1/2, I = 1/2
# Spin 1/2 electron coupled to spin 1/2 nuclei
import numpy as np
from scipy.linalg import expm
from matplotlib.pylab import *
from matplotlib import cm
sigma_x = 0.5*np.r_[[[0, 1],[1, 0]]]
sigma_y = 0.5*np.r_[[[0,-1j],[1j, 0]]]
sigma_z = 0.5*np.r_[[[1, 0],[0, -1]]]
Identity = np.eye(2)
... | 2.171875 | 2 |
V2RaycSpider0825/MiddleKey/VMes_IO.py | TOMJERRY23333/V2RayCloudSpider | 1 | 2235 | from spiderNest.preIntro import *
path_ = os.path.dirname(os.path.dirname(__file__)) + '/dataBase/log_information.csv'
def save_login_info(VMess, class_):
"""
VMess入库
class_: ssr or v2ray
"""
now = str(datetime.now()).split('.')[0]
with open(path_, 'a', encoding='utf-8', newline='') as f:
... | 2.546875 | 3 |
paddlespeech/s2t/frontend/audio.py | AK391/PaddleSpeech | 0 | 2236 | <reponame>AK391/PaddleSpeech
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0... | 2.359375 | 2 |
tornado_debugger/debug.py | bhch/tornado-debugger | 1 | 2237 | import os.path
import re
import sys
import traceback
from pprint import pformat
import tornado
from tornado import template
SENSITIVE_SETTINGS_RE = re.compile(
'api|key|pass|salt|secret|signature|token',
flags=re.IGNORECASE
)
class ExceptionReporter:
def __init__(self, exc_info, handler):
self.... | 2.1875 | 2 |
base/pylib/seq_iter.py | jpolitz/lambda-py-paper | 1 | 2238 | class SeqIter:
def __init__(self,l):
self.l = l
self.i = 0
self.stop = False
def __len__(self):
return len(self.l)
def __list__(self):
l = []
while True:
try:
l.append(self.__next__())
except StopIteration:
... | 3.28125 | 3 |
caseworker/open_general_licences/enums.py | code-review-doctor/lite-frontend-1 | 0 | 2239 | <reponame>code-review-doctor/lite-frontend-1
from lite_content.lite_internal_frontend.open_general_licences import (
OGEL_DESCRIPTION,
OGTCL_DESCRIPTION,
OGTL_DESCRIPTION,
)
from lite_forms.components import Option
class OpenGeneralExportLicences:
class OpenGeneralLicence:
def __init__(self, i... | 2.015625 | 2 |
Matrix/Python/rotatematrix.py | pratika1505/DSA-Path-And-Important-Questions | 26 | 2240 | # -*- coding: utf-8 -*-
"""RotateMatrix.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1LX-dZFuQCyBXDNVosTp0MHaZZxoc5T4I
"""
#Function to rotate matrix by 90 degree
def rotate(mat):
# `N × N` matrix
N = len(mat)
# Transpose the m... | 4.09375 | 4 |
sort.py | EYH0602/FP_Workshop | 1 | 2241 | <gh_stars>1-10
def quicksort(xs):
if len(xs) == 0:
return []
pivot = xs[0]
xs = xs[1:]
left = [x for x in xs if x <= pivot]
right = [x for x in xs if x > pivot]
res = quicksort(left)
res.append(pivot)
res += quicksort(right)
return res
xs = [1, 3, 2, 4, 5, 2]
sorted_xs = ... | 3.75 | 4 |
bddtests/steps/bdd_test_util.py | TarantulaTechnology/fabric5 | 4 | 2242 | <reponame>TarantulaTechnology/fabric5
# Copyright IBM Corp. 2016 All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... | 2.046875 | 2 |
1.0.0/hp/dict.py | cefect/SOFDA0 | 0 | 2243 | '''
Created on Mar 6, 2018
@author: cef
hp functions for workign with dictionaries
'''
import logging, os, sys, math, copy, inspect
from collections import OrderedDict
from weakref import WeakValueDictionary as wdict
import numpy as np
import hp.basic
mod_logger = logging.getLogger(__name__) #... | 2.71875 | 3 |
Core/pre.py | Cyber-Dioxide/CyberPhish | 9 | 2244 | <reponame>Cyber-Dioxide/CyberPhish<filename>Core/pre.py
import os
import random
try:
from colorama import Fore, Style
except ModuleNotFoundError:
os.system("pip install colorama")
from urllib.request import urlopen
from Core.helper.color import green, white, blue, red, start, alert
Version = "2.2"
yellow = ("\033[1... | 2.328125 | 2 |
automatoes/authorize.py | candango/automatoes | 13 | 2245 | <filename>automatoes/authorize.py
#!/usr/bin/env python
#
# Copyright 2019-2020 <NAME>
# Copyright 2016-2017 <NAME> under MIT License
#
# 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
#
# ht... | 2.359375 | 2 |
rllib/agents/dqn/simple_q_torch_policy.py | jamesliu/ray | 3 | 2246 | <gh_stars>1-10
"""PyTorch policy class used for Simple Q-Learning"""
import logging
from typing import Dict, Tuple
import gym
import ray
from ray.rllib.agents.dqn.simple_q_tf_policy import (
build_q_models, compute_q_values, get_distribution_inputs_and_class)
from ray.rllib.models.modelv2 import ModelV2
from ray.... | 1.992188 | 2 |
viphoneme/T2IPA.py | NoahDrisort/ViSV2TTS | 1 | 2247 | #Grapheme
Rime_tone=[ "a","ă","â","e","ê","i","o","ô","ơ","u","ư","y","iê","oa","oă","oe","oo","uâ","uê","uô","uơ","uy","ươ","uyê","yê", #blank
"á","ắ","ấ","é","ế","í","ó","ố","ớ","ú","ứ","ý","iế","óa","oắ","óe","oó","uấ","uế","uố","ướ","úy","ướ","uyế","yế", #grave
... | 1.398438 | 1 |
taskengine/sessions.py | retmas-dv/deftcore | 0 | 2248 | <filename>taskengine/sessions.py
__author__ = '<NAME>'
from django.contrib.sessions.base_session import AbstractBaseSession
from django.contrib.sessions.backends.db import SessionStore as DBStore
class CustomSession(AbstractBaseSession):
@classmethod
def get_session_store_class(cls):
return SessionSt... | 2.046875 | 2 |
tests/assignments/test_assign7.py | acc-cosc-1336/cosc-1336-spring-2018-vcruz350 | 0 | 2249 | import unittest
#write the import for function for assignment7 sum_list_values
from src.assignments.assignment7 import sum_list_values
class Test_Assign7(unittest.TestCase):
def sample_test(self):
self.assertEqual(1,1)
#create a test for the sum_list_values function with list elements:
# bill 23 ... | 3.453125 | 3 |
setec/__init__.py | kgriffs/setec | 0 | 2250 | <filename>setec/__init__.py<gh_stars>0
# Copyright 2018 by <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 appl... | 2.0625 | 2 |
blender/arm/logicnode/native/LN_detect_mobile_browser.py | niacdoial/armory | 0 | 2251 | from arm.logicnode.arm_nodes import *
class DetectMobileBrowserNode(ArmLogicTreeNode):
"""Determines the mobile browser or not (works only for web browsers)."""
bl_idname = 'LNDetectMobileBrowserNode'
bl_label = 'Detect Mobile Browser'
arm_version = 1
def init(self, context):
super(DetectMobileBrowserNode, sel... | 2.390625 | 2 |
corehq/apps/dump_reload/tests/test_sql_dump_load.py | andyasne/commcare-hq | 471 | 2252 | <gh_stars>100-1000
import inspect
import json
import uuid
from collections import Counter
from datetime import datetime
from io import StringIO
import mock
from django.contrib.admin.utils import NestedObjects
from django.db import transaction, IntegrityError
from django.db.models.signals import post_delete, post_save
... | 1.367188 | 1 |
tests/keras/test_activations.py | the-moliver/keras | 150 | 2253 | import pytest
import numpy as np
from numpy.testing import assert_allclose
from keras import backend as K
from keras import activations
def get_standard_values():
'''
These are just a set of floats used for testing the activation
functions, and are useful in multiple tests.
'''
return np.array([[... | 2.875 | 3 |
scripts/H5toXMF.py | robertsawko/proteus | 0 | 2254 |
#import numpy
#import os
#from xml.etree.ElementTree import *
import tables
#from Xdmf import *
def H5toXMF(basename,size,start,finaltime,stride):
# Open XMF files
for step in range(start,finaltime+1,stride):
XMFfile = open(basename+"."+str(step)+".xmf","w")
XMFfile.write(r"""<?xml version="1.0... | 2.40625 | 2 |
tests/test_cli/test_generate/test_generate.py | lrahmani/agents-aea | 0 | 2255 | # -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# 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 ... | 1.960938 | 2 |
sphinx/ext/napoleon/__init__.py | PeerHerholz/smobsc | 3 | 2256 | """
sphinx.ext.napoleon
~~~~~~~~~~~~~~~~~~~
Support for NumPy and Google style docstrings.
:copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from sphinx import __display_version__ as __version__
from sphinx.application import Sphinx
from ... | 1.734375 | 2 |
plugins/similarity/rdkit/tanimoto/lbvs-entry.py | skodapetr/viset | 1 | 2257 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from rdkit import DataStructs
import plugin_api
__license__ = "X11"
class LbvsEntry(plugin_api.PluginInterface):
"""
Compute Tanimoto similarity.
"""
def __init__(self):
self.stream = None
self.counter = 0
self.first_... | 2.453125 | 2 |
mall_spider/spiders/actions/proxy_service.py | 524243642/taobao_spider | 12 | 2258 | <gh_stars>10-100
# coding: utf-8
import time
from config.config_loader import global_config
from mall_spider.spiders.actions.context import Context
from mall_spider.spiders.actions.direct_proxy_action import DirectProxyAction
__proxy_service = None
class ProxyService(object):
proxies_set = set()
proxies_lis... | 2.0625 | 2 |
app/weather_tests.py | joedanz/flask-weather | 1 | 2259 | import os
import weather
import datetime
import unittest
import tempfile
class WeatherTestCase(unittest.TestCase):
def setUp(self):
self.db_fd, weather.app.config['DATABASE'] = tempfile.mkstemp()
weather.app.config['TESTING'] = True
self.app = weather.app.test_client()
weather.init... | 2.78125 | 3 |
modules/sensors/Activator.py | memristor/mep2 | 5 | 2260 | import asyncio
class Activator:
def __init__(self, name, packet_stream=None):
self.ps = None
self.name = name
self.future = None
self.data = 0
self.state = ''
if packet_stream:
self.set_packet_stream(packet_stream)
@_core.module_cmd
def wait_activator(self):
pass
@_core.module_cmd
def check... | 2.5625 | 3 |
examples/retrieval/evaluation/sparse/evaluate_deepct.py | ArthurCamara/beir | 24 | 2261 | <gh_stars>10-100
"""
This example shows how to evaluate DeepCT (using Anserini) in BEIR.
For more details on DeepCT, refer here: https://arxiv.org/abs/1910.10687
The original DeepCT repository is not modularised and only works with Tensorflow 1.x (1.15).
We modified the DeepCT repository to work with Tensorflow latest... | 2.171875 | 2 |
Examples/Space Truss - Nodal Load.py | AmirHosseinNamadchi/PyNite | 2 | 2262 | <filename>Examples/Space Truss - Nodal Load.py
# Engineering Mechanics: Statics, 4th Edition
# <NAME>
# Problem 6.64
# Units for this model are meters and kilonewtons
# Import 'FEModel3D' and 'Visualization' from 'PyNite'
from PyNite import FEModel3D
from PyNite import Visualization
# Create a new model
truss = FEMod... | 2.703125 | 3 |
Using Yagmail to make sending emails easier.py | CodeMaster7000/Sending-Emails-in-Python | 1 | 2263 | import yagmail
receiver = "<EMAIL>" #Receiver's gmail address
body = "Hello there from Yagmail"
filename = "document.pdf"
yag = yagmail.SMTP("<EMAIL>")#Your gmail address
yag.send(
to=receiver,
subject="Yagmail test (attachment included",
contents=body,
attachments=filename,
)
| 2.296875 | 2 |
pycad/py_src/transformations.py | markendr/esys-escript.github.io | 0 | 2264 |
##############################################################################
#
# Copyright (c) 2003-2020 by The University of Queensland
# http://www.uq.edu.au
#
# Primary Business: Queensland, Australia
# Licensed under the Apache License, version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
#
# Development unt... | 1.75 | 2 |
example/complex_scalar_star_solver.py | ThomasHelfer/BosonStar | 2 | 2265 | <gh_stars>1-10
from bosonstar.ComplexBosonStar import Complex_Boson_Star
# =====================
# All imporntnat definitions
# =====================
# Physics defintions
phi0 = 0.40 # centeral phi
D = 5.0 # Dimension (total not only spacial)
Lambda = -0.2 # Cosmological constant
# Solver ... | 2.59375 | 3 |
setup.py | ouyhlan/fastNLP | 2,693 | 2266 | #!/usr/bin/env python
# coding=utf-8
from setuptools import setup, find_packages
with open('README.md', encoding='utf-8') as f:
readme = f.read()
with open('LICENSE', encoding='utf-8') as f:
license = f.read()
with open('requirements.txt', encoding='utf-8') as f:
reqs = f.read()
pkgs = [p for p in find_... | 1.609375 | 2 |
clients/client/python/ory_client/__init__.py | ory/sdk-generator | 0 | 2267 | <filename>clients/client/python/ory_client/__init__.py
# flake8: noqa
"""
Ory APIs
Documentation for all public and administrative Ory APIs. Administrative APIs can only be accessed with a valid Personal Access Token. Public APIs are mostly used in browsers. # noqa: E501
The version of the OpenAPI docu... | 1.585938 | 2 |
atmosphere/custom_activity/base_class.py | ambiata/atmosphere-python-sdk | 0 | 2268 | <filename>atmosphere/custom_activity/base_class.py<gh_stars>0
from abc import ABC, abstractmethod
from typing import Tuple
from requests import Response
from .pydantic_models import (AppliedExclusionConditionsResponse,
BiasAttributeConfigListResponse,
Comput... | 2.734375 | 3 |
Module1/file3.py | modulo16/PfNE | 0 | 2269 | <reponame>modulo16/PfNE
from __future__ import print_function, unicode_literals
#Ensures Unicode is used for all strings.
my_str = 'whatever'
#Shows the String type, which should be unicode
type(my_str)
#declare string:
ip_addr = '192.168.1.1'
#check it with boolean:(True)
ip_addr == '192.168.1.1'
#(false)
ip_addr ==... | 3.265625 | 3 |
pp_io_plugins/pp_kbddriver_plus.py | arcticmatter/pipresents-beep | 0 | 2270 | #enhanced keyboard driver
import copy
import os
import configparser
from pp_displaymanager import DisplayManager
class pp_kbddriver_plus(object):
# control list items
NAME=0 # symbolic name for input and output
DIRECTION = 1 # in/out
MATCH = 2 # for input the charac... | 2.5 | 2 |
grocery/migrations/0003_alter_item_comments.py | akshay-kapase/shopping | 0 | 2271 | <filename>grocery/migrations/0003_alter_item_comments.py
# Generated by Django 3.2.6 on 2021-09-03 15:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('grocery', '0002_alter_item_comments'),
]
operations = [
migrations.AlterField(
... | 1.5 | 2 |
projects/objects/buildings/protos/textures/colored_textures/textures_generator.py | yjf18340/webots | 1 | 2272 | #!/usr/bin/env python
# Copyright 1996-2019 Cyberbotics Ltd.
#
# 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 applica... | 2.1875 | 2 |
tutorial/test_env.py | viz4biz/PyDataNYC2015 | 11 | 2273 | """
test local env
"""
import os
for k, v in os.environ.iteritems():
print k, '=', v
| 2.015625 | 2 |
project2/marriage.py | filipefborba/MarriageNSFG | 0 | 2274 | <gh_stars>0
"""This file contains code for use with "Think Stats",
by <NAME>, available from greenteapress.com
Copyright 2014 <NAME>
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
from __future__ import print_function, division
import bisect
import numpy as np
import pandas as pd
import scipy.stats
im... | 2.953125 | 3 |
xfel/merging/application/reflection_table_utils.py | ErwinP/cctbx_project | 0 | 2275 | <gh_stars>0
from __future__ import absolute_import, division, print_function
from six.moves import range
from dials.array_family import flex
import math
class reflection_table_utils(object):
@staticmethod
def get_next_hkl_reflection_table(reflections):
'''Generate asu hkl slices from an asu hkl-sorted reflect... | 2.21875 | 2 |
rpython/memory/test/test_transformed_gc.py | jptomo/pypy-lang-scheme | 1 | 2276 | <reponame>jptomo/pypy-lang-scheme
import py
import inspect
from rpython.rlib.objectmodel import compute_hash, compute_identity_hash
from rpython.translator.c import gc
from rpython.annotator import model as annmodel
from rpython.rtyper.llannotation import SomePtr
from rpython.rtyper.lltypesystem import lltype, llmemor... | 1.8125 | 2 |
build/lib/rigidregistration/__init__.py | kem-group/rigidRegistration | 3 | 2277 | from . import utils
from . import display
from . import save
from . import FFTW
from . import stackregistration
__version__="0.2.1" | 1.085938 | 1 |
torchmetrics/retrieval/retrieval_fallout.py | rudaoshi/metrics | 0 | 2278 | # Copyright The PyTorch Lightning team.
#
# 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 i... | 2.015625 | 2 |
pydlm/tests/base/testKalmanFilter.py | onnheimm/pydlm | 423 | 2279 | <gh_stars>100-1000
import numpy as np
import unittest
from pydlm.modeler.trends import trend
from pydlm.modeler.seasonality import seasonality
from pydlm.modeler.builder import builder
from pydlm.base.kalmanFilter import kalmanFilter
class testKalmanFilter(unittest.TestCase):
def setUp(self):
self.kf1 ... | 2.53125 | 3 |
change_threshold_migration.py | arcapix/gpfsapi-examples | 10 | 2280 | from arcapix.fs.gpfs.policy import PlacementPolicy
from arcapix.fs.gpfs.rule import MigrateRule
# load placement policy for mmfs1
policy = PlacementPolicy('mmfs1')
# create a new migrate rule for 'sata1'
r = MigrateRule(source='sata1', threshold=(90, 50))
# add rule to start of the policy
policy.rules.insert(r, 0)
... | 1.484375 | 1 |
1/puzzle1.py | tjol/advent-of-code-2021 | 1 | 2281 | <reponame>tjol/advent-of-code-2021<gh_stars>1-10
#!/usr/bin/env python3
import sys
depths = list(map(int, sys.stdin))
increased = [a > b for (a, b) in zip(depths[1:], depths[:-1])]
print(sum(increased))
| 3.0625 | 3 |
project/app/paste/controllers.py | An0nYm0u5101/Pastebin | 1 | 2282 | from flask import Blueprint, request, render_template, \
flash, g, session, redirect, url_for, jsonify
from app import db, requires_auth
from flask_cors import CORS
from .models import Paste
import uuid
from datetime import datetime
from app.user.models import User
from pygments import highlight
from pygments.lexers i... | 2.1875 | 2 |
control_drone/run_model_on_cam.py | Apiquet/DeepLearningFrameworkFromScratch | 1 | 2283 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This script run neural network model on a camera live stream
"""
import argparse
import cv2
import numpy as np
import os
import time
import sys
COMMANDS = {0: "move_forward", 1: "go_down", 2: "rot_10_deg",
3: "go_up", 4: "take_off", 5: "land", 6: "idle"}... | 2.765625 | 3 |
classify_images.py | rmsare/cs231a-project | 2 | 2284 | <filename>classify_images.py<gh_stars>1-10
"""
Classification of pixels in images using color and other features.
General pipeline usage:
1. Load and segment images (img_utils.py)
2. Prepare training data (label_image.py)
3. Train classifier or cluster data (sklearn KMeans, MeanShift, SVC, etc.)
4. Predict labels on ... | 3.390625 | 3 |
quick_start/my_text_classifier/predictors/sentence_classifier_predictor.py | ramild/allennlp-guide | 71 | 2285 | from allennlp.common import JsonDict
from allennlp.data import DatasetReader, Instance
from allennlp.models import Model
from allennlp.predictors import Predictor
from overrides import overrides
@Predictor.register("sentence_classifier")
class SentenceClassifierPredictor(Predictor):
def predict(self, sentence: st... | 2.453125 | 2 |
ciphers/SKINNY-TK2/SKINNY-TK2/skinnytk2.py | j-danner/autoguess | 7 | 2286 | # Created on Sep 7, 2020
# author: <NAME>
# contact: <EMAIL>
import os
output_dir = os.path.curdir
def skinnytk2(R=1):
"""
This function generates the relations of Skinny-n-n for R rounds.
tk ================================================> TWEAKEY_P(tk) ===> ---
SB ... | 2.84375 | 3 |
tests/test_bmipy.py | visr/bmi-python | 14 | 2287 | <filename>tests/test_bmipy.py<gh_stars>10-100
import pytest
from bmipy import Bmi
class EmptyBmi(Bmi):
def __init__(self):
pass
def initialize(self, config_file):
pass
def update(self):
pass
def update_until(self, then):
pass
def finalize(self):
pass
... | 2.0625 | 2 |
scrapy_compose/fields/parser/string_field.py | Sphynx-HenryAY/scrapy-compose | 0 | 2288 | <reponame>Sphynx-HenryAY/scrapy-compose
from scrapy_compose.utils.context import realize
from .field import FuncField as BaseField
class StringField( BaseField ):
process_timing = [ "post_pack" ]
def __init__( self, key = None, value = None, selector = None, **kwargs ):
#unify value format
if isinstance( valu... | 2.3125 | 2 |
app/request.py | vincentmuya/News-highlight | 0 | 2289 | import urllib.request
import json
from .models import News
# Getting api key
api_key = None
# Getting the movie base url
base_url = None
def configure_request(app):
global api_key,base_url
api_key = app.config['NEWS_API_KEY']
base_url = app.config['NEWS_API_BASE_URL']
def get_news_source(country,category)... | 3.046875 | 3 |
hypernet/src/thermophysicalModels/reactionThermo/mixture/multiComponent.py | christian-jacobsen/hypernet | 0 | 2290 | import numpy as np
from hypernet.src.general import const
from hypernet.src.general import utils
from hypernet.src.thermophysicalModels.reactionThermo.mixture import Basic
class MultiComponent(Basic):
# Initialization
###########################################################################
def __init... | 2.3125 | 2 |
Exercises/W08D04_Exercise_01_Django_Cat_Collector/main_app/models.py | Roger-Takeshita/Software_Engineer | 2 | 2291 | <filename>Exercises/W08D04_Exercise_01_Django_Cat_Collector/main_app/models.py
from django.db import models
from django.urls import reverse
from datetime import date
from django.contrib.auth.models import User #! 1 - Import user models
MEALS = (
('B', 'Breakfast'),
('L', 'Lunch'),
('D... | 2.71875 | 3 |
kedro-airflow/kedro_airflow/__init__.py | kedro-org/kedro-plugins | 6 | 2292 | <gh_stars>1-10
""" Kedro plugin for running a project with Airflow """
__version__ = "0.5.0"
| 0.9375 | 1 |
soccer/gameplay/plays/testing/debug_window_evaluator.py | AniruddhaG123/robocup-software | 1 | 2293 | <reponame>AniruddhaG123/robocup-software
import play
import behavior
import main
import robocup
import constants
import time
import math
## This isn't a real play, but it's pretty useful
# Turn it on and we'll draw the window evaluator stuff on-screen from the ball to our goal
class DebugWindowEvaluator(play.Play):
... | 3.609375 | 4 |
rainbowconnection/sources/phoenix/utils.py | zkbt/rainbow-connection | 6 | 2294 | from ...imports import *
def stringify_metallicity(Z):
"""
Convert a metallicity into a PHOENIX-style string.
Parameters
----------
Z : float
[Fe/H]-style metallicity (= 0.0 for solar)
"""
if Z <= 0:
return "-{:03.1f}".format(np.abs(Z))
else:
return "+{:03.1f}"... | 2.8125 | 3 |
shipane_sdk/transaction.py | awfssv/ShiPanE-Python-SDK | 1 | 2295 | # -*- coding: utf-8 -*-
class Transaction(object):
def __init__(self, **kwargs):
self._completed_at = kwargs.get('completed_at')
self._type = kwargs.get('type')
self._symbol = kwargs.get('symbol')
self._price = kwargs.get('price')
self._amount = kwargs.get('amount')
de... | 2.890625 | 3 |
tensorflow_probability/python/distributions/laplace_test.py | wataruhashimoto52/probability | 1 | 2296 | <reponame>wataruhashimoto52/probability
# Copyright 2018 The TensorFlow Probability Authors.
#
# 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... | 2.015625 | 2 |
app/__init__.py | credwood/bitplayers | 1 | 2297 | <reponame>credwood/bitplayers<filename>app/__init__.py
import dash
from flask import Flask
from flask.helpers import get_root_path
from flask_login import login_required
from flask_wtf.csrf import CSRFProtect
from flask_admin import Admin, BaseView, expose
from flask_admin.contrib.sqla import ModelView
from datetime im... | 1.773438 | 2 |
selectinf/randomized/approx_reference_grouplasso.py | kevinbfry/selective-inference | 14 | 2298 | from __future__ import print_function
from scipy.linalg import block_diag
from scipy.stats import norm as ndist
from scipy.interpolate import interp1d
import collections
import numpy as np
from numpy import log
from numpy.linalg import norm, qr, inv, eig
import pandas as pd
import regreg.api as rr
from .randomization... | 2.09375 | 2 |
internals/states.py | mattjj/pyhsmm-collapsedinfinite | 0 | 2299 | <reponame>mattjj/pyhsmm-collapsedinfinite
from __future__ import division
import numpy as np
na = np.newaxis
import collections, itertools
import abc
from pyhsmm.util.stats import sample_discrete, sample_discrete_from_log, combinedata
from pyhsmm.util.general import rle as rle
# NOTE: assumes censoring. can make no c... | 1.953125 | 2 |