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 |
|---|---|---|---|---|---|---|
xarray_quantity/__init__.py | KaoruNishikawa/xarray-quantity | 0 | 55000 | # flake8: noqa
__version__ = "0.1.4"
from .quantity_array import QuantityArray
from .quantity_set import QuantitySet
| 0.988281 | 1 |
server/router/index.py | jungmir/fastapi-boilerplate | 0 | 55001 | <reponame>jungmir/fastapi-boilerplate
from fastapi import APIRouter, Request, Depends
from fastapi.responses import JSONResponse
from fastapi.encoders import jsonable_encoder
from sqlalchemy.orm import Session
from server.database.models.user import User
from server.database.connection import db
from server.assets.sche... | 2.375 | 2 |
sched/adaptdl_sched/supervisor.py | jessezbj/adaptdl | 294 | 55002 | # Copyright 2020 Petuum, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | 1.976563 | 2 |
syntax/string/compareObject.py | Dev-Learn/LearnPython | 0 | 55003 | class Person(object):
def __init__(self, name, age):
self.name = name
self.age = age
# Ghi đè phương thức __eq__
def __eq__(self, other):
return self.name == other.name and self.age == other.age
jack1 = Person('Jack', 23)
jack2 = Person('Jack', 23)
# Gọi tới phương thức __eq__
pr... | 4 | 4 |
questions/scripts/update_question_count_of_chapters.py | nyctophiliacme/edtech-backend | 0 | 55004 | import django
import os
import sys
sys.path.append("/home/ubuntu/edtech-backend")
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'superteacher.settings')
django.setup()
from exams.models import Exam
from subjects.models import Subject
from chapters.models import Chapter
from questions.models import QuestionChapterMa... | 2.078125 | 2 |
services/homesec/homesec.py | kstillson/ktools | 0 | 55005 | <gh_stars>0
#!/usr/bin/python3
'''TODO: doc
'''
import argparse, os, sys
import view
import kcore.common as C
import kcore.webserver as W
WEB_HANDLERS = {
'/$': view.root_view,
'/easy': view.easy_view,
'/healthz': view.healthz_view,
'/static.*': view.static_view,
'/status': vie... | 2.03125 | 2 |
python/code_challenges/fifo_animal_shelter/fifo_animal_shelter.py | brendanwelzien/data-structures-and-algorithms | 1 | 55006 | <filename>python/code_challenges/fifo_animal_shelter/fifo_animal_shelter.py<gh_stars>1-10
class Node:
'''each node represents a different dog or cat object
They each have a name, a type (cat or dog), and a
reference to the next animal in the shelter queue
'''
def __init__(self, animal_type, next_nod... | 4.03125 | 4 |
src/georinex/rinex2hdf5/__main__.py | scienceopen/rinex-reader-python | 66 | 55007 | <filename>src/georinex/rinex2hdf5/__main__.py
"""
Converts RINEX 2/3 NAV/OBS to NetCDF4 / HDF5
The RINEX version is automatically detected.
Compressed RINEX files including:
* GZIP .gz
* ZIP .zip
* LZW .Z
* Hatanaka .crx / .crx.gz
are handled seamlessly via TextIO stream.
Examples:
# batch convert RI... | 2.796875 | 3 |
167_LSTM_text_generation_ENGLISH.py | Data-Laboratory/WorkExamples | 1 | 55008 | <reponame>Data-Laboratory/WorkExamples<filename>167_LSTM_text_generation_ENGLISH.py
#Ref: <NAME>
"""
@author: <NAME>
Download text file from: http://www.gutenberg.org/ebooks/236
"""
from keras.models import Sequential
from keras.layers import Dense, Dropout, LSTM
from keras.optimizers import RMSprop
import numpy as... | 3.65625 | 4 |
metricbeat/tests/system/test_logstash.py | tyrocca/beats | 0 | 55009 | import os
import metricbeat
import unittest
import time
class Test(metricbeat.BaseTest):
COMPOSE_SERVICES = ['logstash']
FIELDS = ['logstash']
@unittest.skipUnless(metricbeat.INTEGRATION_TESTS, "integration test")
def test_node(self):
"""
logstash node metricset test
"""
... | 2.09375 | 2 |
tests/node/test_node.py | jhgg/graphql-relay-py | 1 | 55010 | <filename>tests/node/test_node.py
from collections import namedtuple
from pytest import raises
from graphql.core import graphql
from graphql.core.type import (
GraphQLSchema,
GraphQLObjectType,
GraphQLField,
GraphQLArgument,
GraphQLList,
GraphQLNonNull,
GraphQLInt,
GraphQLString,
Gra... | 2.265625 | 2 |
get_team_mapping.py | dhermes/ncaa-bracket-scenarios | 1 | 55011 | import base64
import json
import os
from BeautifulSoup import BeautifulSoup
import requests
import local_settings
import utils
NATIONAL_BRACKET = ('http://games.espn.com/tournament-challenge-bracket/'
'2017/en/entry?entryID=115703')
HTML_FILENAME = os.path.join(
local_settings.YEAR,
base... | 3.109375 | 3 |
advent_of_code/2020/day_20.py | Jordan-Kowal/challenges | 1 | 55012 | <reponame>Jordan-Kowal/challenges<gh_stars>1-10
"""Day 20 challenge"""
# Built-in
import re
from time import perf_counter
# Personal
from _shared import read_input
# --------------------------------------------------------------------------------
# > Helpers
# -------------------------------------------------------... | 2.765625 | 3 |
cvxpy/utilities/eigvals.py | QiuWJX/cvxpy | 556 | 55013 | <filename>cvxpy/utilities/eigvals.py
import numpy as np
import scipy.sparse as spar
import scipy.sparse.linalg as sparla
def is_psd_within_tol(A, tol):
"""
Return True if we can certify that A is PSD (up to tolerance "tol").
First we check if A is PSD according to the Gershgorin Circle Theorem.
If G... | 2.359375 | 2 |
views/catalogue.py | KBA07/stylor-web-backend | 0 | 55014 | import csv
from flask import (
Blueprint, flash, redirect, render_template, request, url_for
)
bp = Blueprint('catalogue', __name__)
@bp.route('/getCategories', methods=['GET'])
def index():
# Returns all the categories present in excel sheet
if request.method == 'POST':
return "the method is pos... | 2.59375 | 3 |
strawberry_django/legacy/hooks.py | NeoLight1010/strawberry-graphql-django | 18 | 55015 | from ..hooks import *
| 1.195313 | 1 |
scheduler/templatetags/custom_filters.py | MarynaSavchenko/zielbruks | 0 | 55016 | <reponame>MarynaSavchenko/zielbruks
"""module for custom template tags"""
from django import template
register = template.Library()
@register.simple_tag
def get_color_tag(counter):
"""returns color tag based on parity of the counter"""
if counter % 2 == 0:
return 'warning'
return 'info'
@regist... | 2.515625 | 3 |
2021/17/solution.py | Artemigos/advent-of-code | 0 | 55017 | target_x = range(211, 233)
target_y = range(-124, -68)
# part 1 and 2
x_hits = []
infinite_x_hits = []
for vx in range(1, target_x.stop):
pos = 0
i = 0
while pos < target_x.stop and vx > i:
pos += vx - i
i += 1
if pos in target_x:
x_hits.append((vx, i))
if vx == i a... | 2.75 | 3 |
Jogo_da_velha/model/agenteInteligente/Inteligencia.py | Lucas-Dinelli/Projeto_Como_As_Maquinas_Aprendem | 0 | 55018 | class Inteligencia:
def __init__(self, nomeArquivoIA, arquivosExternos, ambientes,
entradas, todosTiposJogadores, preJogos):
self.INomeArquivoIA = nomeArquivoIA
self.IArquivosExternos = arquivosExternos
self.IAmbientes = ambientes
self.IEntradas = entradas
se... | 3.046875 | 3 |
db/views.py | TelferLab/mofdb-web | 1 | 55019 | <filename>db/views.py<gh_stars>1-10
from django.shortcuts import render
from django.views.generic import FormView, ListView, DetailView
from db.models import Reaction
from db.models import ChemicalCompound
from db.models import Ligand
from db.models import Mof
from db.serializers import ChemicalCompoundSerializer
from ... | 1.992188 | 2 |
problem5.py | andersontenorio/projecteuler | 0 | 55020 | <filename>problem5.py
n = 0
factor = 20
while True:
n = n + factor
is_divisible = True
for i in range(1, factor + 1):
if n % i != 0:
is_divisible = False
break
if (is_divisible):
break
print(n)
| 3.765625 | 4 |
templex/core.py | crdoconnor/templex | 0 | 55021 | # -*- coding: utf-8 -*-
from copy import copy
from re import compile, escape
from templex.exceptions import KeyNotFound, MustUseString
import difflib
import sys
if sys.version_info[0] == 3:
unicode = str
def escape_to_regex(text):
escaped = r""
for character in text:
if character == r" ":
... | 2.796875 | 3 |
product_filter/urls.py | shahinvx/ecom_micro | 0 | 55022 | from django.contrib import admin
from django.urls import path
from django.urls.conf import include
from product_filter.views import *
urlpatterns = [
path('home/', Home.as_view(), name='home'),
path('login/', Login.as_view(), name='Log-In'),
path('register/', Register.as_view(), name='User-Regist... | 1.625 | 2 |
cadastro.py | Andreambu23/Cadastro-de-Produtos-main | 0 | 55023 | import mysql.connector
from asyncore import read
from PyQt5 import uic
from PyQt5 import QtWidgets
from numpy import save
from reportlab.pdfgen import canvas
c = 0
# Conectando com o banco de dados
con = mysql.connector.connect(
host='localhost', database='cadastro_estoque', user='andre2', password='<PASSWORD>')... | 2.53125 | 3 |
static/QA_annotations/MostCommonAnswer.py | CCYChongyanChen/VizWizVQAGroundingCrowdSourcing | 0 | 55024 | import json
import os
import sys
import re
import numpy as np
from Preprocess import processed_answer
from subquestions import filter_Questions
def most_frequent(List):
counter = 4
num = None
for i in List:
curr_frequency = List.count(i)
if(curr_frequency> counter):
... | 2.8125 | 3 |
jsuarez/extra/embyr_deprecated/embyr/tests/loaders/test_objloader.py | jarbus/neural-mmo | 1,450 | 55025 | import unittest
from kivy3.loaders import OBJLoader
class OBJLoaderTest(unittest.TestCase):
pass
if __name__ == '__main__':
unittest.main()
| 1.4375 | 1 |
main.py | Retaehc-pop/Retaehc_bot | 0 | 55026 | <reponame>Retaehc-pop/Retaehc_bot
import os
from discord.ext import commands
import discord
from settings import *
import asyncio
from datetime import datetime
intents = discord.Intents.all()
intents.members = True
bot = commands.Bot(command_prefix=".", intents=intents)
role_dict = {}
@bot.event
async ... | 2.609375 | 3 |
babytracker/events/models.py | graupv/BabyTracker | 0 | 55027 | <reponame>graupv/BabyTracker<filename>babytracker/events/models.py
from django.db import models
from django.utils.timezone import now
class Event(models.Model):
datetime = models.DateTimeField(default = now)
description = models.CharField(max_length = 200, null = False)
baby = models.ForeignKey(
'b... | 2.21875 | 2 |
zerotask/worker.py | Alex-CodeLab/zerotask | 1 | 55028 | import ast
import json
import os
import signal
import sys
import zmq
from tasks import *
context = zmq.Context()
receiver = context.socket(zmq.PULL)
receiver.bind('tcp://127.0.0.1:5588')
# Socket to send messages to
sender = context.socket(zmq.PUSH)
sender.connect("tcp://127.0.0.1:5589")
# todo: clean kill- wait unt... | 2.21875 | 2 |
bin/test-for-SL-behavior.py | SBULeeLab/LinguaFranca-FSE19 | 2 | 55029 | #!/usr/bin/env python3
# Test libLF.Regex's for SL behavior using the vuln-regex-detector suite.
# This analysis can run single-node many-core.
# Import libLF
import os
import sys
import re
sys.path.append(os.path.join(os.environ['ECOSYSTEM_REGEXP_PROJECT_ROOT'], 'lib'))
import libLF
import json
import tempfile
impor... | 2.171875 | 2 |
src/models/utils.py | whs2k/vasegen | 0 | 55030 | import random
import glob
import torch
from torch import nn
import numpy as np
from torch.nn import init
import torch.optim as optim
import torch.nn.functional as F
from torch.nn import Parameter as P
from torchvision import transforms, set_image_backend
# set_image_backend('accimage')
from models.pytorch_biggan.dat... | 2.265625 | 2 |
chat_users/admin.py | ravikiranb36/chat-app | 0 | 55031 | from django.contrib import admin
from chat_users.models import ChatUser
# Register your models here.
admin.site.register(ChatUser) | 1.351563 | 1 |
Chapter 8/08/PaxHeader/recipe64_playback.py | robert0714/Python-Testing-Cookbook-Second-Edition | 0 | 55032 | <filename>Chapter 8/08/PaxHeader/recipe64_playback.py<gh_stars>0
15 uid=2057284
20 ctime=1296423455
20 atime=1296425170
24 SCHILY.dev=234881026
23 SCHILY.ino=30630412
18 SCHILY.nlink=1
| 1.09375 | 1 |
tests/test_web_scraper.py | meobilivang/newsreader-cli | 5 | 55033 | import pytest
from newsreadercli import NewsScraper
from newsreadercli import Article
def test_web_scraper():
scraper = NewsScraper()
test_page = open("tests/test_data/vnexpress-test.html", 'r', encoding='utf-8')
scraper.page_scrape(None, test_page.read())
for article in scraper.articles_cu... | 2.609375 | 3 |
test/test_server.py | mgrrx/aioros | 8 | 55034 | #!/usr/bin/python3
import aioros
from rospy_tutorials.srv import AddTwoInts
from rospy_tutorials.srv import AddTwoIntsResponse
async def setup(nh: aioros.NodeHandle):
await nh.create_service(
'add_two_ints',
AddTwoInts,
lambda request: AddTwoIntsResponse(request.a + request.b))
if __na... | 2.140625 | 2 |
venv/Lib/site-packages/tests/test_312_CacheBoundParameters.py | shehzadulislam/Assignment4 | 0 | 55035 | #
# Licensed Materials - Property of IBM
#
# (c) Copyright IBM Corp. 2016
#
import unittest, sys
import ibm_db
import config
from testfunctions import IbmDbTestFunctions
class Wrapper(str):
def __del__(self):
print("Wrapper(" + self + ") being deleted")
class IbmDbTestCase(unittest.TestCase):
def test_31... | 2.1875 | 2 |
DRL_py/ppo.py | darshan315/flow_past_cylender_by_DRL | 16 | 55036 | <reponame>darshan315/flow_past_cylender_by_DRL
"""
This file has function containg main PPO algorithm
called in : main.py
"""
import time
from reply_buffer import *
from eval_score_and_trace_update import *
def train_model(value_model,
policy_model,
env,
poli... | 2.0625 | 2 |
utils/__init__.py | lmartak/amt-wavenet | 9 | 55037 | from .filesystem import find_files
from .piano_roll import (roll_encode, roll_decode, get_roll_index,
roll_subsample)
from .metrics import calc_stats, calc_metrics, metrics_empty_dict
from .loggers import write_metrics, write_images, write_audio
from .renderers import (plot_eval, plot_estim, pl... | 1.171875 | 1 |
aura/AI Engineer/course2_20191117/a8_titanic/a1_raw_try_no_process.py | linksdl/futuretec-project-coursera_cerficates | 0 | 55038 | <reponame>linksdl/futuretec-project-coursera_cerficates
# -*- coding: utf-8 -*-
# 加载相关模块和库
import sys
import io
#改变标准输出的默认编码
sys.stdout=io.TextIOWrapper(sys.stdout.buffer,encoding='utf8')
import numpy as np
import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif']=['SimHei'] #用来正常显示中文标签
plt.rcParams['axes.unicode... | 3.109375 | 3 |
tests/test_ccsa_utils.py | xingyizhou/mseg-semantic | 1 | 55039 | #!/usr/bin/python3
import math
import numpy as np
import pdb
import time
import torch
from mseg_semantic.domain_generalization.ccsa_utils import (
contrastive_loss,
paired_euclidean_distance,
downsample_label_map,
sample_pair_indices,
find_matching_pairs,
remove_pairs_from_same_domain,
get_merged_pair_embeddi... | 2.15625 | 2 |
source/code_decode.py | IskatelApelsinov/PasswordManager-Sneaky-Pass | 0 | 55040 | <filename>source/code_decode.py
import hashlib
import os
class Cripta(object):
def __init__(self):
#mchs_project
super(Cripta, self).__init__()
def shifr_salt(self, passwd):
# Add a user
salt = ''
# for letter in username:
# salt += str(ord(l... | 2.953125 | 3 |
pyis/__init__.py | BlackIQ/pyis | 13 | 55041 | from pyis.pyis import *
| 1.117188 | 1 |
f5_openstack_agent/lbaasv2/drivers/bigip/lbaas_builder.py | sapcc/f5-openstack-agent | 0 | 55042 | # coding=utf-8
# Copyright 2014-2017 F5 Networks Inc.
#
# 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... | 1.523438 | 2 |
core/tasks.py | mark-barrett/RESTBroker | 0 | 55043 | <gh_stars>0
# Developed by <NAME>
# http://markbarrettdesign.com
# https://github.com/mark-barrett
from __future__ import absolute_import, unicode_literals
import os
import django
from celery import Celery
from django.core.mail import get_connection, send_mail
from django.template import loader
os.environ.setdefault... | 1.960938 | 2 |
python_utility/spreadsheet/spreadsheet_service.py | FunTimeCoding/python-utility | 0 | 55044 | import cherrypy
from gspread import CellNotFound
from python_utility.spreadsheet.simple_spreadsheet import SimpleSpreadsheet
class SpreadsheetService:
@staticmethod
def read_status() -> str:
try:
from python_utility.build import Build
except ImportError:
# TODO: Unders... | 2.265625 | 2 |
src/modeling/models/neural_net/test.py | NovaSBE-DSKC/predict-campaing-sucess-rate | 0 | 55045 | from src.modeling import util
import numpy as np
from dskc import dskc_modeling
def test(model):
x_test, y_test, _ = util.read_test_data()
# predict
y_pred = model.predict(x_test)
# clean
y_pred = np.asarray([x[0] for x in y_pred])
# evaluate
report = dskc_modeling.EvaluationReport(y_te... | 2.765625 | 3 |
ui/game/frame_libraries.py | RCIX/RogueP | 2 | 55046 | # added specifically to make floating point division apply to code in bar position calculation
from __future__ import division
import libtcodpy as libtcod
import xp_loader
import gzip
from vec2d import Vec2d
from model.attribute import AttributeTag
from ui.frame import Frame
from ui.ui_event import UIEvent, UIEventT... | 2.09375 | 2 |
ticket/models/ticket.py | ifbhack/ticketsystem | 0 | 55047 | import sqlite3
from typing import List, Iterable, Any
from ticket.models.user import User
# TODO: when we have a couple more errors, put in seperate file
class UserAssignViolationError(Exception):
pass
class TicketNotFoundError(Exception):
pass
class Ticket:
ticket_id: int= 0
user_id: int = 0
tit... | 3.09375 | 3 |
eppy/utils.py | infonetworks-global/eppy | 22 | 55048 | from random import choice
TRID_CSET = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
def gen_trid(length=12):
return ''.join(choice(TRID_CSET) for _i in range(length))
| 2.4375 | 2 |
test/azure/Expected/AcceptanceTests/CustomPollerPagerDefinitions/custompollerpagerdefinitions/aio/__init__.py | qwordy/autorest.python | 35 | 55049 | <reponame>qwordy/autorest.python
from azure.core.paging import ReturnType
from azure.core.async_paging import AsyncItemPaged
from azure.core.polling import AsyncLROPoller
from azure.core.polling._poller import PollingReturnType
class AsyncCustomPager(AsyncItemPaged[ReturnType]):
pass
class AsyncCustomPoller(Asy... | 1.96875 | 2 |
train-cats.py | adamklein/keras-yolo3 | 0 | 55050 | """
Derived from keras-yolo3 train.py (https://github.com/qqwweee/keras-yolo3),
with additions from https://github.com/AntonMu/TrainYourOwnYOLO.
"""
import os
import sys
import argparse
import pickle
import numpy as np
import keras.backend as K
from keras.layers import Input, Lambda
from keras.models import Model
fr... | 2.171875 | 2 |
src/global_model_eval_non_tensor.py | Madscba/02460_federated_learning | 0 | 55051 | <gh_stars>0
from torch.utils.data import DataLoader
from client_dataset import FemnistDataset
import torchvision.transforms as transforms
import torch
from model import Net, mlr
from collections import OrderedDict
import os
from tqdm import tqdm
from main_utils import set_seed
import time
import json
import numpy as np... | 2.21875 | 2 |
coding/unique_paths/starter.py | alexanderywang/tech-interview-questions | 0 | 55052 | <filename>coding/unique_paths/starter.py
class Solution:
def distinctPaths(self, m: int, n: int) -> int:
| 2.203125 | 2 |
inventory.py | ecanuto/inventory.py | 0 | 55053 | #!/usr/bin/env python3
#
# 2020 February 15 - <NAME>
#
# I dedicate any and all copyright interest in this software to the
# public domain. I make this dedication for the benefit of the public at
# large and to the detriment of my heirs and successors. I intend this
# dedication to be an overt act of relinquishmen... | 2.5 | 2 |
app/case/urls.py | Allen-lang/FXTest | 1 | 55054 | """
@author: lileilei
@file: urls.py
@time: 2018/1/31 13:20
"""
from app.case.views import *
from app.case import case
case.add_url_rule('/addtestcase',view_func=AddtestcaseView.as_view('addtestcase'))
case.add_url_rule('/edit_case/<int:id>',view_func=EditcaseView.as_view('edit_case'))
case.add_url_rule('/d... | 2.0625 | 2 |
build_scripts/tests_runner.py | AlexanderSlav/infrastructure | 0 | 55055 | <reponame>AlexanderSlav/infrastructure
# Copyright (c) 2019 Intel Corporation
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# ... | 1.609375 | 2 |
safeness/glad/logger.py | pasmod/obfuscation-pan2016 | 2 | 55056 | <reponame>pasmod/obfuscation-pan2016
import logging
def setup_logging(level):
"""
:param level: logging.INFO or logging.DEBUG, etc.
"""
logging.basicConfig(level=level, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s")
return logging.getLogger(__name__)
# get logger
log = setup_logg... | 2.203125 | 2 |
src/parser.py | Magalii/RulesConnectionsVerification | 0 | 55057 | import pandas as pd
import csv
import numpy as np
def parse_val(val):
'''Parse string value and change it to appropriate type to be manipulated by RuleSet functions
Accepted formats: "false" and "true" case insensitive, 'nan', '', "*", string representation of pandas.Interval
'''
if val == '' or va... | 3.890625 | 4 |
delta/task/horizontal.py | delta-mpc/delta-task | 2 | 55058 | <filename>delta/task/horizontal.py
import json
import logging
from abc import abstractmethod
from tempfile import TemporaryFile
from typing import Any, Dict, Iterable, List, Tuple, Union
import numpy as np
import torch
from delta import serialize
from delta.algorithm.horizontal import DefaultAlgorithm, HorizontalAlgor... | 2.34375 | 2 |
python/p043.py | lbreede/project-euler | 0 | 55059 | <filename>python/p043.py
# Sub-string divisibility
from itertools import permutations
def sub_string(num, start, rng):
start -= 1
end = start + rng
# strnum = str(num)
return int(num[start:end])
def check_properties(num):
p1 = sub_string(num, 2, 3) % 2 == 0
p2 = sub_string(num, 3, 3) % 3 == 0
p3 = sub_strin... | 3.828125 | 4 |
django_project/spa/urls.py | aliyaandabekova/DJANGO_PROJECT | 0 | 55060 | from django.urls import path
from .views import *
urlpatterns = [
path('',homepage,name='home'),
path('services/',services, name='services'),
path('masters/',masters, name='masters'),
path('register/',register_page,name='register'),
path('login/',login_page, name='login'),
path('master_detail/<... | 1.765625 | 2 |
AutotestWebD/apps/myadmin/service/TeamPermissionRelationService.py | yangjourney/sosotest | 422 | 55061 | <filename>AutotestWebD/apps/myadmin/service/TeamPermissionRelationService.py
from all_models.models import TbAdminTeamPermissionRelation
class TeamPermissionRelationService(object):
@staticmethod
def updateTeamPermission(teamPermissionData):
tbModel = TbAdminTeamPermissionRelation.objects.filter(id=te... | 1.851563 | 2 |
gitback.py | jhmuller/py-backup | 0 | 55062 | <filename>gitback.py
#!/usr/bin/env python
import os
import sys
import datetime
import time
import inspect
import warnings
import traceback
import hashlib
import zlib
import zipfile
import pickle
import shutil
import re
import logging
import subprocess
from collections import OrderedDict
from collections import namedt... | 2.265625 | 2 |
nebulae/fuel/comburant_pt.py | SeriaZheng/Nebulae | 2 | 55063 | #!/usr/bin/env python
'''
Created by Seria at 02/11/2018 3:38 PM
Email: <EMAIL>
_ooOoo_
o888888888o
o88`_ . _`88o
(| 0 0 |)
O \ 。 / O
_____/`-----‘\_____
.’ \|| _ _ ||/ `.
| _ |... | 1.8125 | 2 |
madpy/tests/test_checks.py | seismomomo/madpy | 1 | 55064 | import obspy
import unittest
import numpy as np
import madpy.checks as ch
import madpy.tests.testdata.config as cfg
class TestChecks(unittest.TestCase):
def test_check_config(self):
class Measurements: pass
self.assertRaises(AttributeError, ch.check_config, Measurements())
... | 2.453125 | 2 |
pytorch_YOLOv4/demo.py | OwlTing/AI_basketball_games_video_editor | 49 | 55065 | <reponame>OwlTing/AI_basketball_games_video_editor
# Notice
# To modify the source code for AI_basketball_games_video_editor project:
# 1. Add class Yolov4DarknetEngine for object detection
# -*- coding: utf-8 -*-
'''
@Time : 20/04/25 15:49
@Author : huguanghao
@File : demo.py
@Noice :... | 2.421875 | 2 |
tests/python/test_delay_modify.py | gaoxinge/taichi | 1 | 55066 | import taichi as ti
from tests import test_utils
@test_utils.test()
def test_simplify_bug():
@ti.kernel
def foo() -> ti.types.vector(4, dtype=ti.i32):
a = ti.Vector([0, 0, 0, 0])
for i in range(5):
for k in ti.static(range(4)):
if i == 3:
a[k] = ... | 2.328125 | 2 |
vrmslearn/ModelGenerator.py | GeoCode-polymtl/Deep_1D_velocity | 7 | 55067 | <filename>vrmslearn/ModelGenerator.py<gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Class to generate seismic models and labels for training.
"""
import numpy as np
import copy
from scipy.signal import gaussian
from scipy.interpolate import interp1d
import argparse
from vrmslearn.ModelParameters... | 3.171875 | 3 |
model_zoo/YoloFastestV2/model/detector.py | willschang/YoloAll | 1 | 55068 | import torch
import torch.nn as nn
from model.fpn import *
from model.backbone.shufflenetv2 import *
class Detector(nn.Module):
def __init__(self, classes, anchor_num, load_param):
super(Detector, self).__init__()
out_depth = 72
stage_out_channels = [-1, 24, 48, 96, 192]
self.back... | 2.28125 | 2 |
misc/solver_utils.py | affromero/SMILE | 20 | 55069 | <gh_stars>10-100
import torch
import os
from misc.utils import to_cuda, to_data
from misc.utils import single_source
from misc.utils import create_arrow, create_circle, denorm
from misc.utils import color_frame, human_format, compress_image
from torchvision.utils import save_image
from glob import glob
from misc.ops im... | 2.296875 | 2 |
test_src/Pages/RegPage.py | BJanos87/Vizsgaremek-conduit-app | 0 | 55070 | from test_src.Pages.base_commands import BaseCommands
from test_src.Data.test_data import RegPgWebElements
from test_src.Data.test_data import TestData
class RegPage(BaseCommands):
"""constructor of the page class"""
def __init__(self, driver):
super().__init__(driver)
"""Page Actions for Regist... | 2.34375 | 2 |
09/test_circle.py | euribates/advent_of_code_2018 | 0 | 55071 | #!/usr/bin/env python3
import pytest
from tools import play
samples = [
(9, 25, 32),
(10, 1618, 8317),
(13, 7999, 146373),
(17, 1104, 2764),
(21, 6111, 54718),
(30, 5807, 37305),
]
def ids(t):
return '{} players {} points max. score {}'.format(*t)
@pytest.fixture(params=samples, ... | 2.453125 | 2 |
scripts/user_guide/testing_kfoldcv.py | kliegr/pyIDS | 1 | 55072 | from sklearn.metrics import roc_auc_score, f1_score, accuracy_score
import scipy
import numpy as np
import pandas as pd
from pyarc.qcba import *
from pyarc.algorithms import createCARs, top_rules
from pyarc import TransactionDB
from pyids import IDS
from pyids.ids_cacher import IDSCacher
from pyids.ids_ruleset impo... | 2.09375 | 2 |
cpc_2016.py | megcrow/kinetic-schemes | 7 | 55073 | """
Plot gas, tar, char, water, and water vapor from primary and secondary
reactions based on Blasi / Chan / Liden kinetic schemes for biomass pyrolysis.
This combined scheme is referred to as the Cpc 2016 kinetic scheme. A similar
scheme but without water reaction was proposed in Papadikis 2010 paper.
References:
Bla... | 3.0625 | 3 |
codeforces/1302D.py | bartekpacia/python-training | 0 | 55074 | line = input().split(" ")
n = int(line[0]) # nodes
m = int(line[1]) # edges
graph = {}
def find_lowest_cost_node(costs, processed):
lowest_cost_node = None
lowest_cost = float("inf")
for node, cost in costs.items():
if cost < lowest_cost and node not in processed:
lowest_cost_node = ... | 3.8125 | 4 |
lengthOfLongestSubstring.py | saai/LeetcodePythonSolutions | 0 | 55075 | class Solution:
# @param {string} s
# @return {integer}
def lengthOfLongestSubstring(self, s):
n = len(s)
if n <=1:
return n
start = 0
max_count = 1
c_dict = {s[0]:0}
for p in range(1,n):
sub = s[start:p]
c = s[p]
... | 2.921875 | 3 |
basic-working/tests/templates/eos/test_bgppeer.py | 0xmc/hackathon81_configmodel | 2 | 55076 | <filename>basic-working/tests/templates/eos/test_bgppeer.py
"""BGP peer EOS template tests."""
import unittest
from configmodel.templates.render import render
class TestBGPPeer(unittest.TestCase):
"""BGP peer unit tests."""
def test_pass_a(self):
"""Local AS only."""
config = {"local_asn": ... | 2.84375 | 3 |
boucanpy/cli/db_truncate.py | bbhunter/boucanpy | 34 | 55077 | from pathlib import Path
from boucanpy.core import logger
from boucanpy.cli.base import BaseCommand
from boucanpy.db.models import models
class DbTruncate(BaseCommand):
name = "db-truncate"
aliases = ["truncate"]
description = "truncate db"
add_log_level = True
add_debug = True
@classmethod
... | 2.4375 | 2 |
various_models.py | georgetown-analytics/Trade-Imbalances | 1 | 55078 | <filename>various_models.py<gh_stars>1-10
myConnection = psycopg2.connect( host=host, user=user, password=password, dbname=dbname )
import pandas as pd
import numpy as np
from sklearn import preprocessing
import matplotlib.pyplot as plt
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection ... | 2.5 | 2 |
tests/test_vector_builder.py | David-Durst/fault | 0 | 55079 | import random
from bit_vector import BitVector
import fault
import common
from fault.actions import Poke, Expect, Eval, Step, Print
from fault.array import Array
from fault.vector_builder import VectorBuilder
def test_tester_basic():
circ = common.TestBasicCircuit
builder = VectorBuilder(circ)
builder.pro... | 2.28125 | 2 |
Tool_rename_walk/rename.py | yo1995/Daily_Python_Tasks | 14 | 55080 | import os
path = ''
if not path:
eixt(1)
for root, dirs, files in os.walk(path):
for f in files:
if f == 'readme.md':
src = os.path.join(root, f)
# print(src)
dst = os.path.join(root, 'README.md')
os.rename(src, dst)
| 2.96875 | 3 |
notebooks/WM-811K/src/data_augmentation/program/augmentation.py | bobbruno/defect_detection | 2 | 55081 | <reponame>bobbruno/defect_detection
import numpy as np
import tarfile
import argparse
import logging
from pathlib import Path
from tensorflow.keras.models import load_model
def parse_arguments():
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument("--au... | 2.40625 | 2 |
src/pycondense/kernels/__init__.py | agonopol/py-condense | 1 | 55082 | <reponame>agonopol/py-condense
from pycondense.kernels.gaussian import gaussian
from pycondense.kernels.mgc import mgc | 1.1875 | 1 |
ftdnn/__init__.py | kwasnydam/Factorized-TDNN | 0 | 55083 | from .models import FTDNN, TDNN, DenseReLU, DenseSigmoid, DenseSoftmax, TDNNAgePaper, DenseLogits
__all__ = [
'FTDNN',
'DenseReLU',
'DenseSigmoid',
'DenseSoftmax',
'TDNN',
'TDNNAgePaper',
'DenseLogits'
] | 1.140625 | 1 |
db/mysqld.py | Proxymiity/Alter | 3 | 55084 | import mysql.connector
from utils.dataIO import dataIO
db_cfg = dataIO.load_json("data/mysql.config.json")
db = mysql.connector.connect(host=db_cfg["host"], autocommit=True,
user=db_cfg["user"], password=db_cfg["pass"], database=db_cfg["db"])
dbc = db.cursor()
def sanitize(val):
retu... | 2.65625 | 3 |
homie/device_base.py | dresber/HomieV3 | 4 | 55085 | <reponame>dresber/HomieV3<filename>homie/device_base.py<gh_stars>1-10
#!/usr/bin/env python
import sys
import time
import homie
from homie.support.helpers import validate_id
from homie.mqtt.homie_mqtt_client import connect_mqtt_client
from homie.support.repeating_timer import Repeating_Timer
import logging
logger =... | 1.8125 | 2 |
accounts/migrations/0025_socialmedia_order.py | Revibe-Music/core-services | 2 | 55086 | # Generated by Django 3.0 on 2020-04-02 13:22
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0024_auto_20200330_1441'),
]
operations = [
migrations.AddField(
model_name='socialmedia',
name='order',
... | 1.765625 | 2 |
src/behavior_tree/subtrees/Grnd2Blackboard.py | rirolab/behavior_tree | 0 | 55087 | <reponame>rirolab/behavior_tree<filename>src/behavior_tree/subtrees/Grnd2Blackboard.py
import py_trees
import rospy
import json
import std_msgs.msg as std_msgs
from py_trees_ros import subscribers
class ToBlackboard(subscribers.ToBlackboard):
def __init__(self, name, topic_name="symbol_grounding"):
super... | 2.125 | 2 |
application/database/domain/user.py | shivankurkapoor/moleculardating | 1 | 55088 | <filename>application/database/domain/user.py
from peewee import *
from database import *
class User(Model):
user_id = CharField(primary_key=True)
family_name = TextField(default='')
given_name = TextField(default='')
email = TextField(default='')
gender = CharField(default='')
link = TextFie... | 2.890625 | 3 |
serveGPS.py | smk762/Dragonhound | 3 | 55089 | <filename>serveGPS.py
#!/usr/bin/env python3
import cherrypy
from cherrypy.lib import auth_digest
import sys
import os
import json
import getconf
import colorTable
import enc
from datetime import datetime
USERS = {'smk762': 'Nighteyes'}
HOME = os.environ['HOME']
CONFIGDIR = str(HOME+'/.Dragonhound/')
HTMLDIR = str(HOM... | 2.5625 | 3 |
python/ops/ops_pred_08_1.py | jasarsoft/examples | 0 | 55090 | <reponame>jasarsoft/examples<filename>python/ops/ops_pred_08_1.py
broj = -1
while broj != 0:
print("Trenutni broj je " + str(broj))
broj = int(intpu("Unesite novi broj: "))
print("Kraj")
| 2.53125 | 3 |
blocks_fuel_classes.py | heikeadel/attention_methods | 1 | 55091 | #!/usr/bin/python
#####
# Description: Blocks Extensions and Fuel classes
# Author: <NAME>
# Date: 2016
#####
from blocks.extensions import SimpleExtension
import time
import theano
import numpy
from fuel.schemes import BatchScheme
from picklable_itertools import imap
from picklable_itertools.extras import partition... | 2.234375 | 2 |
Scopes/Globalscope.py | prathimacode-hub/PythonScripts | 5 | 55092 |
name="Ashwin"
def student():
print("Name",name) #accessing in def also
student()
if name[0]=="A": #accessing in global
print("Starts from A")
x = 300
def myfunc():
global x
x = 200
print(x)
myfunc()
print(x) | 3.515625 | 4 |
src/eval.py | kredde/pytorch-lightning-hydra-mlflow | 13 | 55093 | <filename>src/eval.py<gh_stars>10-100
import logging
from typing import Optional
from pytorch_lightning import LightningModule, LightningDataModule, Trainer
from pytorch_lightning import seed_everything
from omegaconf import DictConfig
from src.utils import config_utils
log = logging.getLogger(__name__)
def eval... | 2.65625 | 3 |
Tutorial6AddCertificates/ecus/impl_ecu_myprotocol.py | arturmrowca/IVNS | 0 | 55094 | from components.base.ecu.types.impl_ecu_simple import SimpleECU
from components.base.ecu.software.ecu_software import ECUSoftware
from components.security.ecu.software.impl_app_layer_secure import SecureApplicationLayer
from layers.impl_comm_module_my_protocol import MyProtocolCommModule
class MyProtocolECU(SimpleECU)... | 2.84375 | 3 |
molecular_computation/enzymes/primer.py | shakedmanes/molecular-computation | 0 | 55095 | from molecules.dna_sequence import DNASequence
class Primer:
"""
Represent a Primer DNA Sequence which can be attached to DNA sequence in order to mark specific
segment in the DNA sequence.
"""
def __init__(self, searched_sequence):
"""
Initialize Primer sequence.
:param ... | 3.5625 | 4 |
alphapose/version.py | RyosukeHori/AlphaPose | 0 | 55096 | # GENERATED VERSION FILE
# TIME: Fri Sep 11 18:59:53 2020
__version__ = '0.3.0+038435e'
short_version = '0.3.0'
| 0.914063 | 1 |
udiskie/mount.py | LocutusOfBorg/udiskie | 0 | 55097 | <gh_stars>0
"""
Mount utilities.
"""
from __future__ import absolute_import
from __future__ import unicode_literals
from collections import namedtuple
from functools import partial
import logging
from .async_ import AsyncList, Coroutine, Return
from .common import wraps, setdefault, exc_message
from .compat import b... | 2.109375 | 2 |
rail/core/types.py | yanzastro/RAIL | 0 | 55098 | <filename>rail/core/types.py
""" Data types for RAIL File Input/Output """
#from rail.core.data import DataFile
#class TextFile(DataFile):
# """
# A data file in plain text format.
# """
# suffix = "txt"
# format = "http://edamontology.org/format_2330"
#@classmethod
#def read(cls, path):
... | 2.953125 | 3 |
fermipy/diffuse/gt_coadd_split.py | damgreen/fermipy | 42 | 55099 | #!/usr/bin/env python
#
"""
Prepare data for diffuse all-sky analysis
"""
import os
import copy
from collections import OrderedDict
import yaml
from fermipy.jobs.utils import is_null
from fermipy.jobs.link import Link
from fermipy.jobs.chain import Chain
from fermipy.jobs.scatter_gather import ScatterGather
from fe... | 2.3125 | 2 |