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 |
|---|---|---|---|---|---|---|
noval/plugins/windowservice.py | bopopescu/NovalIDE | 0 | 53600 | from noval import GetApp,_
import noval.iface as iface
import noval.plugin as plugin
import tkinter as tk
from tkinter import ttk,messagebox
import noval.preference as preference
from noval.util import utils
import noval.ui_utils as ui_utils
import noval.consts as consts
MAX_WINDOW_MENU_NUM_ITEMS = 30
##c... | 2.265625 | 2 |
dp4py_logging/config.py | ONSdigital/dp4py-logging | 0 | 53601 | <reponame>ONSdigital/dp4py-logging<gh_stars>0
import logging
def log_format(x):
return ['%({0:s})'.format(i) for i in x]
def config_for_formatter(formatter_cls: type, supported_keys: list, level: int=logging.INFO) -> dict:
"""
Returns a logging config for the desired formatter
:param formatter_cls: ... | 2.65625 | 3 |
spotify_flows/spotify/collections.py | maxime-filippini/spotify-flows | 0 | 53602 | """
This module is the main API used to create track collections
"""
# Standard library imports
import copy
import random
import inspect
import logging
import itertools
from typing import Any
from typing import List
from typing import Union
from typing import Tuple
from typing import Callable
from dataclasses impo... | 2.6875 | 3 |
process_pop.py | eborisch/mn_k12_cases | 0 | 53603 | #!/usr/bin/env python
import csv
import string
import sys
f = open('public_enrollment.txt')
pub = csv.reader(f, csv.excel_tab)
sys.stdout = open('popcounts.csv', 'wt')
h = pub.__next__()
last = None
grades = 0
for r in pub:
r = [n.replace(',','') for n in r]
school = '{:04d}-{:02d}-{:03d}'.format(int(r[3])... | 3 | 3 |
OSeMOSYS_PuLP.py | OSeMOSYS/OSeMOSYS-PuLP | 4 | 53604 | <filename>OSeMOSYS_PuLP.py
# !/usr/bin/env python3
# -*- coding: utf-8 -*-
# Author: <NAME>, Copyright 2019
# OSeMOSYS version: OSeMOSYS_2017_11_08
__doc__ = """
========================================================================================================================
OSeMOSYS-PuLP: A Stoc... | 1.46875 | 1 |
descarteslabs/common/http/authorization.py | carderne/descarteslabs-python | 0 | 53605 | <reponame>carderne/descarteslabs-python
import six
def add_bearer(token):
"""For use with Authorization headers, add "Bearer "."""
if token:
return (u"Bearer " if isinstance(token, six.text_type) else b"Bearer ") + token
else:
return token
def remove_bearer(token):
"""For use with Au... | 2.96875 | 3 |
libs/graph/Graph.py | IA-MP/KnightTour | 0 | 53606 | from libs.graph.DLinkedList import Queue, DoubledLinkedList as List
from libs.graph.PriorityQueue import PriorityQueueBinary as PriorityQueue
from libs.graph.Tree import *
#it is better to use a DoubledLinkedList to operate with a great efficiency on
#the lists those will be used in the graph representation
class Node... | 3.359375 | 3 |
Python-Task6/NumberCount.py | gaushikmr/codewayy-python | 0 | 53607 | <gh_stars>0
# Question:5
countNumber = input("Enter the string ")
print ("Original string is : " + countNumber)
res = len(countNumber.split())
print ("Number of words in string is : " + str(res))
| 4.03125 | 4 |
mayan/apps/document_comments/search.py | wan1869/dushuhu | 1 | 53608 | from django.utils.translation import ugettext_lazy as _
from mayan.apps.documents.search import document_page_search, document_search
document_page_search.add_model_field(
field='document_version__document__comments__comment',
label=_('Comments')
)
document_search.add_model_field(
field='comments__comment... | 1.710938 | 2 |
test/test_csv_functions.py | mz2449/embryo-analyzer | 0 | 53609 | import unittest
import csv_functions
class TestCsvFunctions(unittest.TestCase):
def test_open_test_file(self):
expected = [['X', 'Y'], ['0', '0'], ['1', '10'], ['2', '15'], ['3', '50'], ['4', '80'], ['5', '100'],
['6', '80'], ['7', '45'], ['8', '35'], ['9', '15'], ['10', '5']]
... | 3.328125 | 3 |
leet/stack/isValid.py | monishshah18/python-cp-cheatsheet | 140 | 53610 | <filename>leet/stack/isValid.py
class Solution:
def isValid(self, s: str) -> bool:
while '[]' in s or '()' in s or '{}' in s:
s = s.replace('[]','').replace('()','').replace('{}','')
return len(s) == 0
"""
time: 10 min
time: O(n)
space: O(n)
errors:
lower case values/keys
Have to use s... | 3.828125 | 4 |
molly/apps/places/providers/__init__.py | mollyproject/mollyproject | 7 | 53611 | <reponame>mollyproject/mollyproject
from molly.conf.provider import Provider
class BaseMapsProvider(Provider):
def import_data(self):
pass
def real_time_information(self, entity):
return None
def augment_metadata(self, entities, **kwargs):
pass
from naptan import Nap... | 1.640625 | 2 |
Webcast/2015 webcast/2015Webcast1.py | hueyjj/UCSCWebcast | 0 | 53612 | <gh_stars>0
#!/usr/bin/env python
import sys, os, time, urllib, urllib.request, shutil, re, lxml, threading, queue, multiprocessing
import hashlib
from bs4 import BeautifulSoup
from urllib.parse import urlparse
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.sup... | 2.828125 | 3 |
mmseg/models/backbones/cabinet.py | yunchu/mmsegmentation | 3 | 53613 | # Copyright (c) 2020. Huawei Technologies Co., Ltd.
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (c) 2019 MendelXu
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
import math
import torch
import torch.nn as nn
import torch.nn.functional as ... | 1.828125 | 2 |
PLNCrawler/crawler/algorithms.py | schuberty/PLNCrawler | 7 | 53614 | import pandas as pd
import re
import requests
from bs4 import BeautifulSoup
from time import sleep
from .requester import Requester
class Crawler:
"""
"""
def __init__(self, url, sarcasm, as_archived=False):
self.__url = url
self.__sarcasm = sarcasm
self.__as_archived = as_archived
self.__data = list()
... | 3.4375 | 3 |
deeplearning/ml4pl/poj104/debug_build_graph.py | Zacharias030/ProGraML | 0 | 53615 | from pathlib import Path
import pickle
import time, os, json, sys
import numpy as np
#from matplotlib import pyplot as plt
import networkx as nx
#import tqdm
#import torch
#from torch_geometric.data import Data, DataLoader, InMemoryDataset
#import torch_geometric
# make this file executable from anywhere
#if __nam... | 2.015625 | 2 |
setup.py | aayla-secura/simple_CORS_https_server | 3 | 53616 | <reponame>aayla-secura/simple_CORS_https_server
from setuptools import setup, find_packages
with open('README.md', 'r') as fh:
long_description = fh.read()
setup(
name='mixnmatchttp',
version='1.0.dev32',
url='https://github.com/aayla-secura/mixnmatchttp',
author='AaylaSecura1138',
author_emai... | 1.492188 | 1 |
code/ci360-sfmc-connector/azure-function/python/sfmcSMS/__init__.py | sassoftware/ci360-extensions | 3 | 53617 | <reponame>sassoftware/ci360-extensions
"""
Copyright © 2021, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
"""
import logging
import os
import json
import urllib3
from datetime import datetime
from uuid import uuid4
from re import split
import azure.functions as func
fro... | 1.765625 | 2 |
packs/autoscale/sensors/autoscale_governor_sensor.py | Mattlk13/incubator | 31 | 53618 | import time
import eventlet
import ast
from st2reactor.sensor.base import PollingSensor
__all_ = [
'AutoscaleGovernorSensor'
]
eventlet.monkey_patch(
os=True,
select=True,
socket=True,
thread=True,
time=True)
GROUP_ACTIVE_STATUS = [
'expanding',
'deflating'
]
class AutoscaleGovernor... | 2.265625 | 2 |
submit/models.py | Krittisak/ShapeDeepLearning | 0 | 53619 | <reponame>Krittisak/ShapeDeepLearning<filename>submit/models.py
# Simple CNN model for CIFAR-10
import os
os.environ['KERAS_BACKEND']='theano'
from keras.models import Sequential
from keras.layers import Dense
from keras.layers import Dropout
from keras.layers import Flatten
from keras.constraints import maxnorm
from k... | 2.46875 | 2 |
setup.py | Spratiher9/SparkDataset | 28 | 53620 | #!/usr/bin/env python
# Author: <NAME>
# email: <EMAIL>
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
with open(('README.md'), encoding='utf-8') as readme:
bdescription = readme.read()
setup(
name='sparkdataset',
description=("Provides instant access to ... | 1.46875 | 1 |
generators/usage-generator.py | cmusv-sc/OpenNEX-Team5 | 0 | 53621 | import uuid
import datetime
import random
import sys
args = sys.argv[1:]
if(len(args) < 2):
print "usage: python usage-generator.py [idCount] [numOfLines] (outdir)"
sys.exit(1)
OUTDIR=""
if len(args) > 2:
OUTDIR=args[2]
# generate X unique IDs
X=int(args[0])
ids=[]
for i in range(0, X):
aId = uuid.uuid4()
ids.a... | 2.6875 | 3 |
1_course/4_week/2_majority_element/python/main.py | claytonjwong/Algorithms-UCSD | 6 | 53622 | <filename>1_course/4_week/2_majority_element/python/main.py
# python3
##
#
# Python3 implementation of majority element
#
# (c) Copyright 2019 <NAME> ( http://www.claytonjwong.com )
#
##
from typing import List
class Solution:
def hasMajorityElement( self, A: List[int], N: int ) -> bool:
me = 0
c... | 3.953125 | 4 |
deeplearning/chainer/autoGenerate/superResolution/collect.py | terasakisatoshi/pythonCodes | 0 | 53623 | <reponame>terasakisatoshi/pythonCodes
import codecs
import re
import urllib.parse
import urllib.request
import os
import socket
from PIL import Image
from scipy.misc import imread,imsave
socket.setdefaulttimeout(10)
Image.MAX_IMAGE_PIXELS = None
def collect_data():
if not os.path.exists("portrait"):
os.mk... | 2.65625 | 3 |
contributions/JsonRfAnalyser/JsonRfAnalyser.py | svanbodegraven/VariantSpark | 0 | 53624 | #!/usr/bin/python
import json
import sys
import csv
import math
def VarInBranchLimited(tree, uvars, writer, limit):
"""Return all variables in a branch with limit (list)"""
# Check if the numSplit drop below limit or if it raches a lastSplit node
if ((len(uvars)+tree['Weigth']) <= limit) or (tree['LastSpl... | 3.15625 | 3 |
MachineLearning/rankingCard/makeRankingCard.py | HeRaNO/ChickenRibs | 14 | 53625 | '''
makeRankingCard.py:制作评分卡。
Author: HeRaNO
'''
import sys
import imblearn
import numpy as np
import pandas as pd
from sklearn.linear_model import LogisticRegression as LR
# Read data start
model = pd.read_csv("model_data.csv", index_col = 0)
vali = pd.read_csv("vali_data.csv", index_col = 0)
# Read data end
# S... | 3.390625 | 3 |
copy_flac_to_wav.py | AndreySibiryakov/tools | 4 | 53626 | import os
import shutil
from subprocess import call, check_output
data = ['dlc2_215_05_movingon_01_02',
'dlc2_215_05_movingon_01_03',
'dlc2_215_05_movingon_01_04',
'dlc2_215_05_movingon_01_05',
'dlc2_215_05_movingon_01_06',
'dlc2_215_05_movingon_01_07',
'dlc2... | 1.734375 | 2 |
info/__init__.py | Crystalordiamond/GitHub_Information | 1 | 53627 | import logging
from logging.handlers import RotatingFileHandler
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from redis import StrictRedis
from flask_wtf.csrf import CSRFProtect, generate_csrf
from flask_session import Session
from config import config_dict
# 暂时没有app对象,就不会去初始化,只是声明一下.为什么能这样做:点进去源码
... | 2.296875 | 2 |
loris/app/autoscripting/form_creater.py | gucky92/loris | 1 | 53628 | """Class to dynamically create the different forms in the config file
"""
import os
from wtforms import (
BooleanField, SelectField, StringField, FloatField, IntegerField,
FormField, TextAreaField, FieldList, DecimalField
)
from wtforms.validators import InputRequired, Optional, NumberRange, \
ValidationEr... | 2.5625 | 3 |
uniparser_morph/lex_rule.py | fmatter/uniparser-morph | 0 | 53629 | import copy
from .reduplication import RegexTest
from .common_functions import check_for_regex
class LexRule:
"""
A class that represents a regex-based second order lexical
rule. Rules are applied after the primary morphological
analysis has been completed and are used to add fields
to the words w... | 3.203125 | 3 |
Module 3/Chapter 6/ch6_18.py | PacktPublishing/Natural-Language-Processing-Python-and-NLTK | 50 | 53630 | import nltk
from nltk.corpus import wordnet
from nltk.corpus import wordnet as wn
from nltk.corpus import wordnet_ic
brown_ic = wordnet_ic.ic('ic-brown.dat')
semcor_ic = wordnet_ic.ic('ic-semcor.dat')
from nltk.corpus import genesis
genesis_ic = wn.ic(genesis, False, 0.0)
lion = wn.synset('lion.n.01')
cat = wn.synset('... | 2.546875 | 3 |
DFS/BinaryTreeMaxPathSum.py | karan2808/Python-Data-Structures-and-Algorithms | 2 | 53631 | class Solution:
def __init__(self):
self.result = None
def findMax(self, root):
if root == None:
return 0
# find max for left and right node
left = self.findMax(root.left)
right = self.findMax(root.right)
# can either go straight down i.e. from root... | 3.9375 | 4 |
podrum/interface/rak_net_interface.py | NotKonishi/Podrum | 0 | 53632 | ################################################################################
# #
# ____ _ #
# | _ \ ___ __| |_ __ _ _ _ __ ___ ... | 1.460938 | 1 |
snakebite/protobuf/RpcPayloadHeader_pb2.py | cglewis/snakebite | 1 | 53633 | # Generated by the protocol buffer compiler. DO NOT EDIT!
from google.protobuf import descriptor
from google.protobuf import message
from google.protobuf import reflection
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
DESCRIPTOR = descriptor.FileDescriptor(
name='RpcPayloadHeader... | 1.21875 | 1 |
tests/test_user.py | slurps-mad-rips/dirs | 0 | 53634 | from dirs import User
def test_config_home():
assert User.config_home().is_dir()
def test_cache_home():
assert User.cache_home().is_dir()
def test_data_home():
assert User.data_home().is_dir()
def test_data(user: User):
assert user.data == User.data_home()
def test_config(user: User):
asse... | 2.265625 | 2 |
scripts/datasets/somethingsomethingv2.py | Kh4L/gluon-cv | 5,447 | 53635 | <filename>scripts/datasets/somethingsomethingv2.py<gh_stars>1000+
"""This script is for preprocessing something-something-v2 dataset.
The code is largely borrowed from https://github.com/MIT-HAN-LAB/temporal-shift-module
and https://github.com/metalbubble/TRN-pytorch/blob/master/process_dataset.py
"""
import os
import... | 2.546875 | 3 |
package/scripts/utils.py | xiaoxiaopan118/Ambari-Doris-Service | 5 | 53636 | <filename>package/scripts/utils.py
from resource_management import *
from resource_management.core.resources.system import Execute, Directory, File, Link
import os
import socket
import time
def install():
import params
if not is_service_installed(params):
# download doris tar.gz
cmd = format("... | 2.234375 | 2 |
analysis/tools/srcnn_style/faig.py | TencentARC/FAIG | 74 | 53637 | <filename>analysis/tools/srcnn_style/faig.py
import argparse
import cv2
import glob
import numpy as np
import os
import torch
from tqdm import tqdm
from archs.srcnn_style_arch import srcnn_style_net
from basicsr.utils.img_util import img2tensor
def faig(img1, img2, gt_img, baseline_model_path, target_model_path, tot... | 2.375 | 2 |
detect_mcdonald_logo.py | lpopek/McDonald-Logo-detection | 0 | 53638 | <filename>detect_mcdonald_logo.py
#!/usr/bin/python
import sys, getopt
import copy
import matplotlib.pyplot as plt
import cv2 as cv
import modules.data_backend_operations as db
import modules.preprocessing as pr
import modules.segmentation as seg
import modules.classification as cls
def detect_logo(base_img, show_s... | 2.671875 | 3 |
src/armed/alien_invasion.py | pythoncat1024/ArmedSpaceShip | 0 | 53639 | # -*- coding: utf-8 -*-
"""
-------------------------------------------------
File Name: alien_invasion
Description : 武装飞船:游戏入口 !!!
Author : cat
date: 2018/1/22
-------------------------------------------------
Change Activity:
2018/1/22:
---------------------------... | 2.734375 | 3 |
src/snakeoil/test/fixtures.py | Arusekk/snakeoil | 0 | 53640 | """snakeoil-based pytest fixtures"""
import pytest
from . import random_str
class TempDir:
"""Provide temporary directory to every test method."""
@pytest.fixture(autouse=True)
def __setup(self, tmpdir):
self.dir = str(tmpdir)
class RandomPath:
"""Provide random path in a temporary direct... | 2.609375 | 3 |
cvstudio/vo/dataset_vo.py | haruiz/PytorchCvStudio | 32 | 53641 | <reponame>haruiz/PytorchCvStudio
class DatasetVO:
def __init__(self):
self._id = None
self._name = ""
self._folder = ""
self._description = ""
self._data_type = ""
self._size = 0
self._count = 0
@property
def count(self):
return self._count
... | 2.875 | 3 |
kaori/plugins/gacha/commands/display.py | austinpray/kizuna | 3 | 53642 | <filename>kaori/plugins/gacha/commands/display.py
import re
from kaori.adapters.slack import SlackCommand, SlackMessage, SlackAdapter
from kaori.plugins.users import User
from kaori.skills import DB
from ..models.Card import Card
from ..tui import render_card, card_index_blocks
class CardDisplayCommand(SlackCommand)... | 2.109375 | 2 |
models/SimpleClassifier.py | BlissChapman/AgingBrains | 4 | 53643 | <filename>models/SimpleClassifier.py
import torch
from torch import nn
from torch.autograd import Variable, grad
from torch.nn import functional as F
class SimpleClassifier(nn.Module):
def __init__(self, input_dim, num_classes):
super().__init__()
# (W−F+2P)/S+1
step = (input_dim-num_... | 3.140625 | 3 |
applications/brandcolors/management/commands/brandcolors_seed.py | guinslym/python-color-palette | 0 | 53644 | from django.core.management.base import BaseCommand, CommandError
#Fixture package
from mixer.backend.django import mixer
#Test package & Utils
from django.test import TestCase
import pytest
import time, random
#models
from applications.brandcolors.models import Startup
from applications.brandcolors.models import S... | 1.851563 | 2 |
invest_ml/model_funcs.py | convergenceIM/invest-ML | 6 | 53645 | <reponame>convergenceIM/invest-ML<filename>invest_ml/model_funcs.py
'''
Copyright Convergence Investement Management (2018) All rights reserved.
''' | 1.015625 | 1 |
Tkinter/Attributes.py | architnagpal001/Tkinter-Full-Course- | 0 | 53646 | from tkinter import *
root = Tk()
root.geometry("425x255")
root.title("Archit's GUI")
# Important label options
# text - adds the Text
# bd - background
# fg - foreground
# font - sets the font
# padx - x padding
# pady - y padding
# relef - border styling - SUNKEN, RAISED, GROOVE, RIDGE
titl... | 2.84375 | 3 |
Python/ExtrairDadosLista.py | MatosLuciano/CursoPythonListas | 0 | 53647 | valores = []
while True:
valores.append(int(input('Digite um valor: ')))
resp = str(input('Quer continuar? [S/N] '))
if resp in 'Nn':
break
print('-='*30)
print(f'Você digitou {len(valores)} elementos')
valores.sort(reverse=True)
print(f'Os valores em ordem decrescente são {valores} ')
if ... | 3.96875 | 4 |
RollPlayer.py | ThijsMergaert/RollPlayer | 0 | 53648 | <reponame>ThijsMergaert/RollPlayer
import discord
import dicerolls
import os
client = discord.Client()
@client.event
async def on_ready():
print('Logged in as')
print(client.user.name)
print(client.user.id)
print('------')
@client.event
async def on_message(message):
if message.content.startswith... | 2.5625 | 3 |
admin/manage.py | agglrx/Mailu | 0 | 53649 | from mailu import app, manager, db
from mailu.admin import models
@manager.command
def admin(localpart, domain_name, password):
""" Create an admin user
"""
domain = models.Domain.query.get(domain_name)
if not domain:
domain = models.Domain(name=domain_name)
db.session.add(domain)
... | 2.5625 | 3 |
openslides/mediafiles/apps.py | boehlke/OpenSlides | 0 | 53650 | from typing import Any, Dict, Set
from django.apps import AppConfig
class MediafilesAppConfig(AppConfig):
name = "openslides.mediafiles"
verbose_name = "OpenSlides Mediafiles"
angular_site_module = True
def ready(self):
# Import all required stuff.
from openslides.core.signals import... | 2.21875 | 2 |
backend_app/views.py | ilveroluca/backend | 0 | 53651 | import datetime
import os
import uuid
from os.path import join as opjoin
from pathlib import Path
import numpy as np
import requests
import yaml
from celery.result import AsyncResult
from django.db.models import Q
from drf_yasg import openapi
from drf_yasg.utils import swagger_auto_schema
from rest_framework import mi... | 2.03125 | 2 |
development_scripts/reader_testers/test_ixdat_reader_TPMS.py | AlexanderKrabbe/ixdat | 0 | 53652 | <filename>development_scripts/reader_testers/test_ixdat_reader_TPMS.py
from pathlib import Path
from ixdat import Measurement
data_dir = Path("~/Dropbox/ixdat_resources/test_data/cinfdata/Krabbe").expanduser()
tpms = Measurement.read(
data_dir / "baratron_temp_measurement.txt.csv",
reader="ixdat",
techniq... | 2.15625 | 2 |
midterm1.py | kristjanleifur4/forritun-2020 | 0 | 53653 | number_to_multiply = int(input("Input number to multiply: ")) # Do not change this line
how_often = int(input("Input how often to multiply: ")) # Do not change this line
for i in range(number_to_multiply, (how_often * number_to_multiply) + 1, number_to_multiply):
print(i)
#fyrsta ár er 15, annað 9 og öll hin s... | 4 | 4 |
prediction/src/utils/text_preprocessing.py | Tensor-Reloaded/Social-Media-Post-Impact-Prediction | 0 | 53654 | import re
url_removal = re.compile(r'https?://\S*')
rt_user_removal = re.compile(r'(RT )?(@\S+)?')
spaces_removal = re.compile(r'\s+')
def sanitize_text(tweet_text):
tweet_text = rt_user_removal.sub('', tweet_text)
tweet_text = url_removal.sub('', tweet_text)
tweet_text = spaces_removal.sub(' ', tweet_te... | 3.015625 | 3 |
recipes/templatetags/checking_status_filter.py | x038xx77/food_service_project | 0 | 53655 | from recipes.models import Purchases
from django.template.defaulttags import register
from django import template
register = template.Library() # noqa
@register.filter
def check_subscription(author_id, user):
return user.follower.filter(author=author_id).exists()
@register.filter
def check_favorite(recipe_id, ... | 2.078125 | 2 |
cryptography_playground.py | GabrielAlves/CryptographyPlayground | 0 | 53656 | <reponame>GabrielAlves/CryptographyPlayground<gh_stars>0
import tkinter as tk
from tkinter import ttk
from tkinter import scrolledtext
from tkinter import messagebox as msg
from tkinter import Menu
from i18n.i18n_cryptography_playground import I18NCryptographyPlayground
from i18n.i18n_message_box import I18NMessageBox... | 2.609375 | 3 |
chapter 9/sampleCode43.py | DTAIEB/Thoughtful-Data-Science | 15 | 53657 | <filename>chapter 9/sampleCode43.py
[[PredictDelayApp]]
@route(flight_segment="*", airline="*")
@captureOutput
def predict_screen(self, flight_segment, airline):
if flight_segment is None or flight_segment == "":
return "<div>Please select a flight segment</div>"
airport = flight_se... | 3.234375 | 3 |
temba_client/exceptions.py | AfricasVoices/rapidpro-python | 1 | 53658 | class TembaException(Exception):
def __str__(self):
return self.message
class TembaConnectionError(TembaException):
message = "Unable to connect to host"
class TembaBadRequestError(TembaException):
def __init__(self, errors):
self.errors = errors
def __str__(self):
msgs = []... | 2.796875 | 3 |
freedesktop_icons/cache.py | ashb/freedesktop-icons | 1 | 53659 | <gh_stars>1-10
import ctypes
import mmap
import pathlib
import struct
from functools import cache
from typing import Iterator
import attr
@attr.s(auto_attribs=True, hash=False)
class GtkIconCache:
"""
Read GTK ``icon-theme.cache`` files for quicker icon discovery.
Icon theme directories often have 10s o... | 2.546875 | 3 |
src/datasets/main.py | geostk/deepSVDD | 4 | 53660 | from datasets.__local__ import implemented_datasets
from datasets.mnist import MNIST_DataLoader
from datasets.cifar10 import CIFAR_10_DataLoader
from datasets.bedroom import Bedroom_DataLoader
from datasets.toy import ToySeq_DataLoader
from datasets.normal import Normal_DataLoader
from datasets.adult import Adult_DataL... | 2.421875 | 2 |
src/server.py | donnikitos/SimpleCryptoChat | 1 | 53661 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import socket as sckt
import select as slct
import Queue
import defaults
import server_manager
socket = sckt.socket(sckt.AF_INET, sckt.SOCK_STREAM)
socket.setsockopt(sckt.SOL_SOCKET, sckt.SO_REUSEADDR, 1)
socket.bind((sckt.gethostname(), defaults.PORT))
# soc... | 2.609375 | 3 |
bLib/util.py | scottwedge/blib | 0 | 53662 | <filename>bLib/util.py
import os
import ctypes
import traceback
from bLib.helper import *
basename = os.path.basename
dirname = os.path.dirname
abspath = os.path.abspath
exists = os.path.exists
join = os.path.join
isdir = os.path.isdir
isfile = os.path.isfile
def readfile(path):
try:
f = open(path, 'rb')
except:
... | 2.484375 | 2 |
hydrate.py | dlitvakb/horrible_dad_jokes_bot | 3 | 53663 | from scraper import TwitterScraper, ICanHazDadJokeScraper
scrapers = [
TwitterScraper('baddadjokes'),
ICanHazDadJokeScraper()
]
if __name__ == '__main__':
for scraper in scrapers:
scraper.scrape()
| 2.34375 | 2 |
lib/malpem/label_fusion.py | noxtoby/MALPEM | 17 | 53664 | # Author: <NAME>
# Imperial College London
# August, 2015
#
# see license file in project root directory
import os
import intensity_normalise
import malpem.mytools
# Gaussian weighted fusion (SD of kernel)
sigma = 2.5
def lwf(input_file, a_images_scaled, a_labels, output_fusion, output_prob, ... | 2.015625 | 2 |
tests/tag/test_asynctagqueryresultcollection.py | alexweav/nisystemlink-clients-python | 8 | 53665 | <reponame>alexweav/nisystemlink-clients-python
import asyncio
import pytest # type: ignore
from systemlink.clients.core import ApiException
from systemlink.clients.tag import AsyncTagQueryResultCollection, DataType, TagData
class TestAsyncTagQueryResultCollection:
class MockAsyncTagQueryResultCollection(AsyncTa... | 1.984375 | 2 |
phigaro/const.py | bobeobibo/phigaro | 31 | 53666 | <gh_stars>10-100
DEFAULT_WINDOW_SIZE = 32
DEFAULT_THRESHOLD_MIN_BASIC = 45.39
DEFAULT_THRESHOLD_MAX_BASIC = 46.0
DEFAULT_THRESHOLD_MIN_ABS = 50.32
DEFAULT_THRESHOLD_MAX_ABS = 52.96
DEFAULT_THRESHOLD_MIN_WITHOUT_GC = 11.28
DEFAULT_THRESHOLD_MAX_WITHOUT_GC = 11.42
DEFAULT_MEAN_GC = 0.46354823199323626
DEFAULT_MAX_EVALUE ... | 1.09375 | 1 |
database.py | PerchunPak/PingerBot | 2 | 53667 | <filename>database.py
"""
Вся работа с дата базой здесь.
Взято и изменено под свои нужды с https://github.com/dashwav/nano-chan
"""
from datetime import datetime, timedelta
from asyncpg import create_pool
from asyncpg.pool import Pool
from config import POSTGRES
class PostgresController:
"""
Класс... | 2.875 | 3 |
BlackVision/LibBlackVision/Source/stdafx.h.py | black-vision-engine/bv-engine | 1 | 53668 |
import os
result = [os.path.join(dp, f) for dp, dn, filenames in os.walk(".") for f in filenames if os.path.splitext(f)[1] == '.cpp']
for p in result:
with open(p, "r") as f:
data = f.read()
with open( p, "w" ) as f:
f.write( "#include \"stdafx.h\"\n\n" + data );
| 2.65625 | 3 |
colorDetection03.py | mmtaksuu/OpenCV_Python_Tutorial | 2 | 53669 | <gh_stars>1-10
from collections import deque
import numpy as np
import cv2
import imutils
def convertor(blue, green, red):
color = np.uint8([[[blue, green, red]]])
hsv_color = cv2.cvtColor(color, cv2.COLOR_BGR2HSV)
hue = hsv_color[0][0][0]
lower_range = np.array([str(hue-10), 100, ... | 2.640625 | 3 |
src/modules/sys_functions/read_files.py | Nobregaigor/FEBio-Python | 0 | 53670 | <filename>src/modules/sys_functions/read_files.py<gh_stars>0
from bs4 import BeautifulSoup
import json
def read_xml(path_to_file, skip_header=False):
print("Reading file:", path_to_file)
with open(path_to_file,"r") as file:
# Due limitations on bs4 and ISO-8859-1 encoding, skip first line
try:
if skip_header ... | 3.328125 | 3 |
tests/benchmarks/tools/kmt.py | leroyjvargis/workflows | 558 | 53671 | # SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2021 Micron Technology, Inc. All rights reserved.
from typing import List
from tools import config
from tools.base import BaseTest
from tools.helpers import shlex_join
class KmtTest(BaseTest):
def __init__(self, name: str, args: List[str]):
super()... | 2.0625 | 2 |
simulator/player.py | Vedaad-Shakib/TendermintSim | 0 | 53672 | # Copyright (c) 2018 IoTeX
# This is an alpha (internal) release and is not suitable for production. This source code is provided 'as is' and no
# warranties are given as to title or non-infringement, merchantability or fitness for purpose and, to the extent
# permitted by law, all liability for your use of the code is... | 2.265625 | 2 |
src/waldur_auth_saml2/apps.py | geant-multicloud/MCMS-mastermind | 26 | 53673 | <reponame>geant-multicloud/MCMS-mastermind
from django.apps import AppConfig
from django.contrib.auth import get_user_model
class SAML2Config(AppConfig):
name = 'waldur_auth_saml2'
verbose_name = 'Auth SAML2'
def ready(self):
from djangosaml2.signals import pre_user_save
from . import han... | 1.921875 | 2 |
enroll/migrations/0002_auto_20210409_2221.py | RitabrataDas343/Farmtract | 1 | 53674 | <gh_stars>1-10
# Generated by Django 3.1.7 on 2021-04-09 22:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('enroll', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='user',
old_name='regnu... | 1.828125 | 2 |
Tests/Test.py | GamesBond008/NSE-India-Scrapper | 1 | 53675 | <filename>Tests/Test.py
import unittest,sys,datetime
sys.path.insert(0,'..')
from NSE.companies import Companies
from NSE.derivatives import Derivatives
from NSE.equitySMEMarket import EquitySMEMarket
from NSE.indices import Indices
from NSE.preOpenMarket import PreOpenMarket
from NSE import ValidSymbols
Sample_Company... | 2.859375 | 3 |
croissantsapi/database/populate.py | SocgenGoToCloud/CroissantsAPI | 0 | 53676 | <filename>croissantsapi/database/populate.py<gh_stars>0
from croissantsapi.database.connector import ENGINE
from croissantsapi.database.models import Buildings
BUILDINGS = [
Buildings(id="alicante", name="Alicante", max_floors=37),
Buildings(id="chassagne", name="Chassagne", max_floors=36),
Buildings(id="g... | 2.71875 | 3 |
example1/参考/buttonlauncher2.py | SasuraiNoHoge/Kivy_practice | 4 | 53677 | <gh_stars>1-10
# -*- coding: utf-8 -*-
import kivy
kivy.require('1.9.0')
from kivy.app import App
from kivy.config import Config
from kivy.uix.widget import Widget
from kivy.uix.label import Label
from kivy.lang import Builder
Builder.load_file('buttonlauncher2.kv')
class MyWidget(Widget):
def __init__(self ,**... | 2.796875 | 3 |
pynubank/__init__.py | danizord/pynubank | 744 | 53678 | from .exception import NuRequestException, NuException
from .nubank import Nubank
from .utils.mock_http import MockHttpClient
from .utils.http import HttpClient
from .utils.discovery import DISCOVERY_URL
def is_alive(client: HttpClient = None) -> bool:
if client is None:
client = HttpClient()
respons... | 2.15625 | 2 |
my_code.py | Athenian-Computer-Science/RB-author-content-assignment-template | 0 | 53679 | <filename>my_code.py<gh_stars>0
# @desc Add a short description or instruction here. This will show up at the top of the exercise.
def function_name(parameter): # give your function a name and parameter(s)
# have it do stuff
return # what does it return? This will be what the user types when they predic... | 3.6875 | 4 |
vseros/2016-17/okr/genom.py | dluschan/olymp | 0 | 53680 | <reponame>dluschan/olymp
s = input()
g1 = {}
for i in range(1, len(s)):
g1[s[i-1: i+1]] = g1.get(s[i-1: i+1], 0) + 1
s = input()
g2 = set()
for i in range(1, len(s)):
g2.add(s[i-1: i+1])
print(sum([g1[g] for g in frozenset(g1.keys()) & g2]))
| 2.640625 | 3 |
FVC_Train.py | yyren/FVC | 11 | 53681 | import argparse
from FVC_utils import load_from_pickle, save_to_pickle, readData, printx, time, path
from xgboost import XGBClassifier
import warnings
warnings.filterwarnings('ignore')
# from sklearn.preprocessing import StandardScaler
def training_series(X_train, y_train, normalizer=None, xgb_params={}):
printx('... | 2.421875 | 2 |
masonite/helpers/migrations.py | nilsreichert/core | 0 | 53682 | import subprocess
from masonite.helpers import config
def has_unmigrated_migrations():
if not config('application.debug'):
return False
from wsgi import container
from config.database import DB
try:
DB.connection()
except Exception:
return False
migration_directory = ... | 2.171875 | 2 |
anemoi/utils/mixins.py | looselycoupled/anemoi | 0 | 53683 | <reponame>looselycoupled/anemoi
# anemoi.utils.mixins
# Mixin classes for convencience and central configuration
#
# Author: <NAME> <<EMAIL>>
# Created: Sat Aug 05 15:40:46 2017 -0400
#
# Copyright (C) 2017 <NAME>
# For license information, see LICENSE
#
# ID: mixins.py [] <EMAIL> $
"""
Mixin classes for convencien... | 1.71875 | 2 |
catalog/database_setup.py | yasseralaa/Y-Market | 0 | 53684 | from sqlalchemy import Column, ForeignKey, Integer, String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
from sqlalchemy import create_engine
Base = declarative_base()
class User(Base):
__tablename__ = 'user'
id = Column(Integer, primary_key=True)
name =... | 3.125 | 3 |
modules/qmail_asf/files/apmail/bin/compare-mbox-dirs.py | mshuler/infrastructure-puppet | 0 | 53685 | <reponame>mshuler/infrastructure-puppet
#####################################################
# Script for finding diffs between mino and mbox-vm
# Usage:
# LIST DIRS WITH AN MBOX ENTRY THIS MONTH:
# python compare-mbox-dirs.py listdirs > $foo.json
#
# COMPARE TWO LISTDIR JSONS:
# python compare-mbox-dirs.py compar... | 2.515625 | 3 |
csv_to_dict.py | vtsuperdarn/SD_exodus | 0 | 53686 | <gh_stars>0
"""
Written by Muhammad on 09/02/2018
"""
import datetime as dt
import logging
import numpy as np
import pandas as pd
import ast
def csv_to_dict(fname, stime=None, etime=None, sep="|", orient="list"):
"""Reads data from a csv file and returns a dictionary.
Parameter
---------
fname : str... | 3.578125 | 4 |
platform/hwconf_data/zgm13/modules/EMU/EMU_behavior.py | lenloe1/v2.7 | 0 | 53687 | from . import ExporterModel
from . import EMU_model
from . import RuntimeModel
class EMU(ExporterModel.Module):
def __init__(self, name=None):
if not name:
name = self.__class__.__name__
super(EMU, self).__init__(name, visible=True, core=True)
self.model = EMU_model | 2.265625 | 2 |
FacebookEnum/__init__.py | coldfusion39/FacebookEnum | 3 | 53688 | <reponame>coldfusion39/FacebookEnum
from FacebookEnum import FacebookEnum
| 0.90625 | 1 |
handlers/__init__.py | MelomanCool/telegram-stickers | 0 | 53689 | <reponame>MelomanCool/telegram-stickers<filename>handlers/__init__.py
from ._help import help_
from ._conversation import conversation
from ._sticker import sticker_handler as sticker
from ._inline import inlinequery, chosen_inline_result
from ._add_tags import add_tags
from ._delete_tag import delete_tag
from ._delete... | 1.21875 | 1 |
spiderlib/db/run.py | AmerJod/common | 0 | 53690 | <filename>spiderlib/db/run.py
from spiderlib.db.database import Database
# For testing purposes
POSTGRES_CONN = {
"POSTGRES_URL": "localhost:54320",
"POSTGRES_USER": "postgres",
"POSTGRES_PW": "<PASSWORD>",
"POSTGRES_DB": "postgres"
}
if __name__ == '__main__':
db = Database(**POSTGRES_CONN)
... | 2.3125 | 2 |
torstream/peerflix_test.py | PandaWhoCodes/torstream | 3 | 53691 | <filename>torstream/peerflix_test.py
import os
def test_system():
"""Runs few tests to check if npm and peerflix is installed on the system."""
if os.system('npm --version') != 0:
print('NPM not installed installed, please read the Readme file for more information.')
exit()
if os.system('p... | 2.359375 | 2 |
restfulpy/principal.py | Carrene/restfulpy | 25 | 53692 | from itsdangerous import TimedJSONWebSignatureSerializer, \
JSONWebSignatureSerializer
from nanohttp import settings, context, HTTPForbidden
class BaseJWTPrincipal:
def __init__(self, payload):
self.payload = payload
@classmethod
def create_serializer(cls, force=False, max_age=None):
... | 2.15625 | 2 |
StreamPy/ML/LinearRegression/linear_regression.py | AnomalyInc/StreamPy | 2 | 53693 | import numpy as np
import matplotlib.pyplot as plt
import math
TIME_SLEEP = 0.000000001
def train_sgd(X, y, alpha, w=None):
"""Trains a linear regression model using stochastic gradient descent.
Parameters
----------
X : numpy.ndarray
Numpy array of data
y : numpy.ndarray
Numpy a... | 3.71875 | 4 |
apps/organizations/migrations/0002_auto_20191013_0307.py | islandowner-web/IT-MOOC | 9 | 53694 | <reponame>islandowner-web/IT-MOOC<filename>apps/organizations/migrations/0002_auto_20191013_0307.py
# Generated by Django 2.2 on 2019-10-13 03:07
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('organizations', '0001_initial'),
]
operations = [
... | 1.898438 | 2 |
serverless/author/src/publish.py | pagreene/minerva-cloud | 1 | 53695 | import boto3
import json
import math
import logging
import base64
from concurrent.futures import ThreadPoolExecutor
from .storyhtml import create_story_html
from .convert import convert_to_exhibit
import time
class StoryPublisher:
def __init__(
self,
bucket,
get_image_lambda_name,
... | 2.21875 | 2 |
AI-Algorithm/changeToC.py | LinRS1999/soft-work | 0 | 53696 | from setuptools import setup
from Cython.Build import cythonize
setup(ext_modules=cythonize('bfsHash.pyx')) | 1.09375 | 1 |
tests/test_send_email.py | fpatseas/in-stock-notifier | 1 | 53697 | import os
import sys
sys.path.append("../instock_notifier")
import config
from mailjet_rest import Client
mailjet = Client(auth=(config.SMTP_API_KEY, config.SMTP_API_SECRET), version="v3.1")
data = {
"Messages": [
{
"From": config.EMAIL_SENDER,
"To": config.EMAIL_RECI... | 1.992188 | 2 |
tests/test_sagemaker/test_sagemaker_models.py | andormarkus/moto | 0 | 53698 | <filename>tests/test_sagemaker/test_sagemaker_models.py
import boto3
from botocore.exceptions import ClientError
import pytest
from moto import mock_sagemaker
import sure # noqa # pylint: disable=unused-import
from moto.sagemaker.models import VpcConfig
TEST_REGION_NAME = "us-east-1"
TEST_ARN = "arn:aws:sagemaker:e... | 2.078125 | 2 |
ozpcenter/api/listing/views.py | emosher/ozp-backend | 1 | 53699 | """
Listing Views
"""
import logging
import operator
from django.shortcuts import get_object_or_404
from django.db.models import Min
from django.db.models.functions import Lower
from rest_framework import filters
from rest_framework import status
from rest_framework import viewsets
from rest_framework.response import ... | 2.03125 | 2 |