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 |
|---|---|---|---|---|---|---|
scrappers/plugins/cbsnews/__init__.py | nathanIL/openews | 2 | 12766651 | import scrappers
import re
import scrappers.mixins
class CBSNews(scrappers.mixins.RSSScrapper, scrappers.Scrapper):
"""The CBS News RSS feeds scrapper.
"""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def should_translate(self):
return False
def encodin... | 2.890625 | 3 |
examples/network/processingClient.py | dhaase-de/dh-python-dh | 0 | 12766652 | #!/usr/bin/python3
import time
import dh.data
import dh.image
import dh.network
import dh.utils
###
#%% main
###
def main():
C = dh.network.ImageProcessingClient2("localhost")
# input
I = dh.data.lena()
params = {"gamma": 0.5}
print("Input:")
dh.image.pinfo(I)
# result
t0 = time.... | 2.453125 | 2 |
examples/inspector.py | yaoanderson/loadimpact-sdk-python | 1 | 12766653 | #!/usr/bin/env python
# coding=utf-8
"""
Copyright 2013 Load Impact
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 la... | 1.90625 | 2 |
basicmonitor/triggers/__init__.py | TorbenFricke/basicmonitor | 0 | 12766654 | <reponame>TorbenFricke/basicmonitor<filename>basicmonitor/triggers/__init__.py
from basicmonitor.triggers.manager import TriggerManager
from basicmonitor.triggers.trigger import Trigger | 1.171875 | 1 |
code/ppe/experiment/code/report.py | alexandergg/MLOps-YoloV3-Azure | 6 | 12766655 | <gh_stars>1-10
import glob
import json
import os
import shutil
import operator
import sys
import argparse
import cv2
import matplotlib.pyplot as plt
from scripts.compress import zipFolder, unzipFolder
from azureml.core import Model, Run, Datastore
class mAP():
def __init__(self):
self._parser = argpa... | 2.140625 | 2 |
biencoder/useb/useb/setup.py | dumpmemory/sgpt | 91 | 12766656 | <gh_stars>10-100
from setuptools import setup, find_packages
with open("README.md", "r", encoding="utf-8") as fh:
readme = fh.read()
setup(
name="useb",
version="0.0.1",
author="<NAME>",
author_email="<EMAIL>",
description="Heterogenous, Task- and Domain-Specific Benchmark for Unsupervised Se... | 1.34375 | 1 |
lcc_web/web/interface/lcc_views/jobs.py | mavrix93/LightCurvesClassifier | 12 | 12766657 | import glob
import json
import os
from wsgiref.util import FileWrapper
import shutil
import pandas as pd
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.http.response import HttpResponse
from django.shortcuts import render
from interface.models import DbQuery
fro... | 2.125 | 2 |
configs/__init__.py | kaylode/KAI | 4 | 12766658 | <gh_stars>1-10
from .configs import Config
def get_config(name):
if name == 'KAI':
return Config('./configs/kai.yaml') | 1.742188 | 2 |
backend/home/management/commands/generate_project_report.py | crowdbotics-apps/test-31818 | 2 | 12766659 | <reponame>crowdbotics-apps/test-31818
import json
import subprocess
import django
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = "Generate a json with all Models and URLs of the project."
def handle(self, *args, **options):
models = django.apps.apps.get_models... | 2.359375 | 2 |
backend/dataset/validate/validations/audio_metadata_check.py | agupta54/ulca | 3 | 12766660 | from models.abstract_handler import BaseValidator
from configs.configs import dataset_type_asr, dataset_type_asr_unlabeled, dataset_type_tts, asr_minimum_words_per_min
import logging
from logging.config import dictConfig
log = logging.getLogger('file')
import audio_metadata
from word2number import w2n
from datetime imp... | 2.40625 | 2 |
BitTornado/Storage/FileSelector.py | crossbrowsertesting/BitTornado | 1 | 12766661 | <filename>BitTornado/Storage/FileSelector.py<gh_stars>1-10
import random
class FileSelector:
def __init__(self, files, piece_length, bufferdir,
storage, storagewrapper, sched, failfunc):
self.files = files
self.storage = storage
self.storagewrapper = storagewrapper
... | 2.609375 | 3 |
app.py | spencerpomme/notebook | 0 | 12766662 | import os
import sys
import click
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask import redirect, url_for, abort, render_template, flash
from flask_wtf import FlaskForm
from wtforms import SubmitField, TextAreaField
from wtforms.validators import DataRequired
# SQLite URI compatible
WIN = ... | 2.4375 | 2 |
explosig_data/utils.py | lrgr/explosig-data | 1 | 12766663 | import pandas as pd
import logging
import os
import snakemake as snakemake_api
import tempfile
import yaml
from .constants import *
from .i_o import get_logger, get_df_drop_message
# Helper functions
def convert_with_map(row, index, convert_map):
try:
return convert_map[row[index]]
except KeyError:
retu... | 2.578125 | 3 |
lintcode/NineChapters/05/longest-common-subsequence.py | shootsoft/practice | 0 | 12766664 | <reponame>shootsoft/practice
__author__ = 'yinjun'
#@see http://www.jiuzhang.com/solutions/longest-common-subsequence/
class Solution:
"""
@param A, B: Two strings.
@return: The length of longest common subsequence of A and B.
"""
def longestCommonSubsequence(self, A, B):
# write your code ... | 3.3125 | 3 |
src/segmentation code/Tester.py | Zoopare/Optic-Disk-Cup-Segmentation | 38 | 12766665 | <filename>src/segmentation code/Tester.py
import torch
from torch.nn import functional as F
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
from torchvision import transforms
from PIL import Image
import os
import cv2
import numpy as np
from model import FCDenseNet57
root_path = '/media/brats... | 2.09375 | 2 |
abbrev-amsrefs.py | vanabel/ams-abbrevs | 0 | 12766666 | #!/bin/python3
# -*- coding: utf-8 -*-
import pandas
data = pandas.read_csv('./annser.csv',
header=0,
na_values=[''],
usecols=[0, 1, 3, 4])
abbrevs = ""
for index, rows in data.iterrows():
abbrev = "".join(
[s[:1] for s in (str(rows[1])).... | 2.90625 | 3 |
utility/plot.py | xlnwel/grl | 5 | 12766667 | <gh_stars>1-10
import os, sys, glob
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
def plot_data(data, x, y, outdir, tag, title, timing=None):
if isinstance(data, list):
data = pd.concat(data, igno... | 2.3125 | 2 |
utilities/pyPlotting/writeFiltFields.py | mightylorenzo/Puffin | 15 | 12766668 | # Copyright (c) 2012-2018, University of Strathclyde
# Authors: <NAME>
# License: BSD-3-Clause
"""
This is an examplar script to produce a plot of the filtered energy.
"""
import sys, glob, os
import numpy as np
import tables
from numpy import arange
from retrieve import readField
from retrieve import filterField
fro... | 2.171875 | 2 |
fig/python_cmd/prime_count.py | gavinln/mesos-marathon | 2 | 12766669 | <reponame>gavinln/mesos-marathon
import math
print "Primes up to a million"
pp = 2
ps = [pp]
pp += 1
ps.append(pp)
lim = 1000000
while pp < int(lim):
pp += 2
test = True
sqrtpp = math.sqrt(pp)
for a in ps:
if a > sqrtpp: break
if pp % a == 0:
test = False
break
if test:
ps.append(pp)
print len(ps)
| 3.421875 | 3 |
alipay/aop/api/domain/AlipayFincoreComplianceCrossborderMerchantBatchqueryModel.py | antopen/alipay-sdk-python-all | 213 | 12766670 | <reponame>antopen/alipay-sdk-python-all
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.BaseCrossborderMerchantInfo import BaseCrossborderMerchantInfo
class AlipayFincoreComplianceCrossborderMerchantBatchqueryModel(object):
... | 1.835938 | 2 |
sweep_power.py | intermod-pro/presto-measure | 0 | 12766671 | # -*- coding: utf-8 -*-
"""
2D sweep of drive power and frequency in Lockin mode.
"""
from typing import List
import h5py
import numpy as np
from presto.hardware import AdcFSample, AdcMode, DacFSample, DacMode
from presto import lockin
from presto.utils import ProgressBar
from _base import Base
DAC_CURRENT = 32_000... | 2.25 | 2 |
mlangokumi_app/models.py | John-Osiko/Mlango10 | 0 | 12766672 | <reponame>John-Osiko/Mlango10
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib.auth.models import User
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
#from django.core.files.storage import FileSystemStorage
#fs = Fil... | 2.15625 | 2 |
datasets/smart_buildings_dataset.py | pganssle-google/madi | 0 | 12766673 | # Lint as: python3
# Copyright 2020 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 ... | 2.1875 | 2 |
ips/coordinator/urls.py | marklit/mass-ipv4-whois | 20 | 12766674 | <reponame>marklit/mass-ipv4-whois<gh_stars>10-100
from django.conf.urls import url
from coordinator.views import get_ips
urlpatterns = [
url(r'^$', get_ips, name='get_ips'),
]
| 1.53125 | 2 |
PARTE_3/EX019/index.py | 0Fernando0/CursoPython | 0 | 12766675 | from datetime import date, datetime
dados = dict()
dados['nome'] = str(input('Nome: '))
nasc = int(input('ANO DE NASCIMENTO: '))
dados['idade'] = datetime.now().year - nasc
dados['ctps'] = int(input('carteira de trabalho (0 não tem): '))
if dados['ctps'] != 0:
dados['contratação'] = int(input('ano de contratação: '... | 3.625 | 4 |
asteroids/utils.py | lxndrdagreat/game-dev-with-python | 2 | 12766676 | <reponame>lxndrdagreat/game-dev-with-python
from enum import Enum
import math
from typing import Tuple
import arcade
class ThemeColors(Enum):
FOREGROUND = (arcade.color.AFRICAN_VIOLET, )
BACKGROUND = (arcade.color.AERO_BLUE, )
def __init__(self, color):
self.color = color
def rotate_point(x: in... | 3.296875 | 3 |
eeve/importer.py | vMarcelino/eeve | 1 | 12766677 | <filename>eeve/importer.py
import os
import sys
import importlib
import travel_backpack.exceptions
def import_from_folder(folder):
imported_files = []
folder = os.path.abspath(folder)
if folder not in sys.path:
sys.path.insert(0, folder)
for file_obj in os.listdir(folder):
try:
... | 2.71875 | 3 |
glue/plugins/tools/spectrum_tool/qt/tests/test_profile_viewer.py | ejeschke/glue | 3 | 12766678 | <reponame>ejeschke/glue
from __future__ import absolute_import, division, print_function
from collections import namedtuple
import pytest
import numpy as np
from mock import MagicMock
from ..profile_viewer import ProfileViewer
from glue.utils import renderless_figure
FIG = renderless_figure()
Event = namedtuple('E... | 1.953125 | 2 |
src/model/ImageDataset.py | Lucianod28/topo-csc | 0 | 12766679 | import torch
from torch.utils.data import Dataset
import numpy as np
from scipy.io import loadmat
class NatPatchDataset(Dataset):
def __init__(self, N:int, width:int, height:int, border:int=4, fpath:str='../../data/IMAGES.mat', test=False):
super(NatPatchDataset, self).__init__()
self.N = N
... | 2.40625 | 2 |
RC3D/operator_py/proposal_target_twin.py | likelyzhao/MxNet-RC3D | 1 | 12766680 | <reponame>likelyzhao/MxNet-RC3D<filename>RC3D/operator_py/proposal_target_twin.py
# --------------------------------------------------------
# Deformable Convolutional Networks
# Copyright (c) 2016 by Contributors
# Copyright (c) 2017 Microsoft
# Licensed under The Apache-2.0 License [see LICENSE for details]
# Modifie... | 1.859375 | 2 |
src/haddock2mmcif/modules/docking.py | haddocking/haddock2mmcif | 0 | 12766681 | import ihm.model
import logging
dockinglog = logging.getLogger("log")
class DockingModel(ihm.model.Model):
"""Subclass to save memory."""
# ======================================================================
# IMPORTANT #
# To add the atoms, the class module needs a list containing the following:... | 2.578125 | 3 |
modules/centroid/centroid_define.py | RealAllenDa/EEWMap | 0 | 12766682 | <filename>modules/centroid/centroid_define.py
"""
EEWMap - Modules - Centroid - Centroid_Define
The main entry point of this module.
"""
import csv
import json
import time
import traceback
import requests
from config import PROXY
from modules.utilities import response_verify, relpath
class Centroid:
"""A cent... | 2.734375 | 3 |
norns/enemy/admin.py | the-norns/norns | 0 | 12766683 | <gh_stars>0
from django.contrib import admin
from .models import Enemy, EnemyType
admin.site.register(Enemy)
admin.site.register(EnemyType)
| 1.289063 | 1 |
mainapp/management/commands/test-email.py | cyroxx/meine-stadt-transparent | 34 | 12766684 | from django.core.management.base import BaseCommand
from mainapp.functions.mail import send_mail
from mainapp.models import UserProfile
class Command(BaseCommand):
help = "Sends a test e-mail to check if the mail-system is configured correctly"
def add_arguments(self, parser):
parser.add_argument("t... | 2.28125 | 2 |
src/globus_sdk/services/gcs/response.py | rudyardrichter/globus-sdk-python | 47 | 12766685 | <reponame>rudyardrichter/globus-sdk-python
import re
from typing import Any, Callable, Dict, Optional, Union
from globus_sdk.response import GlobusHTTPResponse, IterableResponse
class IterableGCSResponse(IterableResponse):
"""
Response class for non-paged list oriented resources. Allows top level
fields ... | 2.703125 | 3 |
kerasncp/utils.py | lihui-colin/keras-ncp | 0 | 12766686 | # Copyright 2020 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... | 2.875 | 3 |
src/datasets/base_dataset.py | tchaton/sagemaker-pytorch-boilerplate | 7 | 12766687 | <reponame>tchaton/sagemaker-pytorch-boilerplate<filename>src/datasets/base_dataset.py
import os
import numpy as np
import pandas as pd
import torch
from pytorch_lightning import LightningDataModule
from torch.utils.data import DataLoader, random_split
from src.paths import Paths
class BaseSagemakerDataset(LightningDa... | 2.625 | 3 |
src/simple1D.py | Mm24/BiomarkersVoiceClasifierApp | 0 | 12766688 | <gh_stars>0
from keras.models import Sequential
from keras.layers import Dense, Flatten, Convolution1D, Dropout
from tensorflow.keras.optimizers import SGD
from tensorflow.keras.initializers import random_uniform
#hyperparameters
input_dimension = 88200
learning_rate = 0.0025
momentum = 0.85
SEED = 24
linear_init = ... | 2.484375 | 2 |
experiments/preprocessing.py | CCWI/corpus-gtcs6k | 0 | 12766689 | import string
from nltk.tokenize.casual import TweetTokenizer
def tokenize(text):
tweet_tokenizer = TweetTokenizer()
# 1. Tokenize
text = tweet_tokenizer.tokenize(text)
# 2. Cleaning
# Punctuation
text = [t for t in text if t not in string.punctuation]
# Normalisieren
text = [t.lower() ... | 3.65625 | 4 |
clippy_runner.py | M0n0xy2/ELang | 1 | 12766690 | import subprocess
proc = subprocess.Popen(["cargo", "clippy"], stderr=subprocess.PIPE)
output = proc.stderr.read().decode("utf-8")
groups = [group for group in output.split("\n\n") if "parser.rs" not in group]
print("\n-----------------\n".join(groups[:20]))
| 2.625 | 3 |
src/playlist/forms.py | KushalVijay/Youtube-Video-Downloader | 4 | 12766691 | from django import forms
from .models import videolink
class getlink(forms.ModelForm):
class Meta:
model = videolink
fields = '__all__'
def clean(self):
data = self.cleaned_data
return data
class downlink(forms.ModelForm):
class Meta:
model = vide... | 2.109375 | 2 |
src/tariochbctools/importers/truelayer/importer.py | markferry/beancounttools | 0 | 12766692 | import logging
from datetime import timedelta
from os import path
import dateutil.parser
import requests
import yaml
from beancount.core import amount, data
from beancount.core.number import D
from beancount.ingest import importer
class Importer(importer.ImporterProtocol):
"""An importer for Truelayer API (e.g. ... | 2.265625 | 2 |
tests/test_callbacks.py | Ow-woo/stable-baselines | 3 | 12766693 | <gh_stars>1-10
import os
import shutil
import pytest
from stable_baselines import A2C, ACKTR, ACER, DQN, DDPG, PPO1, PPO2, SAC, TD3, TRPO
from stable_baselines.common.callbacks import (CallbackList, CheckpointCallback, EvalCallback,
EveryNTimesteps, StopTrainingOnRewardThreshold, BaseCallback)
LOG_FOLDER = './l... | 2.1875 | 2 |
src/opserver/plugins/alarm_disk_usage/main.py | biswajit-mandal/contrail-controller | 3 | 12766694 | <reponame>biswajit-mandal/contrail-controller<filename>src/opserver/plugins/alarm_disk_usage/main.py<gh_stars>1-10
from opserver.plugins.alarm_base import *
from opserver.sandesh.alarmgen_ctrl.sandesh_alarm_base.ttypes import *
import json
class DiskUsage(AlarmBase):
"""Disk Usage crosses a threshold.
NodeM... | 2.421875 | 2 |
src/racelogger/processing/singlecarproc.py | mpapenbr/python-racelogger | 0 | 12766695 | import logging
import sys
from enum import Enum
from racelogger.util.utils import gate
CAR_SLOW_SPEED = 25
""" a car is considered to be slow if its speed is below this value"""
CarsManifest = ['state','carIdx','carNum','userName','teamName','car','carClass','pos','pic','lap','lc','gap','interval','trackPos','speed'... | 3.03125 | 3 |
comments/encoder.py | onerbs/treux | 0 | 12766696 | from base64 import b64encode as _e, b64decode as _d
def encode(text: str, timestamp: float) -> str:
"""Encode comment into base64 string.
:param text: The text of the comment.
:param timestamp: The timestamp of the comment.
:return: The base64-encoded comment.
"""
return '%s:%s' % (_encode(text), _encode(time... | 3.25 | 3 |
plato/datasources/femnist.py | cuiboyuan/plato | 135 | 12766697 | <reponame>cuiboyuan/plato
"""
The Federated EMNIST dataset.
The Federated EMNIST dataset originates from the EMNIST dataset, which contains
817851 images, each of which is a 28x28 greyscale image in 1 out of 62 classes.
The difference between the Federated EMNIST dataset and its original counterpart
is that this datas... | 2.78125 | 3 |
setup.py | JonathanPetit/Parser-Renamer-torrentfile | 7 | 12766698 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
import pypandoc
import os
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
with open('requirements.txt') as requirements:
install_requires = requirements.read().splitlines()
try:
long_descri... | 2 | 2 |
past_files_poster.py | birkin/annex_receipts | 0 | 12766699 | # -*- coding: utf-8 -*-
import argparse, datetime, glob, json, logging, os, pprint, random, time
from functools import partial
from operator import itemgetter
from typing import Iterator, List, Optional
import asks, trio
logging.basicConfig(
# filename=settings.LOG_PATH,
level=logging.DEBUG,
format='[%(... | 2.25 | 2 |
mods/libvis_mods/project-templates/test.py | danlkv/pywebviz | 0 | 12766700 | from cookiecutter.main import cookiecutter
def main():
cookiecutter('source-files')#, no_input=True)
if __name__ == '__main__':
main()
| 1.1875 | 1 |
serv/api/errors.py | jnhu76/ImageServ | 0 | 12766701 | from typing import Union
from fastapi import HTTPException
from fastapi.exceptions import RequestValidationError
from fastapi.openapi.constants import REF_PREFIX
from fastapi.openapi.utils import validation_error_response_definition
from pydantic import ValidationError
from starlette.requests import Request
fr... | 2.140625 | 2 |
src/tools/train_tracknet.py | sanket-pixel/self-tracker | 0 | 12766702 | <reponame>sanket-pixel/self-tracker
"""
This file contains the training logic for
tracknet.
"""
# import statements
import torch
from loguru import logger
import numpy as np
import configparser
from tqdm import tqdm
import time
import os
import sys
from pathlib import Path
path_root = Path(__file__).parents[2]
sys.path... | 1.96875 | 2 |
grive/tree.py | hoangnv-bkhn/grive | 0 | 12766703 | <gh_stars>0
class Node:
def __init__(self, key):
self.key = key
self.child = []
def newNode(key):
temp = Node(key)
return temp
def LevelOrderTraversal(root):
if (root == None):
return;
# Standard level order traversal code
# using queue
q = [] # Create a queue
... | 3.734375 | 4 |
nonebot/adapters/telegram/config.py | ColdThunder11/nonebot-adapter-telegram | 8 | 12766704 | from nonebot import adapters
from typing import Optional
from pydantic import Field, BaseModel
class Config(BaseModel):
"""
telegram配置类
:配置项:
- ``webhook_host`` / ``telegram_webhook_host``: webhook的host
- ``bot_token`` / ``telegram_bot_token``: bot_token
- ``telegram_command_only`` / ... | 2.421875 | 2 |
tests/nearestPointInterpolation.py | MarkTravers/magLabUtilities | 0 | 12766705 | <filename>tests/nearestPointInterpolation.py<gh_stars>0
#!python3
import numpy as np
from magLabUtilities.signalutilities.signals import SignalThread, Signal
from magLabUtilities.signalutilities.canonical1d import Parabola
if __name__=='__main__':
parabolaGen = Parabola(tMaxDx=4.0, tVertex=0.0, xMaxDx=16.0... | 2.3125 | 2 |
core/communication.py | discord-intech/VocalDaemon | 0 | 12766706 | import json
from core.utils.cleanOrder import cleanString
yesWords = ["oui", "d'accord", "d accord", "ok", "ça marche", "pourquoi pas", "bien sur"]
noWords = ["non", "pas du tout", "hors de question", "pas question", "impossible", "je refuse"]
def sendAnswer(answer, client):
msg = { "type": "answer", "msg": answe... | 2.78125 | 3 |
cogs/misc.py | imri0t/ri0t-bot | 2 | 12766707 | <reponame>imri0t/ri0t-bot<gh_stars>1-10
'''cog: miscellaneous commands'''
import os
import asyncio
import random
import discord
from discord.ext import commands
class Misc(): # pylint: disable=too-few-public-methods
def __init__(self, bot):
self.bot = bot
@commands.command(pass_context=Tr... | 2.59375 | 3 |
src/woolgatherer/db_models/feedback.py | dojoteef/storium-frontend | 3 | 12766708 | """
Feedback database model
"""
from uuid import UUID
# pylint incorrectly complains about unused import for UniqueConstraint... not sure why
from sqlalchemy.schema import ( # pylint:disable=unused-import
ForeignKey,
UniqueConstraint,
)
from pydantic import Field
from woolgatherer.db_models.base import DBBas... | 2.0625 | 2 |
mangrove/form_model/field.py | mariot/mangrove | 0 | 12766709 | <gh_stars>0
from collections import OrderedDict
import re
from HTMLParser import HTMLParser
import abc
from datetime import datetime
from babel.dates import format_date
from coverage.html import escape
from mangrove.data_cleaner import TelephoneNumber
from mangrove.datastore.entity import get_all_entities
from mangro... | 2.15625 | 2 |
GeneticAlgorithmSolver.py | THuzeyfe/GA_TSP | 0 | 12766710 | from RouteManager import RouteManager
from Route import Route
import numpy as np
class GeneticAlgorithmSolver:
def __init__(self, cities, population_size=50, mutation_rate=0.05, tournament_size=5, elitism=True):
self.cities = cities
self.population_size = population_size
self.mutation_rat... | 3.1875 | 3 |
mmtbx/kinemage/__init__.py | dperl-sol/cctbx_project | 155 | 12766711 | <filename>mmtbx/kinemage/__init__.py
from __future__ import absolute_import, division, print_function
def kin_vec(start_key, start_xyz, end_key, end_xyz, width=None):
start_altloc = start_key[0:1]
if start_altloc == ' ':
start_altloc_txt = ""
else:
start_altloc_txt = " '%s'" % start_altloc.lower()
end_... | 2.078125 | 2 |
leetcode/python/636_exclusive_time_of_functions.py | VVKot/leetcode-solutions | 4 | 12766712 | <gh_stars>1-10
"""
T: O(N)
S: O(N)
We use stack to record last executed operation. If we have seen an operation Y
execute in the middle of operation X, this means X will continue at Y's end+1.
"""
from typing import List
class Solution:
def exclusiveTime(self, n: int, logs: List[str]) -> List[int]:
tas... | 3.34375 | 3 |
ymir/backend/src/ymir_viz/tests/controllers/conftest.py | Zhang-SJ930104/ymir | 64 | 12766713 | import json
import pytest
from flask import Response
from flask.testing import FlaskClient
class APIResponse(Response):
def json(self):
return json.loads(self.data)
@pytest.fixture()
def test_client(core_app):
core_app.test_client_class = FlaskClient
core_app.response_class = APIResponse
re... | 2.328125 | 2 |
cli/gameplay.py | gaebor/CnC_AI | 0 | 12766714 | <gh_stars>0
import ctypes
from PIL import Image
import cnc_structs
import decoders
import input_requests
class TDGameplay:
def __init__(self, dll_path, content_directory):
self.players = []
self.actions = {}
self.content_directory = content_directory
self.dll = ctypes.WinDLL(dll_... | 2.15625 | 2 |
okta_uuid.py | tmehlinger/okta-uuid | 0 | 12766715 | """
--- okta-user-id --
This is a simple module for turning (apparently) base62-encoded Okta user IDs
into UUIDs. It also allows for reversing the UUID to an Okta user ID.
"""
__title__ = 'okta-uuid'
__author__ = '<NAME>'
__email__ = '<EMAIL>'
__version__ = '0.1.0'
import uuid
import base62
class OktaUserId(obje... | 2.84375 | 3 |
lesson06/lesson06_hard_1.py | Liar-Ziro/Python.Basics_of_language | 0 | 12766716 | '''Задача - 1
Вам необходимо создать завод по производству мягких игрушек для детей. Вам надо
продумать структуру классов, чтобы у вас был класс, который создаёт игрушки на
основании: Названия, Цвета, Типа (животное, персонаж мультфильма) Опишите
процедуры создания игрушки в трёх методах: -- Закупка сырья, пошив, окрас... | 3.953125 | 4 |
seeqler/ui/schema.py | ceilors/seeqler | 0 | 12766717 | import dearpygui.dearpygui as dpg
from .window import Window
from . import ConnectionListWindow
class SchemaWindow(Window):
def __init__(self, app, **kwargs):
# fmt: off
super().__init__(
app, 'Текущее подключение', 'main_window', (800, 500),
tag_schema_selector='schema se... | 2.28125 | 2 |
corpus_generation_scripts/create_parliament.py | NbAiLab/notram | 7 | 12766718 | #!/usr/bin/env python3
####################################################################################
# Script is not in use, since this is no longer in the main corpus
# Cleaning up parliament speech files
# Output is an UTF-8 file with one article per line
######################################################... | 3.78125 | 4 |
desec.py | desec-utils/debug | 0 | 12766719 | <reponame>desec-utils/debug
from socket import getaddrinfo
def _resolve(name):
try:
return getaddrinfo(name, 53)[0][4][0]
except OSError:
print(f'Unknown server: {name}')
quit(1)
frontend_servers = {
_resolve(s): s for s in
[
'lhr-1.b.desec.io',
'vie-1.b.desec... | 2.5 | 2 |
bestbid/bidding/routing.py | wh0th3h3llam1/bestbid | 1 | 12766720 | <gh_stars>1-10
from django.urls import path
from django.conf.urls import url, re_path
from . import consumers
websocket_urlpatterns = [
# path(r'asset/<int:id>/', consumers.LiveAuctioningConsumer),
url(r'^asset/(?P<id>[0-9]+)/$', consumers.LiveAuctioningConsumer),
] | 1.625 | 2 |
my_ip/migrations/0005_rename_image_project_project_image.py | OscarMugendi/Django-week3-IP | 0 | 12766721 | # Generated by Django 3.2.7 on 2021-09-20 13:31
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('my_ip', '0004_alter_rating_table'),
]
operations = [
migrations.RenameField(
model_name='project',
old_name='image',
... | 1.601563 | 2 |
aoc2019/solutions/day04.py | mdalzell/advent-of-code-2019 | 0 | 12766722 | from aoc2019.helpers.day04 import countValidPasswordsInRange, consecutiveDigitsRegex, exactlyTwoConsecutiveDigitsRegex
from aoc2019.shared.solution import Solution
class Day4(Solution):
def part1(self):
return countValidPasswordsInRange(
152085, 670283, consecutiveDigitsRegex)
def part2(s... | 1.984375 | 2 |
tests/tests_preprocessing/test_datetime_transformer.py | stjordanis/mljar-supervised | 1,882 | 12766723 | <filename>tests/tests_preprocessing/test_datetime_transformer.py
import unittest
import tempfile
import json
import numpy as np
import pandas as pd
from supervised.preprocessing.datetime_transformer import DateTimeTransformer
class DateTimeTransformerTest(unittest.TestCase):
def test_transformer(self):
... | 3.078125 | 3 |
storage/app/public/calculator_Iot_tx.py | kevinkuogod/ethereum_BIS_web | 0 | 12766724 | <filename>storage/app/public/calculator_Iot_tx.py
import numpy as np
import matplotlib.pyplot as plt
# T=100
# n=1
# # n=5
# # n=10
# Tx = []
# plt.figure(figsize=(10, 4), dpi=500) # 图片长宽和清晰度
# for i in range(int(T/n)):
# Tx.append(i)
# ldr_gas_total = []
# ldr_field=1
# camera_gas_total = []
# camera_field=2
# ... | 2.671875 | 3 |
imagecaptioniser.py | Vijayvj1/FacebookHateMEMS | 0 | 12766725 | # Load libraries
import matplotlib.pyplot as plt
import pandas as pd
import pickle
import numpy as np
import os
from keras.applications.resnet50 import ResNet50
from keras.optimizers import Adam
from keras.layers import Dense, Flatten,Input, Convolution2D, Dropout, LSTM, TimeDistributed, Embedding, Bidirectiona... | 2.453125 | 2 |
config.py | XxuChen/Adversarial-Attack-on-CapsNets | 0 | 12766726 | <filename>config.py
# Copyright 2018 <NAME> 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 appl... | 1.960938 | 2 |
Validation/Geometry/test/MaterialBudget.py | PKUfudawei/cmssw | 2 | 12766727 | <filename>Validation/Geometry/test/MaterialBudget.py
#! /usr/bin/env python3
# Pure trick to start ROOT in batch mode, pass this only option to it
# and the rest of the command line options to this code.
from __future__ import print_function
import sys
oldargv = sys.argv[:]
sys.argv = [ '-b-' ]
from ROOT import TCanva... | 2.203125 | 2 |
bolt_server/message_dispatcher/message_dispatcher.py | project-bolt/bolt-server | 1 | 12766728 | '''
File: message_dispatcher.py
Description: Message dispatch handler
Date: 29/09/2017
Author: <NAME> <<EMAIL>>
'''
from structures import Message, MessagePacket, MessageQueue
class MessageDispatcher(object):
"""Handle the dispatch of the message from the bolt server
Registers new messages for the dispatch ha... | 2.78125 | 3 |
app/push.py | erts/APNSClient | 0 | 12766729 | # push.py
#
# simple script for sending a test push notification message to device over APNs
# https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CreatingtheNotificationPayload.html#//apple_ref/doc/uid/TP40008194-CH10-SW1
import apns2
DEVICE_TOKEN = ""
... | 3.40625 | 3 |
analysis/2021-01-21-guilhermelowa-search-engine.py | AndreAngelucci/analises | 31 | 12766730 | #!/usr/bin/env python
# coding: utf-8
# # Buscador
#
# Esse notebook implementa um buscador simples.
# A representação pra cada texto é criada a partir da TF-IDF.
# A representação da query (consulta, ou termos buscados)
# é construída a partir do vocabulário dos textos.
# O ranqueamento dos resultados é feito de acor... | 2.765625 | 3 |
supersqlite/idxchk.py | plasticity-admin/supersqlite | 687 | 12766731 | #!/usr/bin/python
'''idxchk.py - pretty print indexes used in a query
Ported to Python by <NAME> (<EMAIL>).
Requires pysqlite2, sqlite3 (comes with Python 2.5+) or apsw.
Version 1.01 2008-03-07 Fix to list index method name thanks to <NAME>.
Added sqlite3 support.
Version 1.0 2006-07-18 In... | 2.515625 | 3 |
microdrop/plugin_manager.py | cfobel/microdrop | 17 | 12766732 | <gh_stars>10-100
from StringIO import StringIO
from collections import namedtuple
from contextlib import closing
import logging
import pprint
import sys
import traceback
from pyutilib.component.core import ExtensionPoint, PluginGlobals
# TODO Update plugins to import from `pyutilib.component.core` directly
# instead o... | 1.8125 | 2 |
tests/estimator/classifier/Classifier.py | mathewdgardner/sklearn-porter | 1 | 12766733 | # -*- coding: utf-8 -*-
import os
import numpy as np
import subprocess as subp
from sklearn.datasets import load_iris
from sklearn.datasets import load_breast_cancer
from sklearn.datasets import load_digits
from sklearn.utils import shuffle
from tests.utils.Timer import Timer
from tests.estimator.classifier.Separate... | 2.484375 | 2 |
code/2_process_hearings/2_4_group_speeches.py | ianpcook/info_transmission | 0 | 12766734 | <reponame>ianpcook/info_transmission
import collections
import csv
import os
import re
def read_data(src='./data/hearing_metadata_2.csv'):
reader = csv.DictReader(file(src, 'rU'))
for row in reader:
yield [row[key] for key in ('filename',)]
class SpeakerCounter(object):
def __init__(self, debug=... | 3.015625 | 3 |
setup.py | rbshaffer/Constitute_Tools | 1 | 12766735 | <gh_stars>1-10
from distutils.core import setup
setup(
name='constitute_tools',
version='2.0',
packages=['constitute_tools'],
url='https://www.constituteproject.org/',
license='MIT',
author='<NAME>',
author_email='<EMAIL>',
description='Auxiliary tools for the Constitute backend.'
)
| 1.179688 | 1 |
test/composite/test_softmax.py | Whadup/pytorch_scatter | 0 | 12766736 | <filename>test/composite/test_softmax.py
from itertools import product
import pytest
import torch
from torch_scatter.composite import scatter_log_softmax, scatter_softmax
from test.utils import devices, tensor, grad_dtypes
@pytest.mark.parametrize('dtype,device', product(grad_dtypes, devices))
def test_softmax(dtyp... | 2.21875 | 2 |
somaticseq/utilities/attach_pileupVAF.py | bioinform/somaticseq | 159 | 12766737 | <filename>somaticseq/utilities/attach_pileupVAF.py
#!/usr/bin/env python3
# Supports Insertion/Deletion as well as SNVs
# Last updated: 8/29/2015
import math, argparse, sys, os, gzip
import re
import somaticseq.genomicFileHandler.genomic_file_handlers as genome
import somaticseq.genomicFileHandler.pileup_reader as pil... | 2.40625 | 2 |
tests/test_sample.py | whs2k/tweetCarousel | 0 | 12766738 | <filename>tests/test_sample.py
def add_up(nums):
return sum(nums)
def test_answer():
assert add_up([1,2,2]) == 5 | 3.078125 | 3 |
opencv_practicas/leerVideos.py | WilsonOviedo/AI-practica | 0 | 12766739 | import cv2 as cv
capture = cv.VideoCapture('opencv_practicas/VID_20200312_162550.mp4')
while True:
isTrue, frame = capture.read()
cv.imshow('video', frame)
if cv.waitKey(20) &0xFF==ord('d'):
break
capture.release()
cv.destroyAllWindows() | 2.671875 | 3 |
tests/test_repos.py | baricadr/baricadr | 1 | 12766740 | <gh_stars>1-10
import os
import tempfile
import pytest
from . import BaricadrTestCase
class TestRepos(BaricadrTestCase):
def test_get_empty(self, app):
conf = {
}
with pytest.raises(ValueError):
app.repos.do_read_conf(str(conf))
def test_get_incomplete(self, app):
... | 2.296875 | 2 |
data_management/autopreprocess_testing/test_preprocess_directory.py | BloomTech-Labs/scribble-stadium-ds | 3 | 12766741 | import preprocess_directory
import unittest
FIXTURES_DIRECTORY_PATH = "Fixtures"
class TestGetImages(unittest.TestCase):
"""
Class for test function below for the get_all_images function from the preprocess_directory.py file
"""
def test_check_file(self):
"""
Test for the get_all_images... | 2.890625 | 3 |
__app__/ping/ping.py | rivoric/websitemon | 1 | 12766742 | import logging
import requests
import json
import azure.functions as func
def main(req: func.HttpRequest, config: str) -> func.HttpResponse:
configuration = json.loads(config)
response = requests.get(configuration["websiteUrl"])
logging.info("%s -> %s" % (response.url, response.reason))
return... | 2.734375 | 3 |
zinnia/urls/comments.py | Boondockers-Welcome/django-blog-zinnia | 1,522 | 12766743 | """Urls for the Zinnia comments"""
from django.conf.urls import url
from zinnia.urls import _
from zinnia.views.comments import CommentSuccess
urlpatterns = [
url(_(r'^success/$'),
CommentSuccess.as_view(),
name='comment_success'),
]
| 1.5 | 2 |
terminio/commandexecutor/find.py | SourishS/terminio | 1 | 12766744 | from terminio.commandexecutor.commandexecutor import CommandExecutor
class find(CommandExecutor):
"""docstring for find"""
def __init__(self, session):
super(find, self).__init__(session)
def execute_command(self, args):
print(args)
| 2.453125 | 2 |
DeepGM/main_cifar.py | khainb/BoMb-OT | 6 | 12766745 | <filename>DeepGM/main_cifar.py
from __future__ import print_function
import argparse
import logging
import os
import random
import imageio
import numpy as np
import torch
import torchvision.datasets as datasets
from Cifar_generator import Cifar_Generator, Discriminator
from experiments import sampling
from fid_score ... | 2.34375 | 2 |
blog/models.py | tylerpitcher/flask-blog | 0 | 12766746 | '''
Defines database models.
'''
from flask_login import UserMixin
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.sql import func
from hashids import Hashids
import bcrypt
from blog.helpers import is_username, is_email, is_password, in_database
from blog import app
db = SQLAlchemy(app)
class User(db.Model... | 3.21875 | 3 |
administrator/views.py | babygame0ver/kisanmill | 0 | 12766747 | <filename>administrator/views.py
from django.shortcuts import render
from ufs.models import Message
from customercorner.models import Product
from django.views.generic import DetailView, ListView , CreateView , DeleteView , TemplateView
class MessageListView(ListView):
model = Message
template_name = 'administ... | 1.851563 | 2 |
stwno_canteen/csv_converters.py | somsky/stwno_canteen | 0 | 12766748 | import datetime
from .stwno_constants import CSV_MEAL_TYPE_MAP,\
CSV_NUTRITION_TYPE_MAP,\
NutritionType,\
CSV_DATE_FORMAT,\
MealType,\
NutritionType,\
STWNO_INGREDIENTS,\
STWNO_ALLERGENS
class NoValidDateStringException(Exception):
pass
class UnknownMealTypeException(Exception):
... | 2.609375 | 3 |
pyprobar/styleString.py | beidongjiedeguang/python-progress-bar | 16 | 12766749 | <reponame>beidongjiedeguang/python-progress-bar
from pyprobar.utils import dict_dotable
CSI = '\033['
OSC = '\033]'
OFF = CSI + '0m'
rgb_dict = {
"浅绿": (66, 227, 35),
"深绿": (28, 97, 15),
"嫩绿": (194, 250, 134),
"天青": (28, 199, 212),
"紫色": (146, 52, 247),
"浅紫": (214, 126, 209),
"浅蓝": (186, 1... | 2.71875 | 3 |
mobility_pipeline/plot_voronoi.py | codethechange/mobility_pipeline | 0 | 12766750 | #!/usr/bin/env python3
"""Tool for plotting the Voronoi tessellation described by the provided data
Note that the seeds of the tessellation are based on the provided towers file,
not computed from the cells. The tool also prints to the console the number
of towers and number of cells. Towers without an associated cel... | 3.453125 | 3 |