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 |
|---|---|---|---|---|---|---|
backend/app/settings.py | sudipbhujel/election | 3 | 52400 | """
Django settings for app project.
Generated by 'django-admin startproject' using Django 3.1.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
from datetime impo... | 1.726563 | 2 |
OpenCV/networktablesaddon.py | cyamonide/FRC-2017 | 0 | 52401 | <reponame>cyamonide/FRC-2017<filename>OpenCV/networktablesaddon.py
from networktables import NetworkTable
import logging
logging.basicConfig(level=logging.DEBUG) # enables logging for pynetworktables
NetworkTable.setIPAddress("roboRIO-4914-FRC.local")
NetworkTable.setClientMode()
NewtorkTable.initialize()
table = Netw... | 2.234375 | 2 |
serializers/Base_Serializer.py | AdarshK1/rosbag-dl-utils-mirror | 0 | 52402 | <reponame>AdarshK1/rosbag-dl-utils-mirror
"""
Copyright (C) Ghost Robotics - All Rights Reserved
Written by <NAME> <<EMAIL>>
"""
import os
import rospy
class BaseSerializer:
def __init__(self, topic_name='', skip_frame=1, directory_name='./', bag_file=''):
self.dir_name = directory_name
self.count... | 2.109375 | 2 |
src/ayeauth/models/user.py | ayeama/ayeauth | 0 | 52403 | from flask_login import AnonymousUserMixin
from flask_login import UserMixin as BaseUserMixin
from werkzeug.datastructures import ImmutableList
from ayeauth import db
from ayeauth.auth.password import <PASSWORD>_password
from ayeauth.models import BaseModel
class UserMixin(BaseUserMixin):
@property
def is_ac... | 2.46875 | 2 |
subtools/exceptions.py | huimingz/subtools | 4 | 52404 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# author: "Kairu"
# contact:
# date: "2017/11/17"
class PySubError(Exception):
"""基本错误类型"""
pass
class SubFormatError(PySubError):
"""字幕格式错误"""
pass
class AssFilePathError(PySubError):
"""文件路径错误"""
pass
class AssParseError(P... | 2.015625 | 2 |
main.py | Meet2512/Project-Game-Spacewar | 1 | 52405 | # _______________________________________________________________________________________
# ___________________________________Welcome_____________________________________________
# _______________________________________________________________________________________
import pygame # Importing modul... | 3.109375 | 3 |
main.py | dima7a14/personal_tasks_bot | 0 | 52406 | import os
from dotenv import load_dotenv
from telegram import Bot, Update, InlineKeyboardMarkup, InlineKeyboardButton, ParseMode, ReplyKeyboardMarkup
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters, CallbackContext, CallbackQueryHandler, ConversationHandler
from telegram.utils.request import R... | 2.3125 | 2 |
learning_journal/security.py | han8909227/pyramid-learning-journal | 0 | 52407 | <filename>learning_journal/security.py
"""Configure and hold all pertinent security information for the app."""
import os
from pyramid.authentication import AuthTktAuthenticationPolicy
from pyramid.authorization import ACLAuthorizationPolicy
from pyramid.security import Authenticated
from pyramid.security import Allow
... | 2.765625 | 3 |
tests/constants.py | bio2bel/wikipathways | 3 | 52408 | <filename>tests/constants.py<gh_stars>1-10
# -*- coding: utf-8 -*-
"""Test constants for Bio2BEL WikiPathways."""
import logging
import os
import bio2bel_wikipathways
import bio2bel_wikipathways.manager
import pybel
from bio2bel.manager.connection_manager import build_engine_session
from bio2bel.testing import Tempo... | 2.125 | 2 |
src/fne/evolution/mutations.py | thomasreolon/Evolutive-NAS | 2 | 52409 | import torch
import random
from .utils import get_conf, encode_conf
class Mutations():
def __init__(self, search_space, prob_mutation=0.8, prob_resize=0.05, prob_swap=0.04, exploration_vs_exploitation=0.5):
n = len(search_space)
# general vars
self.exploration_vs_exploitation = exploration_... | 2.3125 | 2 |
setup.py | IceArrow256/genlab | 4 | 52410 | from setuptools import setup, find_packages
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='genlab',
version='0.3',
description='Create a lab report',
long_description=long_des... | 1.398438 | 1 |
webapp/experiments/dash-upload/layoutBacktrack.py | paul-shannon/IJAL-interlinear | 0 | 52411 | <gh_stars>0
import datetime
import base64
import pdb
import dash
from dash.dependencies import Input, Output, State
import dash_core_components as dcc
import dash_html_components as html
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=external_styl... | 2.234375 | 2 |
intents/connectors/dialogflow_es/prediction_format_test.py | dario-chiappetta/dialogflow_agents | 6 | 52412 | <filename>intents/connectors/dialogflow_es/prediction_format_test.py
from google.cloud.dialogflow_v2.types import DetectIntentResponse
from google.cloud.dialogflow_v2 import types as df_types
from intents.language import IntentResponseGroup, TextIntentResponse, QuickRepliesIntentResponse, CardIntentResponse
from inten... | 2.25 | 2 |
sentimental_analysis/realworld/utilityFunctions.py | ianyehwork/SE_Project1 | 0 | 52413 | import re
import string
from datetime import datetime
import nltk
from nltk.corpus import stopwords
from nltk.sentiment.vader import SentimentIntensityAnalyzer
from nltk.stem import PorterStemmer
from nltk.tokenize import word_tokenize
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
linkPattern = ... | 2.640625 | 3 |
pizza_box/handlers.py | jklynch/pizza-box | 0 | 52414 | import os
import numpy as np
import pandas as pd
from databroker.assets.handlers_base import HandlerBase
class APBBinFileHandler(HandlerBase):
"Read electrometer *.bin files"
def __init__(self, fpath):
# It's a text config file, which we don't store in the resources yet, parsing for now
fpat... | 2.4375 | 2 |
src/scoring.py | mikkio/scoring | 0 | 52415 | import numpy as np
import pandas as pd
import sys
import re
# question type definition
S = 0 # [S, col, corr [,rate]]
MS = 1 # [MS, [cols,..], [corr,..] [,rate]]
Num = 2 # [Num, [cols,..], [corr,..] [,rate]]
SS = 3 # [SS, [start,end], [corr,...] [,rate]]
# the list of question type and reference
# [type, column, ... | 2.65625 | 3 |
routine_qiime2_analyses/post_analyses.py | FranckLejzerowicz/routine_qiime2_analyses | 0 | 52416 | <reponame>FranckLejzerowicz/routine_qiime2_analyses
# ----------------------------------------------------------------------------
# Copyright (c) 2020, <NAME>.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# -------------------... | 1.492188 | 1 |
pywren_ibm_cloud/libs/cloudpickle/__init__.py | gerardparis/pywren-ibm-cloud | 0 | 52417 | import pickle
from pywren_ibm_cloud.libs.cloudpickle.cloudpickle import *
__version__ = '1.2.2'
| 1.203125 | 1 |
geneblocks/CommonBlocks/commonblocks_tools.py | Edinburgh-Genome-Foundry/Geneblocks | 26 | 52418 | """Algorithmic methods for the selection of common blocks in DiffBlocks
- select_common_blocks
-
- segments_difference
"""
import re
import tempfile
import subprocess
from collections import defaultdict, OrderedDict
import numpy as np
from ..biotools import reverse_complement, sequence_to_record
def format_seq... | 3.09375 | 3 |
src/load_data.py | torvicvasil/pyspark-study | 0 | 52419 | <filename>src/load_data.py<gh_stars>0
from pyspark.sql import SparkSession
from pyspark.sql import functions as F
from pyspark import SparkContext
import os
import requests
DIR_PATH = os.path.dirname(os.path.realpath(__file__))
PATH_TO_SAVE = f"{DIR_PATH}/data-set/"
URLS = ["https://assets.datacamp.com/production/repo... | 2.890625 | 3 |
smoke_test.py | rphilander/proteus | 0 | 52420 | <reponame>rphilander/proteus
import unittest
from core import Atom, AtomIndex, interpret, Query
from database import DB
import grammar
import rows2atoms
test_data = [ '\t'.join(['<NAME>', '27', 'United States', '2012', 'Bowling', '2', '1', '0', '3']) ]
class SmokeTests(unittest.TestCase):
@classmethod
def se... | 2.765625 | 3 |
quant_trading/similarity/similarity_utils.py | booostark/quant-trading | 1 | 52421 | <gh_stars>1-10
import pandas as pd
from quant_trading.datasets import stock_dataset
from quant_trading import settings
def write_similarity(encoding_dim, symbols, cluster_labels, distances, indices):
stock_data = stock_dataset.StockDataset()
print("cluster_labels:\n", cluster_labels)
print("indices:\n",... | 2.875 | 3 |
wef/items/views/__init__.py | deadlylaid/study_alone | 6 | 52422 | <filename>wef/items/views/__init__.py
from .booksale import BookSale
from .postdetail import PostDetail
from .postlist import PostList
from .search import SearchView
from .postdelete import PostDelete
from .introduce import IntroduceView
| 1.125 | 1 |
dinosar/cli/get_inventory_asf.py | scottyhq/dinosar | 64 | 52423 | <filename>dinosar/cli/get_inventory_asf.py
#!/usr/bin/env python3
"""Query ASF catalog with SNWE bounds or vector file.
Author: <NAME>
Date: 10/2017
"""
import argparse
import dinosar.archive.asf as asf
import sys
def cmdLineParse():
"""Command line parser."""
parser = argparse.ArgumentParser(description="g... | 2.515625 | 3 |
uftlib/uftemplates.py | thestick613/uftlib | 0 | 52424 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import time
import logging
import linecache
import copy
from string import Template
logger = logging.getLogger(__name__)
class ExtraDict(dict):
""" Creates a dict-like structure where we can store the new values of
variables, while keeping the old (initial) ones as ... | 3.140625 | 3 |
toqito/matrices/gen_gell_mann.py | paniash/toqito | 76 | 52425 | """Generalized Gell-Mann matrices."""
from typing import Union
from scipy import sparse
import numpy as np
def gen_gell_mann(
ind_1: int, ind_2: int, dim: int, is_sparse: bool = False
) -> Union[np.ndarray, sparse.lil_matrix]:
r"""
Produce a generalized Gell-Mann operator [WikGM2]_.
Construct a :cod... | 3.09375 | 3 |
walker_drake/three_link.py | mmolnar0/sgillen_research | 0 | 52426 | # Load the double pendulum from Universal Robot Description Format
#tree = RigidBodyTree(FindResource("double_pendulum/double_pendulum.urdf"), FloatingBaseType.kFixed)
#tree = RigidBodyTree(FindResource("../../notebooks/three_link.urdf"), FloatingBaseType.kFixed)
#tree = RigidBodyTree(FindResource("../../drake/examples... | 2.71875 | 3 |
tests/test_numbering.py | JwoolardAU/pandoc-numbering | 0 | 52427 | # This Python file uses the following encoding: utf-8
from unittest import TestCase
from pandocfilters import Para, Str, Space, Span, Strong, RawInline, Emph, Header, DefinitionList, Plain
import json
import pandoc_numbering
from helper import init, createMetaList, createMetaMap, createMetaInlines, createListStr, c... | 2.515625 | 3 |
tests/unit/test_template_helpers_java.py | RerrerBuub/asciidoxy | 14 | 52428 | # Copyright (C) 2019-2021, TomTom (http://tomtom.com).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 2.140625 | 2 |
python/EXERCICIO 71 - SIMULADOR DO CAIXA ELETRONICO.py | debor4h/exerciciosPython | 1 | 52429 | #071)Simular caixa eletronico, celulas 50,20,10,1 R$.EX: 100 e duas celulas de 50
#FORMA SEM O WHILE
saque = float(input('Qual valor você quer sacar? R$ '))
if saque == 0 or saque < 0:
print('Digite um valor acima de ZERO, por favor!')
cinquenta = saque//50
vinte = (saque%50)//20
dez = ((saque%50)%20)//10
um = ((saq... | 3.78125 | 4 |
Final Class Test/Final Exam - Boundary Detection .py | Ciaran-OBrien/Image-Processing | 2 | 52430 | <reponame>Ciaran-OBrien/Image-Processing
# coding: utf-8
# In[2]:
# Author: <NAME>
# Lecture: Jane Courtney
# Submitted: 13/12/18
# This code is in response to CA Class Test: Boundary Detection
# N.B. This code orignated as a Jupyter file, thus relavent code and lineNumbers remain
# Boiler plate imports
import o... | 3.53125 | 4 |
authentication/admin.py | shayweitzman/MyAutoBook | 1 | 52431 | from django.contrib import admin
from .models import Student,Adult
class AdultAdmin(admin.ModelAdmin):
search_fields = ['user__first_name', 'user__last_name','ID_Number' ,'id','user__username',]
list_display = ('user','id','ID_Number',)
class StudentAdmin(admin.ModelAdmin):
search_fields = ['user__first_n... | 2.015625 | 2 |
tests/label.py | adamantonio/gooeypie | 1 | 52432 | import gooeypie as gp
from random import choice
app = gp.GooeyPieApp('Label widget')
align_options = ['left', 'center', 'right']
label_text = ['A short label',
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut ' \
'labore et dolore magna aliqua. U... | 2.53125 | 3 |
getStationInfoCapstone.py | cjer/open-bus-explore | 1 | 52433 | # -*- coding: utf-8 -*-
""" this program takes as input the number of a bus station,
access the mabat.mot.gov.il web site, and retrieves the
bus line number and arrival time for each bus reaching the station"""
""" code and advice used in this program:
מידע על תחנה:
אם תשלח בקשת POST לכתובת הזאת:http://mabat.mot.... | 3.3125 | 3 |
keras_dna/__init__.py | etirouthier/keras_dna | 14 | 52434 | from __future__ import absolute_import
from . import evaluation
from . import normalization
from . import extractors
from . import generators
from . import layers
from . import model
from . import utils
from . import sequence
# Also importable from root
from .generators import Generator, MultiGenerator
from .model i... | 1.117188 | 1 |
sikulix4python/sxclasses.py | cdlaimin/sikulix4python | 71 | 52435 | <filename>sikulix4python/sxclasses.py
from . sxbase import *
from . sxregion import Region
class Screen(Region):
SXClass = SXScreen
class Location(SXBase):
SXClass = SXLocation
class Image(SXBase):
SXClass = SXImage
| 1.695313 | 2 |
sumultiply.py | GraceAKelly/Is-it-Tuesday | 0 | 52436 | # <NAME>
# 08 March 2018
# Practice problem 1
# Use summultiple function
# # https://github.com/ianmcloughlin/problems-python-fundamentals
def sumultiply(x, y): # Define optput required
total = 0
for i in range(y):
total = total + x # Change definition of total Loop y and add x to total
return total
print(sumultip... | 3.984375 | 4 |
PythonFiles/app.py | IamVaibhavsar/Python_Files | 0 | 52437 | import usefulFunctions
#importing the other file in a program
#all the functions, variables of this file can be used in this file
print(usefulFunctions.roll_dice())
print(usefulFunctions.friends) | 2.53125 | 3 |
67_add_binary.py | ojhaanshu87/LeetCode | 0 | 52438 | <gh_stars>0
"""
Given two binary strings a and b, return their sum as a binary string.
Example 1:
Input: a = "11", b = "1"
Output: "100"
Example 2:
Input: a = "1010", b = "1011"
Output: "10101"
Constraints:
1 <= a.length, b.length <= 104
a and b consist only of '0' or '1' characters.
Each string does not cont... | 3.734375 | 4 |
devops-console/apps/teams/models.py | lilinghell/devops | 4 | 52439 | <gh_stars>1-10
from django.db import models
from django.utils.translation import ugettext_lazy as _
from users.models import User
from common.mixin import BaseModelMixin
__all__ = ["Team", "Member"]
class Team(BaseModelMixin):
name = models.CharField(max_length=128, null=True, unique=True, verbose_name=_("TeamNa... | 2.140625 | 2 |
2-python-intermediario (Programacao Procedural)/aula16-reduce/aula16-reduce.py | Leodf/projetos-python | 0 | 52440 | <filename>2-python-intermediario (Programacao Procedural)/aula16-reduce/aula16-reduce.py<gh_stars>0
from dados import pessoas, produtos, lista
from functools import reduce
"""
acumula = 0
for item in lista:
acumula += item
print(acumula)
"""
# soma_lista = reduce(lambda ac, i: i + ac, lista, 0)
# print(soma_list... | 3.28125 | 3 |
Seth/dashboard/urls.py | Inf1n1te/Seth | 1 | 52441 | from django.conf.urls import url
from django.conf import settings
from django.conf.urls.static import static
from . import views
urlpatterns = [
url(r'^$', views.DashboardView.as_view(), name='home'),
url(r'^sa_dashboard/$', views.study_adviser_view, name='sa_dashboard'),
url(r'^dashboard/$', views.Dashb... | 1.6875 | 2 |
build/lib/mellplayer/qr.py | dshowing/MellPlayer_ds | 0 | 52442 | <filename>build/lib/mellplayer/qr.py
#/usr/bin/env python
# -*- encoding : utf-8 -*-
# created by dshowing
import qrcode
class QR(object):
STEP = 10
def str2qr(self, text):
"""
把给定的字符串生成一个对应的二维码
"""
qr = qrcode.QRCode(
version=1,
error_correction=qrcod... | 3 | 3 |
dicom_tools/info_file_parser.py | carlomt/dicom_tools | 7 | 52443 |
def info_file_parser(filename, verbose=False):
results = {}
infile = open(filename,'r')
for iline, line in enumerate(infile):
if line[0]=='#': continue
lines = line.split()
if len(lines)<2 : continue
if lines[0][0]=='#': continue
infotype = lines[0]
infotype... | 3.28125 | 3 |
py/dd_sliceapply_all.py | bcgov/diutils | 0 | 52444 | <gh_stars>0
# Copyright 2019 Province of British Columbia
#
# 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 applicabl... | 2.375 | 2 |
custom_exceptions.py | maxweldsouza/ceme | 0 | 52445 | class AlreadyExists(Exception):
pass
class NoRights(Exception):
pass
class EntryNotFound(Exception):
pass
class LoginFailed(Exception):
pass
# input validation
""" Input validation """
class InvalidInput(Exception):
pass
| 2.15625 | 2 |
55.py | r9y9/nlp100 | 18 | 52446 | <gh_stars>10-100
from lxml import etree
tree = etree.parse("nlp.txt.xml")
root = tree.getroot()
docment = root[0]
sentences = docment.find("sentences")
for sentence in sentences:
tokens = sentence.find("tokens")
for token in tokens:
word = token.find("word")
ner = token.find("NER")
if ... | 3.03125 | 3 |
Background.py | ViktorTrojan/Flappy-Bird | 0 | 52447 | <filename>Background.py
from Scrolling import Scrolling
class Background(Scrolling):
pass | 1.453125 | 1 |
backend/tickets/admin.py | smehlhoff/notepark-backend | 0 | 52448 | from django.contrib import admin
from .models import Ticket
def set_tickets_open(modeladmin, request, queryset):
rows_updated = queryset.update(status='Open')
if rows_updated == 1:
modeladmin.message_user(request, 'Ticket successfully set to open.')
else:
modeladmin.message_user(
... | 1.976563 | 2 |
src/commands/database/DeleteInstallationsCommand.py | StrandHQ/strand-slack | 0 | 52449 | <reponame>StrandHQ/strand-slack<gh_stars>0
from src.commands.Command import Command
from src.models.domain.Installation import Installation
from src.utilities.database import db_session
class DeleteInstallationsCommand(Command):
def __init__(self, slack_team_id, oauth_tokens):
super().__init__()
s... | 2.015625 | 2 |
main.py | kindlehl/Py3NES | 128 | 52450 | <reponame>kindlehl/Py3NES
import argparse
from cpu import CPU
from graphics.graphics import Window
from nes_test import NesTestLog
from ram import RAM
from apu import APU
from ppu import PPU
from rom import ROM
class Nes:
def __init__(self, rom_bytes, testing):
self.rom = ROM(rom_bytes)
# create... | 2.84375 | 3 |
tests/Handlers/test_DictionaryDeserializer.py | TheBoringBakery/Riot-Watcher | 489 | 52451 | <gh_stars>100-1000
import json
import pytest
from riotwatcher.Handlers import DictionaryDeserializer
@pytest.mark.unit
class TestDictionaryDeserializer:
def test_basic_json(self):
deserializer = DictionaryDeserializer()
expected = {
"test": {"object": "type", "int": 1},
... | 2.703125 | 3 |
nntoolbox/sequence/models/decoder.py | nhatsmrt/nn-toolbox | 16 | 52452 | <reponame>nhatsmrt/nn-toolbox
import torch
from torch import nn
from ..components import AdditiveAttention
class Decoder(nn.Module):
def __init__(self, output_size, hidden_size, embedding_dim, max_length, enc_dim, device, dropout_p=0.1, pad_token=0):
super(Decoder, self).__init__()
self._hidden_s... | 2.421875 | 2 |
mpltools/widgets/slider.py | takemiyamakoto/mpltools | 44 | 52453 | import matplotlib.widgets as mwidgets
class Slider(mwidgets.Slider):
"""Slider widget to select a value from a floating point range.
Parameters
----------
ax : :class:`~matplotlib.axes.Axes` instance
The parent axes for the widget
value_range : (float, float)
(min, max) value allo... | 3.828125 | 4 |
passbook/core/migrations/0009_auto_20200221_1410.py | fossabot/passbook | 0 | 52454 | <gh_stars>0
# Generated by Django 3.0.3 on 2020-02-21 14:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("passbook_core", "0008_auto_20200220_1242"),
]
operations = [
migrations.AlterField(
model_name="application",
... | 1.6875 | 2 |
trx/utils/numeric.py | cmariette/trx | 1 | 52455 | # -*- coding: utf-8 -*-
from __future__ import print_function,division,absolute_import
import logging
log = logging.getLogger(__name__) # __name__ is "foo.bar" here
import numpy as np
import numbers
np.seterr(all='ignore')
def findSlice(array,lims):
start = np.ravel(np.argwhere(array>lims[0]))[0]
stop = np.rav... | 2.703125 | 3 |
bco_api/api/views.py | biocompute-objects/bco_api | 1 | 52456 | <reponame>biocompute-objects/bco_api
#!/usr/bin/env python3
"""BCODB views
Django views for BCODB API
"""
# Based on the "Class Based API View" example at
# https://codeloop.org/django-rest-framework-course-for-beginners/
# For instructions on calling class methods from other classes, see
# https://stackoverflow.com/... | 2.015625 | 2 |
justify.py | teared/sublime-justify | 3 | 52457 | import re
import sublime
import sublime_plugin
from Default.paragraph import *
from Default.paragraph import OldWrapLinesCommand as WrapLinesCommand
from . import jtextwrap as textwrap
class WrapLinesJustifiedCommand(WrapLinesCommand):
''' Same as parent, except using jtextwrap. '''
def __init__(self, *args, *... | 2.453125 | 2 |
src/zope/index/topic/__init__.py | Recursing/zope.index | 7 | 52458 | from zope.index.topic.index import TopicIndex
| 1.054688 | 1 |
src/plugins/getNow.py | Moyulingjiu/QQbot | 0 | 52459 | <reponame>Moyulingjiu/QQbot
import datetime
def toString():
curr_time = datetime.datetime.now()
time_str = datetime.datetime.strftime(curr_time, '%Y-%m-%d %H:%M:%S')
return time_str
def getHour():
curr_time = datetime.datetime.now()
return curr_time.hour
def getMinute():
curr_time = dateti... | 3.015625 | 3 |
de_interleave.py | brendane/miscellaneous_bioinfo_scripts | 0 | 52460 | #!/usr/bin/env python2.7
import itertools
import sys
import re
from Bio import SeqIO
def grouper(iterable, n, fillvalue=None):
"Collect data into fixed-length chunks or blocks"
# grouper('ABCDEFG', 3, 'x') --> ABC DEF Gxx"
args = [iter(iterable)] * n
return itertools.izip_longest(*args, fillvalue=fil... | 3.109375 | 3 |
country_class.py | shreya-n-kumari/python | 0 | 52461 | <reponame>shreya-n-kumari/python<filename>country_class.py
class Country():
def __init__(self, name='Unspecified', population=None, size_kmsq=None): #keyword argument.
self.name = name
self.population = population
self.size_kmsq = size_kmsq
def __str__(self):
return self.nam... | 3.75 | 4 |
setup.py | leomauro/pysptk | 348 | 52462 | <filename>setup.py
import os
import subprocess
from distutils.version import LooseVersion
from glob import glob
from os.path import join
import setuptools.command.build_py
import setuptools.command.develop
from setuptools import Extension, find_packages, setup
from setuptools.command.build_ext import build_ext as _bui... | 1.945313 | 2 |
user_service/test/server/test_app.py | KieshaJ/ras | 0 | 52463 | <gh_stars>0
def test_owner_register_success():
assert True
def test_owner_register_failure():
assert True
def test_worker_register_success():
assert True
def test_worker_register_failure():
assert True
def test_login_success():
assert True
def test_login_failure():
assert True
| 1.367188 | 1 |
extensions/utils/plugging.py | taciturasa/atteybot-neo | 1 | 52464 | # -*- coding: utf-8 -*-
# attey plugging util
# Provides utils for dealing with plugs and entries inside panels.
'''Plugging File'''
import discord
from discord.ext import commands
import rethinkdb
from extensions.utils import logging
def entry():
def inner():
...
return inner
def selection():
... | 2.546875 | 3 |
python_agent/moveTurn.py | Idewan/KalahAI | 0 | 52465 | class MoveTurn(object):
def __init__(self):
self.end = False
self.again = False
self.move = None
if __name__ == "__main__":
Print('This class has been checked and works as expected.') | 3.015625 | 3 |
jupylet/clock.py | ofer1992/jupylet | 0 | 52466 | <reponame>ofer1992/jupylet
"""
jupylet/clock.py
Copyright (c) 2020, <NAME> - <EMAIL>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright... | 1.617188 | 2 |
prediction_base/predict.py | arkmand2015/belief_pred_serv | 0 | 52467 | <reponame>arkmand2015/belief_pred_serv
import pickle
import os
import time
import numpy as np
from os import path
import pandas as pd
from tqdm import tqdm
from scipy import sparse
from pathlib import Path
from typing import NamedTuple
from collections import Counter
from transformers import pipeline
from async_calls i... | 1.953125 | 2 |
common/xrd-ui-tests-python/helpers/auditchecker.py | ria-ee/XTM | 3 | 52468 | <filename>common/xrd-ui-tests-python/helpers/auditchecker.py<gh_stars>1-10
import ssh_client
import re
import json
class AuditChecker:
'''
X-Road log (audit.log) checker. Connects to security or central server over SSH and gets the last audit.log rows from
it, then compares them to specified log ... | 2.828125 | 3 |
setup.py | vreshniak/exemplar-feature-inpainting | 5 | 52469 | <reponame>vreshniak/exemplar-feature-inpainting<filename>setup.py<gh_stars>1-10
# setup.py script to build and install patchmatch extension module written in C
import platform
plt = platform.system()
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cython... | 1.59375 | 2 |
test/test_dict.py | Accenture/mercury-python | 6 | 52470 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2018-2021 Accenture Technology
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#... | 2.640625 | 3 |
MDS_random_sampling.py | LCB0B/metric | 0 | 52471 |
# -*- coding: utf-8 -*-
from copy import deepcopy
# Import all the packages
import torch
from torch.autograd import Variable
import torch.nn as nn
import numpy as np
import torch.optim as optim
import torch.nn.functional as f# create a dummy data
import matplotlib.pyplot as plt
import networkx as nx
i... | 2.328125 | 2 |
tests/unit/tuner/dataset/test_class_sampler.py | jina-ai/finetuner | 270 | 52472 | <filename>tests/unit/tuner/dataset/test_class_sampler.py
from collections import Counter
import pytest
from finetuner.tuner.dataset.samplers import ClassSampler
@pytest.mark.parametrize("batch_size", [-1, 0])
def test_wrong_batch_size(batch_size: int):
with pytest.raises(ValueError, match="batch_size"):
... | 2.28125 | 2 |
running_tests.py | avisrivastava254084/eeg_simulator | 12 | 52473 | import numpy as np
import matplotlib.pyplot as plt
plt.style.use('ggplot')
m_f = np.load('objects/simulation_model_freq.npy')[:50]
m_p = np.load('objects/simulation_model_power.npy')[:50]
eeg_f = np.load('objects/real_eeg_freq.npy0.npy')[:50]
eeg_p = np.load('objects/real_eeg_power_0.npy')[:50]
plt.figure()
plt.se... | 2.6875 | 3 |
routemaster_sdk/types.py | thread/routemaster-sdk | 0 | 52474 | """Types to match those in the API."""
from typing import Any, Dict, NewType, NamedTuple
LabelName = NewType('LabelName', str)
StateMachine = NewType('StateMachine', str)
State = NewType('State', str)
Metadata = Dict[str, Any]
LabelRef = NamedTuple('LabelRef', [
('name', LabelName),
('state_machine', StateM... | 2.453125 | 2 |
operations_api/utils/logging.py | Mirantis/python-operations-api | 0 | 52475 | <reponame>Mirantis/python-operations-api
import logging.config
import logging
import yaml
from os.path import dirname, exists, join, normpath
class ClassLoggerMixin(object):
def __init__(self, *args, **kwargs):
name = '{}.{}'.format(self.__class__.__module__, self.__class__.__name__)
self.logger... | 2.09375 | 2 |
PyFunceble/utils/profile.py | Centaurioun/PyFunceble | 213 | 52476 | <reponame>Centaurioun/PyFunceble
# pylint: disable=invalid-name
"""
The tool to check the availability or syntax of domain, IP or URL.
::
██████╗ ██╗ ██╗███████╗██╗ ██╗███╗ ██╗ ██████╗███████╗██████╗ ██╗ ███████╗
██╔══██╗╚██╗ ██╔╝██╔════╝██║ ██║████╗ ██║██╔════╝██╔════╝██╔══██╗██║ ██╔════╝
... | 1.671875 | 2 |
bin/libanalysis/readers.py | henrikingo/dsi | 1 | 52477 | #pylint: skip-file
"""
NOTE: This is a local copy of the readers module, taken from the
support-tools/timeseries repository.
Provides functions to read FTDC data from either an FTDC file or from
a file containing serverStatus JSON documents, one per line. Each
reader takes a filename argument and returns a generator t... | 2.703125 | 3 |
MagneticField/Engine/test/queryField.py | gputtley/cmssw | 2 | 52478 | <reponame>gputtley/cmssw<filename>MagneticField/Engine/test/queryField.py
# Example configuration for the magnetic field.
# This example prompts for coordinates and prints the corresponding value of B.
import FWCore.ParameterSet.Config as cms
process = cms.Process("MAGNETICFIELDTEST")
process.source = cms.Source("Em... | 1.914063 | 2 |
pyNetlist/circuit.py | jeame/pyNetlist | 1 | 52479 | #
# PyNetlist is an open source framework
# for object-oriented electronic circuit synthesis,
# published under the MIT License (MIT).
#
# Copyright (c) 2015 <NAME>
#
from base import *
class Circuit(Device):
'''Container for the whole circuit'''
def parseargs(self, **kwargs):
for key,val in kwargs.i... | 2.5 | 2 |
stdnet/orm/mapper.py | TheProjecter/python-stdnet | 0 | 52480 | <filename>stdnet/orm/mapper.py
import copy
from stdnet import getdb
from query import Manager, UnregisteredManager
def clearall():
for meta in _registry.values():
meta.cursor.clear()
def register(model, backend = None, keyprefix = None, timeout = 0):
'''Register a :class:`stdnet.rom.StdNet` model... | 2.265625 | 2 |
automol/zmatrix/newzmat/test_.py | kevinmooreiii/autochem | 0 | 52481 | """ test automol.zmatrix
"""
import automol
from automol.zmatrix.newzmat._bimol_ts import hydrogen_abstraction
from automol.zmatrix.newzmat._bimol_ts import addition
from automol.zmatrix.newzmat._bimol_ts import insertion
from automol.zmatrix.newzmat._bimol_ts import substitution
from automol.zmatrix.newzmat._unimol_t... | 1.820313 | 2 |
eval/loss/get_loss_fn.py | CxrImagePreProcessing/CheXaid | 8 | 52482 | import torch
import torch.nn as nn
from torch.nn import functional as F
from .cross_entropy_with_uncertainty import CrossEntropyLossWithUncertainty
from .focal_loss import FocalLoss
from dataset import LabelMapper
def get_loss_fn(loss_fn_name,
device,
model_uncertainty,
... | 2.75 | 3 |
bin/debug.py | dkkim93/multiagent-particle-envs | 0 | 52483 | <reponame>dkkim93/multiagent-particle-envs
import numpy as np
import os,sys
sys.path.insert(1, os.path.join(sys.path[0], '..'))
import argparse
from multiagent.environment import MultiAgentEnv
from multiagent.policy import InteractivePolicy
import multiagent.scenarios as scenarios
if __name__ == '__main__':
scena... | 2.234375 | 2 |
src/mapstp/cli/runner.py | MC-kit/map-stp | 0 | 52484 | <gh_stars>0
"""Application to transfer meta information from STP.
For given STP file creates Excel table with a list
of STP paths to STP components, corresponding to cells
in MCNP model, would it be generated from the STP with SuperMC.
The excel also contains material numbers, densities, correction factors,
and RWCL ... | 2.109375 | 2 |
pyneMeas/Instruments/Electrometer.py | JakobSeidl/pyneMeas | 0 | 52485 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
@author: <NAME>, Nanoelectronics Group UNSW Sydney
"""
#Electrometer
import pyvisa as visa
import pyneMeas.Instruments.Instrument as Instrument
import time
import math
@Instrument.enableOptions
class Keithley6517A(Instrument.Instrument):
# Default options to ... | 2.359375 | 2 |
PLC/Methods/AddPersonTag.py | dreibh/planetlab-lxc-plcapi | 0 | 52486 | <reponame>dreibh/planetlab-lxc-plcapi<filename>PLC/Methods/AddPersonTag.py<gh_stars>0
#
# <NAME> - INRIA
#
from PLC.Faults import *
from PLC.Method import Method
from PLC.Parameter import Parameter, Mixed
from PLC.Auth import Auth
from PLC.Persons import Person, Persons
from PLC.TagTypes import TagType, TagTypes
from ... | 2.46875 | 2 |
strategies/analyser.py | Sytten/artis | 6 | 52487 | <reponame>Sytten/artis
import logging
import ccxt.async as ccxt
from liqui import Liqui
from binance.client import Client
from database.models.types import Types
from database.models.status import Status
from dynaconf import settings
logger = logging.getLogger(__name__)
class CoinAnalysis(object):
def __init__(s... | 2.21875 | 2 |
src/rnn/cnn_test1.py | xiaoyuehe/TFFinance | 0 | 52488 | # coding=utf-8
'''
accuracy:98%
'''
import tensorflow as tf
def weight_variable(shape):
initial = tf.truncated_normal(shape, stddev=0.1)
return tf.Variable(initial)
def bias_variable(shape):
initial = tf.constant(0.1, shape=shape)
return tf.Variable(initial)
def conv2d(x, W):
return tf.nn.con... | 2.578125 | 3 |
taca/utils/config.py | jfnavarro/TACA | 0 | 52489 | <gh_stars>0
""" Load and parse configuration file
"""
import ConfigParser
import os
import yaml
CONFIG = {}
def load_config(config_file=None):
"""Loads a configuration file.
By default it assumes ~/.taca/taca.yaml
"""
try:
if not config_file:
config_file = os.path.join(os.environ.... | 3.03125 | 3 |
train.py | tpham393/PuppetGAN-Tensorflow-2 | 0 | 52490 | <gh_stars>0
import functools
import imlib as im
import numpy as np
import pylib as py
import tensorflow as tf
import tensorflow.keras as keras
import tf2lib as tl
import tf2gan as gan
import tqdm
import data
import module
# ==============================================================================
# = ... | 2.109375 | 2 |
examples/models/server/line_animate.py | DuCorey/bokeh | 1 | 52491 | <filename>examples/models/server/line_animate.py
from __future__ import print_function
from numpy import pi, sin, cos, linspace
from bokeh.client import push_session
from bokeh.driving import count
from bokeh.io import curdoc
from bokeh.models import (
Plot, DataRange1d, LinearAxis, Range1d,
ColumnDataSource,... | 2.765625 | 3 |
2-Creational Patterns/1-Factory Method Pattern & Abstract Factory Pattern/DocumentCreator-Letter-Resume Example/Python/factory_creator.py | Ziang-Lu/Design-Patterns | 2 | 52492 | <filename>2-Creational Patterns/1-Factory Method Pattern & Abstract Factory Pattern/DocumentCreator-Letter-Resume Example/Python/factory_creator.py
#!usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Factory module.
"""
__author__ = '<NAME>'
from abc import ABC, abstractmethod
from product_document import (
Fancy... | 3.9375 | 4 |
treat/moc/cmm/corrections.py | tjlaboss/tasty_treat | 3 | 52493 | <reponame>tjlaboss/tasty_treat<gh_stars>1-10
# Corrections
#
# Correction factors for the transport and scattering cross sections by group
from . import fuel, crd_follower, crd_poison
CORRECTIONS = {
# The 3 foundational CMM corrections
"Fuel" : fuel.CMMS,
"Crd Follower" : crd_follower.CMMS,
"Crd ... | 1.367188 | 1 |
drpg/__main__.py | rays/drpg | 5 | 52494 | import drpg.cmd
if __name__ == "__main__":
drpg.cmd.run()
| 0.917969 | 1 |
mmdet/core/bbox/assigners/__init__.py | Gitgigabyte/mmd | 1 | 52495 | <gh_stars>1-10
from .approx_max_iou_assigner import ApproxMaxIoUAssigner
from .assign_result import AssignResult
from .base_assigner import BaseAssigner
from .max_iou_assigner import MaxIoUAssigner
from .point_assigner import PointAssigner
from .max_iou_assigner_coeff import MaxIoUAssigner_coeff
from .max_iou_ud_assign... | 1.328125 | 1 |
xdev/__init__.py | Erotemic/xdev | 3 | 52496 | """
This is <NAME>'s xdev module.
These are tools I often use in IPython, but they almost never make it into
production code, otherwise they would be in :mod:`ubelt`.
"""
__dev__ = """
CommandLine:
# Regenerate the tail of this file
mkinit ~/code/xdev/xdev -w
TODO:
- [ ] Update mkinit so we can either:
... | 1.882813 | 2 |
mala/descriptors/descriptor_interface.py | htahmasbi/mala | 11 | 52497 | """Interface functions to automatically get descriptors."""
from mala.descriptors.snap import SNAP
def DescriptorInterface(params):
"""
Return a DescriptorBase object that adheres to the parameters provided.
Parameters
----------
params : mala.common.parameters.Parameters
Parameters for w... | 2.796875 | 3 |
examples/send.py | ippanel/python-rest-sdk | 3 | 52498 | <reponame>ippanel/python-rest-sdk
from ippanel import Client, Error, HTTPError, ResponseCode
client = Client("YOUR-API-KEY")
try:
bulk_id = client.send("+9810001", ["+98912xxxxxxx"], "Hello from python client!")
print(bulk_id)
except Error as e:
print("Error handled => code: %s, message: %s" % (e.code, e.... | 2.421875 | 2 |
aleph/views/roles_api.py | mcrouse911/findpeopleviadocument | 0 | 52499 | import logging
from flask import Blueprint, request
from itsdangerous import BadSignature
from flask.ext.babel import gettext
from aleph.core import db, settings
from aleph.search import QueryParser, DatabaseQueryResult
from aleph.model import Role, Permission, Audit
from aleph.logic.roles import check_visible, check_... | 1.992188 | 2 |