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 |
|---|---|---|---|---|---|---|
packaging/pack1/andrew_mod1.py | AndreiHondrari/python_exploration | 3 | 11400 | <reponame>AndreiHondrari/python_exploration<gh_stars>1-10
def something() -> None:
print("Andrew says: `something`.")
| 2.15625 | 2 |
app/api/v2/views/blacklist.py | MaggieChege/STORE-MANAGER-API-V2 | 0 | 11401 | blacklist=set()
def get_blacklist():
return blacklist
def add_to_blacklist(jti):
return blacklist.add(jti)
| 1.789063 | 2 |
apps/tasks/api/views.py | dayvidemerson/django-rest-example | 0 | 11402 | <gh_stars>0
from rest_framework import viewsets
from rest_framework import generics
from ..models import Task
from .serializers import TaskSerializer
class TaskViewSet(viewsets.ModelViewSet):
serializer_class = TaskSerializer
queryset = Task.objects.all()
| 1.71875 | 2 |
jarvis/__init__.py | jduncan8142/JARVIS | 0 | 11403 | __version__ = "0.0.3"
__author__ = "<NAME>"
__support__ = "<EMAIL>"
| 1.039063 | 1 |
src/figcli/test/cli/action.py | figtools/figgy-cli | 36 | 11404 | from typing import Union, List
import pexpect
from figcli.utils.utils import Utils
import sys
class FiggyAction:
"""
Actions prevent cyclic dependencies, and are designed for leveraging FiggyCli for cleanup steps when running inside
of tests.
"""
def __init__(self, command, extra_args=""):
... | 2.28125 | 2 |
test/python/test_elementwise_ops.py | avijit-chakroborty/ngraph-bridge | 142 | 11405 | <reponame>avijit-chakroborty/ngraph-bridge
# ==============================================================================
# Copyright 2018-2020 Intel Corporation
#
# 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 ... | 1.742188 | 2 |
qc/slips.py | mfkiwl/UREGA-qc | 0 | 11406 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: <NAME>.
@mail: <EMAIL>
"""
# from qc.__version__ import __version__
import georinex as gr
import numpy as np
from matplotlib.pyplot import figure, show
import matplotlib.pyplot as plt
obs = gr.load(
'tests/test_data/Rinex3/KLSQ00GRL_R_20213070000_01D_1... | 2.03125 | 2 |
tests/test_utils.py | jga/goldfinchsong | 0 | 11407 | from collections import OrderedDict
from datetime import datetime, timezone
import unittest
from os.path import join
from tinydb import TinyDB, storages
from goldfinchsong import utils
IMAGE_NAMES = ['goldfinch1.jpg', 'goldfinch2.jpg', 'goldfinch3.jpg',
'goldfinch4.jpg', 'goldfinch5.jpg']
TEST_TEXT1 = ... | 2.703125 | 3 |
lingvo/tasks/image/input_generator.py | allenwang28/lingvo | 2,611 | 11408 | # Lint as: python3
# Copyright 2018 The TensorFlow 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
#
# Unless ... | 2.359375 | 2 |
src/solutions/part1/q389_find_diff.py | hychrisli/PyAlgorithms | 0 | 11409 | from src.base.solution import Solution
from src.tests.part1.q389_test_find_diff import FindDiffTestCases
class FindDiff(Solution):
def verify_output(self, test_output, output):
return test_output[0] == output[0]
def run_test(self, input):
return self.findTheDifference(input[0], input[1])
... | 2.859375 | 3 |
mydict.py | zengboming/python | 0 | 11410 | <reponame>zengboming/python
#unit
#mydict.py
class Dict(dict):
def __init__(self,**kw):
super(Dict,self).__init__(**kw)
def __getattr__(self,key):
try:
return self[key]
except KeyError:
raise AttributeError(r"'Dict' object han no attribute'%s'" %key)
def __setattr__(self,key,value):
self[key]=value
... | 2.984375 | 3 |
copy_annotations/conflict.py | abhinav-kumar-thakur/TabularCellTypeClassification | 19 | 11411 | import contextlib
import os
import tempfile
import warnings
from enum import Enum
import mip
class IISFinderAlgorithm(Enum):
DELETION_FILTER = 1
ADDITIVE_ALGORITHM = 2
class SubRelaxationInfeasible(Exception):
pass
class NonRelaxableModel(Exception):
pass
class ConflictFinder:
"""This class... | 2.53125 | 3 |
output/models/nist_data/atomic/integer/schema_instance/nistschema_sv_iv_atomic_integer_pattern_1_xsd/__init__.py | tefra/xsdata-w3c-tests | 1 | 11412 | <filename>output/models/nist_data/atomic/integer/schema_instance/nistschema_sv_iv_atomic_integer_pattern_1_xsd/__init__.py
from output.models.nist_data.atomic.integer.schema_instance.nistschema_sv_iv_atomic_integer_pattern_1_xsd.nistschema_sv_iv_atomic_integer_pattern_1 import NistschemaSvIvAtomicIntegerPattern1
__all... | 1.140625 | 1 |
Dietscheduler/lib/menu_converter.py | floromaer/DietScheduler | 0 | 11413 | import re
import xlsxwriter
def parse_menu_to_excel(filename,menu_dict,days_dict,results,goal_dict,food_database,reversed_ingredient_dict,grocery_dict):
# making a temporary dict to map dates and columns in excel:
temp_dates_dict = {}
i=0
for key in days_dict.keys():
temp_dates_dict[day... | 3.265625 | 3 |
example_problems/tutorial/graph_connectivity/services/esempi/check_one_sol_server.py | romeorizzi/TAlight | 3 | 11414 | <gh_stars>1-10
#!/usr/bin/env python3
from sys import stderr, exit
from TALinputs import TALinput
from multilanguage import Env, Lang, TALcolors
from parentheses_lib import recognize
# METADATA OF THIS TAL_SERVICE:
problem="parentheses"
service="check_one_sol_server"
args_list = [
('input_formula',st... | 2.890625 | 3 |
app/validation/translator.py | codingedward/book-a-meal-api | 0 | 11415 | <gh_stars>0
"""Translates validation error messages for the response"""
messages = {
'accepted': 'The :field: must be accepted.',
'after': 'The :field: must be a date after :other:.',
'alpha': 'The :field: may contain only letters.',
'alpha_dash': 'The :field: may only contain letters, numbers, and da... | 2.5 | 2 |
chat/main/consumers.py | mlambir/channels_talk_pyconar2016 | 12 | 11416 | from channels import Group
# websocket.connect
def ws_add(message):
Group("chat").add(message.reply_channel)
# websocket.receive
def ws_message(message):
Group("chat").send({
"text": message.content['text'],
})
# websocket.disconnect
def ws_disconnect(message):
Group("chat").discard(message.r... | 2.515625 | 3 |
env/enviroment.py | Dorebom/robot_pybullet | 0 | 11417 | from copy import deepcopy
import numpy as np
import pybullet as p
import gym
from gym import spaces
from env.robot import Manipulator
from env.work import Work
class Env():
def __init__(self, reward,
step_max_pos = 0.002,
step_max_orn = 0.02,
initial_pos_noise = 0.0... | 2.484375 | 2 |
Thread/Threading.py | zxg110/PythonGrammer | 0 | 11418 | import _thread
import time
import threading
#
# def print_time(threadName,delay):
# count = 0;
# while count < 5:
# time.sleep(delay)
# count += 1;
# print("%s: %s" % (threadName, time.ctime(time.time())))
#
# try:
# _thread.start_new(print_time,("Thread-1",2,))
# _thread.start_n... | 3.734375 | 4 |
server/petsAPI/views.py | StoyanDimStoyanov/ReactDJango | 0 | 11419 | <reponame>StoyanDimStoyanov/ReactDJango
from django.shortcuts import render
from rest_framework import generics
# Create your views here.
from petsAPI.models import Pets
from petsAPI.serializers import PetSerializer
def index(req):
return render(req, 'index.html')
class PetsListApiView(generics.ListCreateAPIVi... | 2.015625 | 2 |
cluster_faces.py | sandhyalaxmiK/faces_clustering | 0 | 11420 | <filename>cluster_faces.py
import face_recognition
import sys,os
import re,cv2
def sorted_alphanumeric(data):
convert = lambda text: int(text) if text.isdigit() else text.lower()
alphanum_key = lambda key: [ convert(c) for c in re.split('([0-9]+)', key) ]
return sorted(data, key=alphanum_key)
input_dir_pa... | 2.703125 | 3 |
src/bbdata/endpoint/output/objects.py | big-building-data/bbdata-python | 0 | 11421 | import requests
from bbdata.config import output_api_url
from bbdata.util import handle_response
class Objects:
base_path = "/objects"
auth = None
def __init__(self, auth):
self.auth = auth
def get_all(self, tags=None, search=None, page=None, per_page=None,
writable=False):
... | 2.78125 | 3 |
python/tako/client/__init__.py | vyomkeshj/tako | 0 | 11422 | <gh_stars>0
from .exception import TakoException, TaskFailed # noqa
from .session import connect # noqa
| 1.109375 | 1 |
helpers/parser.py | yasahi-hpc/AMRNet | 0 | 11423 | <gh_stars>0
import argparse
def parse():
parser = argparse.ArgumentParser(add_help=True)
parser.add_argument('-data_dir', \
action='store', \
nargs='?', \
const=None, \
default='./dataset', \
... | 2.296875 | 2 |
api/patients/urls.py | Wellheor1/l2 | 10 | 11424 | <filename>api/patients/urls.py
from django.urls import path
from . import views
urlpatterns = [
path('search-card', views.patients_search_card),
path('search-individual', views.patients_search_individual),
path('search-l2-card', views.patients_search_l2_card),
path('create-l2-individual-from-card', vie... | 1.742188 | 2 |
resolwe_bio/kb/migrations/0002_alter_field_max_length.py | JureZmrzlikar/resolwe-bio | 0 | 11425 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.11 on 2016-11-15 07:06
from __future__ import unicode_literals
import django.contrib.postgres.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('resolwe_bio_kb', '0001_initial'),
]
operation... | 1.734375 | 2 |
setup.py | conan-hdk/xlwings | 0 | 11426 | <reponame>conan-hdk/xlwings<gh_stars>0
import os
import sys
import re
import glob
from setuptools import setup, find_packages
# long_description: Take from README file
with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as f:
readme = f.read()
# Version Number
with open(os.path.join(os.path.dirname(_... | 2.015625 | 2 |
secedgar/tests/test_cli.py | abbadata/sec-edgar | 0 | 11427 | import pytest
from click.testing import CliRunner
from secedgar.cli import daily, filing
from secedgar.utils.exceptions import FilingTypeError
def run_cli_command(cli, user_input, directory, catch_exceptions=False):
runner = CliRunner()
user_input = user_input + " --directory {}".format(directory)
return ... | 2.328125 | 2 |
hydro.py | garethcmurphy/hydrosolve | 0 | 11428 | import os
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import gridspec
nstep=200
nx=400
nv=3
u=np.zeros((nx,nv))
prim=np.zeros((nx,nv))
gam=5./3.
dx=1./nx
dt=1e-3
time=0
x=np.linspace(0,1,num=nx)
def ptou(pri):
u=np.zeros((nx,nv))
rho=pri[:,0]
v=pri[:,1]
prs=pri[:,2]
mom=rho*v
... | 2.46875 | 2 |
tests/test_pluralize.py | weixu365/pluralizer-py | 4 | 11429 |
import unittest
from pluralizer import Pluralizer
import re
# Standard singular/plural matches.
#
# @type {Array}
BASIC_TESTS = [
# Uncountables.
['firmware', 'firmware'],
['fish', 'fish'],
['media', 'media'],
['moose', 'moose'],
['police', 'police'],
['sheep', 'sheep'],
['series', 's... | 2.875 | 3 |
promgen/util.py | sundy-li/promgen | 0 | 11430 | # Copyright (c) 2017 LINE Corporation
# These sources are released under the terms of the MIT license: see LICENSE
import requests.sessions
from django.db.models import F
from promgen.version import __version__
from django.conf import settings
# Wrappers around request api to ensure we always attach our user agent
#... | 2.21875 | 2 |
integration_tests/test_suites/k8s-integration-test-suite/test_utils.py | ericct/dagster | 0 | 11431 | import time
import kubernetes
import pytest
from dagster_k8s.client import DagsterK8sError, WaitForPodState
from dagster_k8s.utils import retrieve_pod_logs, wait_for_job_success, wait_for_pod
from dagster_k8s_test_infra.helm import get_helm_test_namespace
def construct_pod_spec(name, cmd):
return kubernetes.clie... | 1.757813 | 2 |
radioepg/migrations/0001_initial.py | mervij/radiodns | 0 | 11432 | # Generated by Django 3.1.6 on 2021-02-15 08:52
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Service',
fields=[
... | 1.703125 | 2 |
uitester/ui/case_manager/tag_names_line_edit.py | IfengAutomation/uitester | 4 | 11433 | <filename>uitester/ui/case_manager/tag_names_line_edit.py
from PyQt5.QtCore import Qt, QStringListModel
from PyQt5.QtWidgets import QLineEdit, QCompleter
class TagNamesLineEdit(QLineEdit):
def __init__(self, parent=None):
super(QLineEdit, self).__init__(parent)
self.cmp = None
self.is_comp... | 2.078125 | 2 |
utils/__init__.py | millermuttu/torch_soft | 0 | 11434 | # # importing all the modules at once
# from .config import *
# from .normalization import *
# from .others import *
# from .img_reg import *
# from .transformation import *
# from .visualization import *
# importing the modules in a selective way
import utils.config
import utils.normalization
import utils.misc
import... | 1.070313 | 1 |
tasks.py | epu-ntua/QualiChain-mediator | 2 | 11435 | from celery import Celery
from clients.dobie_client import send_data_to_dobie
app = Celery('qualichain_mediator')
app.config_from_object('settings', namespace='CELERY_')
@app.task()
def consume_messages_async(message):
"""
This task is used to received job posting text and feed DOBIE component
"""
e... | 2.34375 | 2 |
ingest/ambit_geo.py | brianhouse/okavango | 2 | 11436 | import json, math
from ingest import ingest_json_body
from housepy import config, log, strings, util
def parse(request):
log.info("ambit_geo.parse")
sample = ingest_json_body(request)
if sample is None:
return sample, "Could not parse"
data = {}
for key, value in sample.items():
if... | 2.78125 | 3 |
gandyndns.py | nim65s/scripts | 1 | 11437 | #!/usr/bin/env python
'''update gandi DNS domain entry, with LiveDNS v5
Cf. https://doc.livedns.gandi.net/#work-with-domains
'''
import argparse
import ipaddress
import json
import os
from subprocess import check_output
import requests
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('-v', '... | 2.171875 | 2 |
leetcode.com/python/314_Binary_Tree_Vertical_Order_Traversal.py | mamane19/coding-interview-gym | 713 | 11438 | # Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
from collections import deque
from collections import defaultdict
class Solution(object):
def verticalOrder(self, ... | 3.59375 | 4 |
src/sentry/models/pluginhealth.py | ayesha-omarali/sentry | 0 | 11439 | <reponame>ayesha-omarali/sentry
from __future__ import absolute_import
from sentry.db.models import (
ArrayField, BoundedPositiveIntegerField, Model, FlexibleForeignKey, sane_repr
)
from django.db import models
from jsonfield import JSONField
from django.utils import timezone
from sentry.constants import ObjectSta... | 1.875 | 2 |
src/masonite/oauth/drivers/FacebookDriver.py | girardinsamuel/masonite-socialite | 1 | 11440 | from .BaseDriver import BaseDriver
from ..OAuthUser import OAuthUser
class FacebookDriver(BaseDriver):
def get_default_scopes(self):
return ["email"]
def get_auth_url(self):
return "https://www.facebook.com/dialog/oauth"
def get_token_url(self):
return "https://graph.facebook.com... | 2.59375 | 3 |
python/convert_to_readwise.py | t27/highlights-convert | 0 | 11441 | <filename>python/convert_to_readwise.py
import pandas as pd
import json
import glob
columns = ["Highlight","Title","Author","URL","Note","Location"]
# for sample of the input json look at any json in the root of the `results` folder
def convert_to_readwise_df(json_files):
"""Convert the internal json format to a ... | 3.5 | 4 |
ms_deisotope/qc/__init__.py | mstim/ms_deisotope | 18 | 11442 | """A collection of methods for determining whether a given spectrum is
of high quality (likely to produce a high quality interpretation)
"""
from .heuristic import xrea
from .isolation import CoIsolation, PrecursorPurityEstimator
__all__ = [
"xrea",
"CoIsolation", "PrecursorPurityEstimator"
]
| 1.609375 | 2 |
rpi_animations/message.py | Anski-D/rpi_animations_old | 0 | 11443 | <filename>rpi_animations/message.py
from .item import Item
class Message(Item):
"""
Message feature object in the rpi_animations package.
"""
def __init__(self, group, screen_animator) -> None:
"""
Initialise Message object with sprite group and screen object. Run initial setup method... | 3.046875 | 3 |
styrobot/cogs/help.py | ThatRedKite/styrobot | 1 | 11444 | <reponame>ThatRedKite/styrobot<gh_stars>1-10
import discord
from discord.ext import commands
from styrobot.util.contrib import info
import random
class BetterHelpCommand(commands.HelpCommand):
async def send_embed(self, embed):
embed.colour = discord.Colour.random()
await self.get_destination().se... | 2.515625 | 3 |
misc/Queue_hello.py | benhunter/py-stuff | 3 | 11445 | <reponame>benhunter/py-stuff<gh_stars>1-10
# Testing with threading and queue modules for Thread-based parallelism
import threading, queue, time
# The worker thread gets jobs off the queue. When the queue is empty, it
# assumes there will be no more work and exits.
# (Realistically workers will run until terminated... | 3.703125 | 4 |
tests/conftest.py | Beanxx/alonememo | 0 | 11446 | <reponame>Beanxx/alonememo
import pytest
from pymongo import MongoClient
import app as flask_app
test_database_name = 'spartatest'
client = MongoClient('localhost', 27017)
db = client.get_database(test_database_name)
@pytest.fixture
def app():
test_app = flask_app.create_app(test_database_name)
# 제네레이터 문법... | 2.15625 | 2 |
threader/__init__.py | mwoolweaver/threader | 34 | 11447 | """Tools to quickly create twitter threads."""
from .thread import Threader
__version__ = "0.1.1" | 1.296875 | 1 |
src/utility/count_pages.py | WikiCommunityHealth/wikimedia-revert | 0 | 11448 | <reponame>WikiCommunityHealth/wikimedia-revert<gh_stars>0
# count numbers of pages from the Mediawiki history dumps
import bz2
import subprocess
import os
from datetime import datetime
inizio = datetime.now()
dataset_folder = '/home/gandelli/dev/data/it/'
totali = set()
revisioni = set()
revert = set()
ns0 = set()
... | 3.015625 | 3 |
livescore/LivescoreCommon.py | TechplexEngineer/frc-livescore | 0 | 11449 | import colorsys
import cv2
from PIL import Image
import pkg_resources
from .LivescoreBase import LivescoreBase
from .details import Alliance, OngoingMatchDetails
class LivescoreCommon(LivescoreBase):
def __init__(self, game_year, **kwargs):
super(LivescoreCommon, self).__init__(game_year, **kwargs)
... | 2.09375 | 2 |
challenges/challenge.py | Tech-With-Tim/models | 2 | 11450 | <filename>challenges/challenge.py<gh_stars>1-10
from postDB import Model, Column, types
from datetime import datetime
import utils
class Challenge(Model):
"""
Challenge class to store the challenge details
Database Attributes:
Attributes stored in the `challenges` table.
:param int id: ... | 3.046875 | 3 |
settings.py | embrace-inpe/cycle-slip-correction | 6 | 11451 | """
Commom settings to all applications
"""
A = 40.3
TECU = 1.0e16
C = 299792458
F1 = 1.57542e9
F2 = 1.22760e9
factor_1 = (F1 - F2) / (F1 + F2) / C
factor_2 = (F1 * F2) / (F2 - F1) / C
DIFF_TEC_MAX = 0.05
LIMIT_STD = 7.5
plot_it = True
REQUIRED_VERSION = 3.01
CONSTELLATIONS = ['G', 'R']
COLUMNS_IN_RINEX = {'3.03': ... | 1.882813 | 2 |
io_almacen/channel/__init__.py | xyla-io/io_almacen | 0 | 11452 | <reponame>xyla-io/io_almacen<gh_stars>0
from .channel_io import Channel, channel_entity_url | 1.046875 | 1 |
tests/api/test_libcoap_api.py | ggravlingen/ikeatradfri | 726 | 11453 | """Test API utilities."""
import json
from pytradfri.api.libcoap_api import APIFactory
from pytradfri.gateway import Gateway
def test_constructor_timeout_passed_to_subprocess(monkeypatch):
"""Test that original timeout is passed to subprocess."""
capture = {}
def capture_args(*args, **kwargs):
c... | 2.46875 | 2 |
scrape_tvz.py | awordforthat/rhymes | 0 | 11454 | # scrapes Townes van Zandt lyrics
# sample code so I don't have to remember all of this stuff
# the next time I want to source some verses
from bs4 import BeautifulSoup as soup
import requests
import string
punctuation_trans_table = str.maketrans("", "", string.punctuation)
def strip_punctuation(s):
return s.tr... | 3.21875 | 3 |
chapter04/ifelse.py | persevere-in-coding-persist-in-learning/python2 | 3 | 11455 | # coding=utf-8
"""
控制结构if elif else的研究
Version: 0.1
Author: huijz
Date: 2020-08-24
"""
# 例1:if的基本用法:
flag = False
name = 'huijz'
if name == 'python': # 判断变量是否为 python
flag = True # 条件成立时设置标志为真
print 'welcome boss' # 并输出欢迎信息
else:
print name # 条件不成立时输出变量名称
# 例2:elif用法
num = 5
if num == 3: # 判断num的值
... | 4.15625 | 4 |
setup.py | korymath/JANN | 39 | 11456 | <filename>setup.py<gh_stars>10-100
from setuptools import setup
from setuptools import find_packages
setup(
name="Jann",
version="4.0.0",
description="Jann is a Nearest Neighbour retrieval-based chatbot.",
author="<NAME>",
author_email="<EMAIL>",
license="MIT",
url="https://github.com/kory... | 1.25 | 1 |
tests/scanner/scanners/ke_version_scanner_test.py | pombredanne/forseti-security | 1 | 11457 | # Copyright 2017 The Forseti Security 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
#
# Unless required by ap... | 1.828125 | 2 |
metrics/utils.py | edwardyehuang/iSeg | 4 | 11458 | <filename>metrics/utils.py<gh_stars>1-10
# ================================================================
# MIT License
# Copyright (c) 2021 edwardyehuang (https://github.com/edwardyehuang)
# ================================================================
import tensorflow as tf
from iseg.metrics.seg_metric_wrappe... | 2.0625 | 2 |
src/core/stats.py | dynaryu/vaws | 0 | 11459 | import math
def lognormal_mean(m, stddev):
""" compute mean of log x with mean and std. of x
Args:
m: mean of x
stddev: standard deviation of x
Returns: mean of log x
"""
return math.log(m) - (0.5 * math.log(1.0 + (stddev * stddev) / (m * m)))
def lognormal_stdde... | 3.875 | 4 |
vim.d/vimfiles/bundle/taghighlight/plugin/TagHighlight/module/languages.py | lougxing/gbox | 0 | 11460 | #!/usr/bin/env python
# Tag Highlighter:
# Author: <NAME> <abudden _at_ gmail _dot_ com>
# Copyright: Copyright (C) 2009-2013 <NAME>
# Permission is hereby granted to use and distribute this code,
# with or without modifications, provided that this copyright
# notice is copied with i... | 2.390625 | 2 |
archive/bayes_sensor.py | robmarkcole/HASS-data-science | 11 | 11461 | """
Bayes sensor code split out from
https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/binary_sensor/bayesian.py
This module is used to explore the sensor.
"""
from collections import OrderedDict
from const import *
def update_probability(prior, prob_true, prob_false):
"""Update ... | 3.1875 | 3 |
CoarseNet/MinutiaeNet_utils.py | khaihp98/minutiae | 0 | 11462 | <gh_stars>0
import os
import glob
import shutil
import logging
import matplotlib.pyplot as plt
import numpy as np
from scipy import ndimage, misc, signal, spatial
from skimage.filters import gaussian, gabor_kernel
import cv2
import math
def mkdir(path):
if not os.path.exists(path):
os.makedirs(path)
de... | 2.125 | 2 |
config/paths.py | fusic-com/flask-todo | 34 | 11463 | from settings import VAR_DIR
CACHE=VAR_DIR/'cache'
| 1.273438 | 1 |
Android.py | ChakradharG/Sudoku-Core | 0 | 11464 | import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' #To suppress warnings thrown by tensorflow
from time import sleep
import numpy as np
from cv2 import cv2
import pyautogui as pg
import Sudoku_Core as SC
import OCR
s = 513//9 #Size of board//9
fs = 25 #Size of the final image
def getBoard():
pg.click(266, 740)
sl... | 2.65625 | 3 |
app/model.py | kurapikaaaa/CITS3403Project | 1 | 11465 | from app import db, login
from flask_login import UserMixin
from datetime import datetime
from flask import url_for, redirect
from werkzeug.security import generate_password_hash, check_password_hash
class users(UserMixin, db.Model):
__tablename__ = 'users'
id = db.Column(db.Integer, primary_key=True, autoinc... | 2.625 | 3 |
bert_multitask_learning/top.py | akashnd/bert-multitask-learning | 1 | 11466 | # AUTOGENERATED! DO NOT EDIT! File to edit: source_nbs/12_top.ipynb (unless otherwise specified).
__all__ = ['empty_tensor_handling_loss', 'nan_loss_handling', 'create_dummy_if_empty', 'BaseTop', 'SequenceLabel',
'Classification', 'PreTrain', 'Seq2Seq', 'MultiLabelClassification', 'MaskLM']
# Cell
import l... | 1.96875 | 2 |
strings/#387/strings.py | sharmarkei/DSA-Practice | 0 | 11467 | <reponame>sharmarkei/DSA-Practice<gh_stars>0
class Solution(object):
def firstUniqChar(self, s):
"""
:type s: str
:rtype: int
"""
dict_1 = {}
for i in s:
if i not in dict_1:
dict_1[i] = 1
else:
dict_1[i... | 3.109375 | 3 |
challenge/utils/cancellation_code.py | AlonViz/IML.HUJI | 0 | 11468 | <reponame>AlonViz/IML.HUJI
import re
def process_cancellation_code(code):
regex_days_before = "^(([0-9]+)D)(([0-9]+)N|([0-9]+)P)"
regex_no_show = "(([0-9]+)P|([0-9]+)N)"
options = re.split("_", code)
final = []
for option in options:
days_match = re.match(regex_days_before, option)
... | 2.71875 | 3 |
acronym/scoring.py | sigma67/acronym | 340 | 11469 | import re
regex = re.compile('[^a-zA-Z]')
def score_word(word, corpus=None):
word = regex.sub('', word) # leave only alpha
score = 0
consec_bonus = 2
for i, letter in enumerate(word):
if letter.islower():
continue
if i > 0 and word[i-1].upper():
score += conse... | 3.828125 | 4 |
e2e_test.py | bartossh/hebbian_mirror | 2 | 11470 | <gh_stars>1-10
import requests
num_of_iter = 2
data = open('./assets/test.jpg', 'rb').read()
for i in range(0, num_of_iter):
res = requests.get(
url='http://0.0.0.0:8000/recognition/object/boxes_names'
)
print("\n RESPONSE GET boxes names for test number {}: \n {}"
.format(i, res.__dict__)... | 3.03125 | 3 |
appendix/auc_accuracy/train_nn_metric.py | rit-git/tagging | 7 | 11471 | <gh_stars>1-10
import argparse
import os
import torch
import torch.nn as nn
from torchtext.data import TabularDataset, BucketIterator
from torchtext.data import Field
from torchtext.vocab import Vectors, GloVe
from tqdm import tqdm, trange
import sys
import os
sys.path.insert(0, "../../pyfunctor")
sys.path.insert(0, "... | 2.28125 | 2 |
setup.py | teamproserve/pinkopy | 0 | 11472 | <filename>setup.py
#!/usr/bin/env python
from setuptools import setup, find_packages
import sys
try:
import pypandoc
readme = pypandoc.convert('README.md', 'rst')
except(IOError, ImportError):
with open('README.md') as f:
readme = f.read()
install_requires = [
'cachetools>=1.1.5',
'reques... | 1.476563 | 1 |
scss/extension/core.py | xen0n/pyScss | 0 | 11473 | """Extension for built-in Sass functionality."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from itertools import product
import math
import os.path
from pathlib import PurePosixPath
from six.moves import xrange
... | 2.03125 | 2 |
pypy/module/cpyext/test/test_iterator.py | wdv4758h/mu-client-pypy | 34 | 11474 | from pypy.module.cpyext.test.test_api import BaseApiTest
class TestIterator(BaseApiTest):
def test_check_iter(self, space, api):
assert api.PyIter_Check(space.iter(space.wrap("a")))
assert api.PyIter_Check(space.iter(space.newlist([])))
assert not api.PyIter_Check(space.w_type)
ass... | 2.234375 | 2 |
capsule_em/experiment.py | jrmendeshurb/google-research | 6 | 11475 | <reponame>jrmendeshurb/google-research
# coding=utf-8
# Copyright 2019 The Google Research 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/LICE... | 1.742188 | 2 |
grafana/common/dashboards/aggregated/client_subnet_statistics_detail.py | MikeAT/visualizer | 6 | 11476 | # Copyright 2021 Internet Corporation for Assigned Names and Numbers.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, you can obtain one at https://mozilla.org/MPL/2.0/.
#
# Developed by Sinodun IT (sinodun.com)
#
# Ag... | 1.734375 | 2 |
pylearn2/neuroimaging_utils/tutorials/nice/jobman/simple_train.py | rdevon/pylearn2 | 1 | 11477 | <filename>pylearn2/neuroimaging_utils/tutorials/nice/jobman/simple_train.py
"""
Module to train a simple MLP for demo.
"""
from jobman.tools import expand
from jobman.tools import flatten
import logging
import nice_experiment
import numpy as np
from os import path
from pylearn2.config import yaml_parse
from pylearn2.... | 2.484375 | 2 |
_Framework/Layer.py | isfopo/MacroPushScript | 0 | 11478 | <filename>_Framework/Layer.py
#Embedded file name: /Users/versonator/Jenkins/live/output/Live/mac_64_static/Release/python-bundle/MIDI Remote Scripts/_Framework/Layer.py
u"""
Module implementing a way to resource-based access to controls in an
unified interface dynamic.
"""
from __future__ import absolute_import, print... | 2.25 | 2 |
src/retrieve_exons_sequence_genomes.py | naturalis/brassicaceae-hybseq-pipeline | 5 | 11479 | <gh_stars>1-10
# retrieve_exons_sequence_genomes.py
# This script is to retrieve exons from sequenced genomes which are also present in the reference genome (A. thaliana).
# To identify the contigs from the sequenced genomes, each contig has to be retrieved from A. thaliana first.
# Then, for each sequence query of A. ... | 2.828125 | 3 |
lexical/lexical.py | xmeng17/Malicious-URL-Detection | 0 | 11480 | import re
class lexical(object):
'''Lexical Features:
Top Level domain (str)
Number of dots in hostname (int)
Average token length of hostname (float)
Max token length of hostname (int)
Average token length of path (float)
Max token length of path (int)
'''
def __init__(self):
pass
de... | 3.703125 | 4 |
stacker/tests/providers/aws/test_interactive.py | GoodRx/stacker | 1 | 11481 | <gh_stars>1-10
import unittest
from ....providers.aws.interactive import requires_replacement
def generate_resource_change(replacement=True):
resource_change = {
"Action": "Modify",
"Details": [],
"LogicalResourceId": "Fake",
"PhysicalResourceId": "arn:aws:fake",
"Replaceme... | 2.953125 | 3 |
setup.py | digicert/digicert_express | 2 | 11482 | from setuptools import setup, find_packages
def readme():
with open('README.rst') as f:
return f.read()
setup(
name='digicert-express',
version='1.1dev2',
description='Express Install for DigiCert, Inc.',
long_description=readme(),
classifiers=[
'Development Status :: 3 - Alpha... | 1.335938 | 1 |
pytorch/plane.py | NunoEdgarGFlowHub/autoregressive-energy-machines | 83 | 11483 | import argparse
import json
import numpy as np
import os
import torch
import data_
import models
import utils
from matplotlib import cm, pyplot as plt
from tensorboardX import SummaryWriter
from torch import optim
from torch.utils import data
from tqdm import tqdm
from utils import io
parser = argparse.ArgumentPars... | 2.109375 | 2 |
music/music.py | spacerunaway/world_recoder | 0 | 11484 | <reponame>spacerunaway/world_recoder
import sys
sys.path.append('../utils')
from utils import *
from doubly_linkedlist import *
def link_chords(chordprogression):
"""
Chord progression is a sequences of chords.
A valid linked_chords can be one of the following:
1: the chord name(str) in CHORD dict
... | 3.359375 | 3 |
azure-mgmt/tests/test_mgmt_documentdb.py | v-Ajnava/azure-sdk-for-python | 4 | 11485 | # coding: utf-8
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#---------------------------------------------------------------------... | 2 | 2 |
config.py | somritabanerjee/speedplusbaseline | 0 | 11486 | import argparse
PROJROOTDIR = {'mac': '/Users/taehapark/SLAB/speedplusbaseline',
'linux': '/home/somrita/Documents/Satellite_Pose_Estimation/speedplusbaseline'}
DATAROOTDIR = {'mac': '/Users/taehapark/SLAB/speedplus/data/datasets',
'linux': '/home/somrita/Documents/Satellite_Pose_Estim... | 2.03125 | 2 |
h1/api/insight_project_journal_api.py | hyperonecom/h1-client-python | 0 | 11487 | """
HyperOne
HyperOne API # noqa: E501
The version of the OpenAPI document: 0.1.0
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from h1.api_client import ApiClient, Endpoint as _Endpoint
from h1.model_utils import ( # noqa: F401
check_allowe... | 1.804688 | 2 |
forms/views.py | urchinpro/L2-forms | 0 | 11488 | <filename>forms/views.py
from django.http import HttpResponse
from django.utils.module_loading import import_string
def pdf(request):
"""
Get form's number (decimal type: 101.15 - where "101" is form's group and "15"-number itsels).
Can't use 1,2,3,4,5,6,7,8,9 for number itsels - which stands after the po... | 2.171875 | 2 |
main.py | code-aifarmer/Python-EXE-maker | 2 | 11489 | <gh_stars>1-10
#!/usr/bin/env python
import PySimpleGUI as sg
import cv2
import subprocess
import shutil
import os
import sys
# Demonstrates a number of PySimpleGUI features including:
# Default element size
# auto_size_buttons
# Button
# Dictionary return values
# update of elements in form (Text, Input)
def... | 2.765625 | 3 |
seisflows/system/lsf_sm.py | jpvantassel/seisflows | 97 | 11490 | #
# This is Seisflows
#
# See LICENCE file
#
###############################################################################
raise NotImplementedError
| 1.023438 | 1 |
data/objects/sample.py | predictive-analytics-lab/tiny-comparison-framework | 0 | 11491 | <filename>data/objects/sample.py
from data.objects.data import Data
class Sample(Data):
"""
A way to sample from a dataset for testing purposes.
"""
def __init__(self, data, num = 100):
self.data = data
self.dataset_name = data.get_dataset_name()
self.class_attr = data.get_class... | 3.328125 | 3 |
parkrundata/views.py | remarkablerocket/parkrundata | 0 | 11492 | <reponame>remarkablerocket/parkrundata
# -*- coding: utf-8 -*-
from rest_framework import viewsets
from rest_framework.permissions import IsAuthenticatedOrReadOnly
from .models import Country, Event
from .serializers import CountrySerializer, EventSerializer
class CountryViewSet(viewsets.ModelViewSet):
queryset... | 1.976563 | 2 |
spearmint/models/gp_classifier.py | jatinarora2409/Spearmint | 0 | 11493 | <gh_stars>0
# -*- coding: utf-8 -*-
# Spearmint
#
# Academic and Non-Commercial Research Use Software License and Terms
# of Use
#
# Spearmint is a software package to perform Bayesian optimization
# according to specific algorithms (the “Software”). The Software is
# designed to automatically run experiments (thus th... | 1.382813 | 1 |
pycom_lopy4_LoRaBattMonitor/transmitter/main.py | AidanTek/Fab-Cre8_IoT | 0 | 11494 | from machine import Pin, ADC
from network import LoRa
import socket
from utime import sleep
# Use a pin for a 'config' mode
configPin = Pin('P21', Pin.IN, Pin.PULL_UP)
# Create an ADC object
adc = ADC()
# vbatt pin:
vbatt = adc.channel(attn=1, pin='P16')
def battConversion():
adcVoltage = vbatt()
voltage = ... | 2.875 | 3 |
scrapi/harvesters/lwbin.py | wearpants/scrapi | 34 | 11495 | """
A Lake Winnipeg Basin Information Network (BIN) harvester for the SHARE project
Example API request: http://130.179.67.140/api/3/action/package_search?q= (problematic)
http://130.179.67.140/api/3/action/current_package_list_with_resources (currently using)
It oddly returns 5 more datasets than all searchable ones ... | 2.140625 | 2 |
catalog/bindings/gmd/point.py | NIVANorge/s-enda-playground | 0 | 11496 | from dataclasses import dataclass
from bindings.gmd.point_type import PointType
__NAMESPACE__ = "http://www.opengis.net/gml"
@dataclass
class Point(PointType):
"""A Point is defined by a single coordinate tuple.
The direct position of a point is specified by the pos element which
is of type DirectPositi... | 3.15625 | 3 |
hknweb/exams/migrations/0019_auto_20200413_0212.py | AndrewKe/hknweb | 0 | 11497 | <gh_stars>0
# Generated by Django 2.2.8 on 2020-04-13 09:12
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('exams', '0018_auto_20200412_1715'),
]
operations = [
migrations.CreateModel(
name='... | 1.632813 | 2 |
tools/linear_algebra/preconditioners/Jacobi.py | mathischeap/mifem | 1 | 11498 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""Jacobian preconditioner.
"""
from root.config.main import *
from scipy import sparse as spspa
from tools.linear_algebra.preconditioners.base import Preconditioner
class JacobiPreconditioner(Preconditioner):
""""""
def __init__(self, A):
""""""
super(Ja... | 2.34375 | 2 |
social_redirects/models.py | JoshZero87/site | 4 | 11499 | <reponame>JoshZero87/site
from django.contrib.sites.models import Site
from django.db import models
class Redirect(models.Model):
title = models.CharField(max_length=200)
description = models.CharField(max_length=1024, blank=True, null=True)
social_image = models.ImageField(null=True, blank=True)
old... | 2.234375 | 2 |