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 |
|---|---|---|---|---|---|---|
test2/test2.py | kubatom/my_nemtiko_repo | 0 | 7100 | print('this is a test2 file')
| 0.96875 | 1 |
Source/Git/Experiments/git_annotate.py | cadappl/scm-workbench | 24 | 7101 | <reponame>cadappl/scm-workbench
#!/usr/bin/python3
import sys
import git
r = git.Repo( sys.argv[1] )
num = 0
for info in r.blame( 'HEAD', sys.argv[2] ):
num += 1
commit = info[0]
all_lines = info[1]
print( '%s %6d:%s' % (commit, num, all_lines[0]) )
for line in all_lines[1:]:
num += 1
... | 2.34375 | 2 |
configs/global_configs.py | HansikaPH/time-series-forecasting | 67 | 7102 | <gh_stars>10-100
# configs for the model training
class model_training_configs:
VALIDATION_ERRORS_DIRECTORY = 'results/validation_errors/'
INFO_FREQ = 1
# configs for the model testing
class model_testing_configs:
RNN_FORECASTS_DIRECTORY = 'results/rnn_forecasts/'
RNN_ERRORS_DIRECTORY = 'results/errors... | 1.398438 | 1 |
openprocurement/blade/tests/auctions.py | imaginal/openprocurement.blade | 0 | 7103 | # -*- coding: utf-8 -*-
import unittest
from uuid import uuid4
from copy import deepcopy
from openprocurement.api.models import get_now
from openprocurement.edge.tests.base import AuctionBaseWebTest, test_award, test_auction_data, test_document, ROUTE_PREFIX
try:
import openprocurement.auctions.core as auctions_co... | 2.328125 | 2 |
webium/controls/select.py | kejkz/webium | 152 | 7104 | from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.remote.webelement import WebElement
class Select(WebElement):
"""
Implements logic to work with Web List UI elements
"""
@property
def is_multiple(self):
value = self.get_attribute('multiple')
re... | 3.1875 | 3 |
mc/cookies/CookieManager.py | zy-sunshine/falkon-pyqt5 | 1 | 7105 | <filename>mc/cookies/CookieManager.py
from PyQt5.QtWidgets import QDialog
from PyQt5 import uic
from PyQt5.Qt import Qt
from PyQt5.Qt import QShortcut
from PyQt5.Qt import QKeySequence
from PyQt5.QtWidgets import QMessageBox
from PyQt5.QtWidgets import QInputDialog
from PyQt5.Qt import QDateTime
from PyQt5.Qt import QS... | 2.15625 | 2 |
.circleci/process_submitted_data.py | dongbohu/cimr-d | 0 | 7106 | #!/usr/bin/env python3
import os
import sys
import logging
import subprocess
logging.basicConfig(level=logging.INFO)
root_dir = 'submitted_data'
submitted_file_split = set()
for dir_, _, files in os.walk(root_dir):
for file_name in files:
rel_dir = os.path.relpath(dir_, root_dir)
rel_file = os... | 2.171875 | 2 |
common/enums.py | resourceidea/resourceideaapi | 1 | 7107 | import enum
class Status(enum.Enum):
"""Status enumeration."""
ACTIVE = 'ACTIVE'
DISABLED = 'DISABLED'
ARCHIVED = 'ARCHIVED'
DELETED = 'DELETED'
class ProgressStatus(enum.Enum):
"""Enumeration indicates the different
stages of the progress made on an engagement,
job or ... | 3.09375 | 3 |
networks/mobilenet.py | softsys4ai/FlexiBO | 8 | 7108 | # Copyright 2019 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 by applicable law or agreed to in writing, ... | 2.46875 | 2 |
info.py | altfool/mri_face_detection | 1 | 7109 | import numpy as np
img_dtype = np.float32
imgX, imgY, imgZ = (256, 256, 150)
imgs_path_withfaces = '../dataset/withfaces'
imgs_path_nofaces = '../dataset/nofaces'
imgX_dwt1, imgY_dwt1, imgZ_dwt1 = (128, 128, 75)
imgs_path_withfaces_dwt = './dataset/withfaces'
imgs_path_nofaces_dwt = './dataset/nofaces'
dwt_flag = (... | 2.015625 | 2 |
biggan/paddorch/paddorch/vision/functional.py | zzz2010/Contrib | 20 | 7110 | <filename>biggan/paddorch/paddorch/vision/functional.py<gh_stars>10-100
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ... | 2.875 | 3 |
ground_battle.py | ashhansen6/minigames | 0 | 7111 | # -*- coding: utf-8 -*-
"""
Created on Fri Jan 29 13:38:35 2021
GROUND INVASION! The Game
@author: <NAME> (<EMAIL>)
"""
# Packages used:
import numpy as np
import pandas as pd
import random as rng
from termcolor import colored
# Defining starting forces
## Defenders:
def_force = 1250
def_reserves = ... | 3.375 | 3 |
src/pretalx/orga/urls.py | martinheidegger/pretalx | 0 | 7112 | <filename>src/pretalx/orga/urls.py
from django.conf.urls import include, url
from django.views.generic.base import RedirectView
from pretalx.event.models.event import SLUG_CHARS
from pretalx.orga.views import cards
from .views import (
admin,
auth,
cfp,
dashboard,
event,
mails,
organiser,
... | 1.84375 | 2 |
ws2122-lspm/Lib/site-packages/pm4py/statistics/overlap/utils/compute.py | Malekhy/ws2122-lspm | 1 | 7113 | <reponame>Malekhy/ws2122-lspm
'''
This file is part of PM4Py (More Info: https://pm4py.fit.fraunhofer.de).
PM4Py is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or... | 2.421875 | 2 |
webapp/apps/Base Quiz/baseui_gen.py | sk-Prime/webapp | 4 | 7114 | <filename>webapp/apps/Base Quiz/baseui_gen.py
from htmlman import HTMLMan
from styleman import Template
page=HTMLMan()
page.make_responsive()
page.add_title("Base Quiz")
style=Template('antartica')
page.add_body_class(style['page'])
page.add_js("baseui.js")
page.create_section('main',append=True)
page['main'].add_sty... | 2.59375 | 3 |
cluster_config/cluster.py | srcc-msu/job_statistics | 0 | 7115 | <gh_stars>0
name = "cluster"
num_cores = 1000
GENERAL_PARTITIONS = ["regular"]
GPU_PARTITIONS = ["gpu"]
PARTITIONS = GENERAL_PARTITIONS + GPU_PARTITIONS
ACTIVE_JOB_STATES = ["RUNNING", "COMPLETING"]
FINISHED_JOB_STATES = ["COMPLETED", "NODE_FAIL", "TIMEOUT", "FAILED", "CANCELLED"]
JOB_STATES = ACTIVE_JOB_STATES + F... | 2.671875 | 3 |
room_assistance/indico_room_assistance/plugin.py | OmeGak/indico-plugins-cern | 4 | 7116 | # This file is part of the CERN Indico plugins.
# Copyright (C) 2014 - 2021 CERN
#
# The CERN Indico plugins are free software; you can redistribute
# them and/or modify them under the terms of the MIT License; see
# the LICENSE file for more details.
import dateutil.parser
import pytz
from flask import flash, request... | 1.71875 | 2 |
datamart/materializers/wikidata_spo_materializer.py | liangmuxin/datamart | 7 | 7117 | <gh_stars>1-10
from datamart.materializers.materializer_base import MaterializerBase
import os
import urllib.request
import sys
import csv
import copy
import json
from typing import List
from pprint import pprint
import re
import typing
from pandas import DataFrame
import traceback
class WikidataSPOMaterializer(Mate... | 2.65625 | 3 |
axelrod/load_data_.py | danilobellini/Axelrod | 0 | 7118 | <filename>axelrod/load_data_.py
from typing import Dict, List, Tuple
import pkg_resources
def load_file(filename: str, directory: str) -> List[List[str]]:
"""Loads a data file stored in the Axelrod library's data subdirectory,
likely for parameters for a strategy."""
path = "/".join((directory, filename)... | 3.09375 | 3 |
prescryptchain/api/views.py | genobank-io/CryptoVault | 3 | 7119 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
# REST
from rest_framework.viewsets import ViewSetMixin
from rest_framework import routers, serializers, viewsets
from rest_framework.authentication import SessionAuthentication, BasicAuthentication, TokenAuthentication
from rest_framework.permissions imp... | 1.992188 | 2 |
client/commands/incremental.py | stvreumi/pyre-check | 0 | 7120 | <reponame>stvreumi/pyre-check
# Copyright (c) 2016-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import atexit
import logging
import os
import subprocess
import sys
from typing import List
from .command import Clie... | 2.171875 | 2 |
main_random_policy.py | rish-raghu/Object-Goal-Navigation | 0 | 7121 | from collections import deque, defaultdict
import os
import sys
import logging
import time
import json
import gym
import torch.nn as nn
import torch
import numpy as np
import matplotlib.pyplot as plt
from model import RL_Policy, Semantic_Mapping
from utils.storage import GlobalRolloutStorage
from envs import make_vec_... | 2.03125 | 2 |
src/ITN/srmg/core/RiemannianRight.py | Yulv-git/Awesome-Ultrasound-Standard-Plane-Detection | 1 | 7122 | <filename>src/ITN/srmg/core/RiemannianRight.py
#!/usr/bin/env python
# coding=utf-8
'''
Author: <NAME> / Yulv
Email: <EMAIL>
Date: 2022-03-19 10:33:38
Motto: Entities should not be multiplied unnecessarily.
LastEditors: <NAME>
LastEditTime: 2022-03-23 00:52:55
FilePath: /Awesome-Ultrasound-Standard-Plane-Detection/src/... | 1.195313 | 1 |
v0449gRpc_pb2.py | StormDev87/VPH_bot_python | 1 | 7123 | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: v0449gRpc.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import message as _message
from go... | 1.140625 | 1 |
api/resources_portal/test/views/test_search_endpoint.py | AlexsLemonade/resources-portal | 0 | 7124 | import datetime
from django.core.management import call_command
from django.urls import reverse
from rest_framework import status
from rest_framework.test import APITestCase
from resources_portal.management.commands.populate_dev_database import populate_dev_database
from resources_portal.models import Material, Organ... | 2.1875 | 2 |
mindarmour/utils/logger.py | hboshnak/mindarmour | 139 | 7125 | # Copyright 2019 Huawei Technologies Co., Ltd
#
# 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 agreed to... | 2.171875 | 2 |
Python/Programming Basics/Simple Calculations/17. Daily Earnings.py | teodoramilcheva/softuni-software-engineering | 0 | 7126 | workdays = float(input())
daily_tips = float(input())
exchange_rate = float(input())
salary = workdays * daily_tips
annual_income = salary * 12 + salary * 2.5
net_income = annual_income - annual_income * 25 / 100
result = net_income / 365 * exchange_rate
print('%.2f' % result)
| 3.671875 | 4 |
bert_rerannker_eval.py | satya77/transformer_rankers | 0 | 7127 | <gh_stars>0
from transformer_rankers.trainers import transformer_trainer
from transformer_rankers.datasets import dataset, preprocess_scisumm_ranked
from transformer_rankers.eval import results_analyses_tools
from transformers import BertTokenizer, BertForSequenceClassification
from sacred.observers import FileStorage... | 2.078125 | 2 |
python/p21.py | tonyfg/project_euler | 0 | 7128 | <gh_stars>0
#Q: Evaluate the sum of all the amicable numbers under 10000.
#A: 31626
def divisor_sum(n):
return sum([i for i in xrange (1, n//2+1) if not n%i])
def sum_amicable(start, end):
sum = 0
for i in xrange(start, end):
tmp = divisor_sum(i)
if i == divisor_sum(tmp) and i != tmp:
... | 3.578125 | 4 |
check.py | Dysoncat/student-services-slas-chat-bot | 0 | 7129 | <filename>check.py
import long_responses as long
# Returns the probability of a message matching the responses that we have
def messageProb(userMessage, recognizedWords, isSingleResponse=False, requiredWords=[]):
messageCertainty = 0
hasRequiredWords = True
# Counts how many words are present in each pr... | 3.046875 | 3 |
image_predictor/utils.py | jdalzatec/streamlit-manizales-tech-talks | 2 | 7130 | <reponame>jdalzatec/streamlit-manizales-tech-talks<filename>image_predictor/utils.py<gh_stars>1-10
from io import StringIO
import numpy as np
from h5py import File
from keras.models import load_model as keras_load_model
from PIL import Image, ImageOps
def predict(image, model):
# Create the array of the right sh... | 3.15625 | 3 |
client/setup.py | emilywoods/docker-workshop | 1 | 7131 | <filename>client/setup.py<gh_stars>1-10
from setuptools import setup
setup(
name="workshop-client",
install_requires=["flask==1.1.1", "requests==2.22.0"],
python_requires=">=3.7",
classifiers=[
"Development Status :: 1 - Beta",
"License :: OSI Approved :: MIT License",
"Programm... | 1.382813 | 1 |
tests/facebook/models/test_photo.py | Socian-Ltd/python-facebook-1 | 2 | 7132 | <filename>tests/facebook/models/test_photo.py
import json
import unittest
import pyfacebook.models as models
class PhotoModelTest(unittest.TestCase):
BASE_PATH = "testdata/facebook/models/photos/"
with open(BASE_PATH + 'photo.json', 'rb') as f:
PHOTO_INFO = json.loads(f.read().decode('utf-8'))
... | 2.859375 | 3 |
airbyte-integrations/connectors/source-scaffold-source-python/source_scaffold_source_python/source.py | curanaj/airbyte-dbt-demo | 0 | 7133 | # MIT License
#
# Copyright (c) 2020 Airbyte
#
# 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
# to use, copy, modify, merge, publ... | 1.632813 | 2 |
alerter/src/monitorables/nodes/chainlink_node.py | SimplyVC/panic | 41 | 7134 | from datetime import datetime
from typing import Optional, Dict, List, Union
from schema import Schema, Or
from src.monitorables.nodes.node import Node
from src.utils.exceptions import InvalidDictSchemaException
class ChainlinkNode(Node):
def __init__(self, node_name: str, node_id: str, parent_id: str) -> None:... | 2.421875 | 2 |
experiments/vgg16/VGG16_utils.py | petrapoklukar/DCA | 2 | 7135 | import pickle
import numpy as np
import os
def _analyze_query_point_assignment(
query_data_dict: dict,
init_Rdata_dict: dict,
init_Edata_dict: dict,
num_R: int,
query_point_assignment_array: np.ndarray,
root: str,
n_points_to_copy=50,
):
"""
Analyzes and visualizes qDCA results.
... | 2.609375 | 3 |
back-end/RawFishSheep/app_cart/views.py | Coldarra/RawFishSheep | 0 | 7136 | <reponame>Coldarra/RawFishSheep
from .models import *
from decorator import *
from app_goods.views import getGoodsByID
# 查询当前用户所有的购物车信息
def getCartByUser(user_id=None):
if user_id == None:
raise ParamException()
return Cart.objects.filter(user_id=user_id)
def getSelectedCart(user_id=None):
if ... | 2.265625 | 2 |
extensions/catsum.py | johannesgiorgis/my-timewarrior-extensions | 0 | 7137 | #!/usr/bin/env python3
###############################################################################
#
# Category Summaries
#
#
###############################################################################
import datetime
import io
import json
import logging
import pprint
import sys
from typing import Dict, Any
... | 2.421875 | 2 |
resources/hotel.py | jnascimentocode/REST-API-COM-PYTHON-E-FLASK | 0 | 7138 | from typing import ParamSpecArgs
from flask_restful import Resource, reqparse
from models.hotel import HotelModel
from flask_jwt_extended import jwt_required
from models.site import SiteModel
from resources.filtros import *
import sqlite3
path_params = reqparse.RequestParser()
path_params.add_argument('cidade', type=s... | 2.484375 | 2 |
src/wormhole/__main__.py | dmgolembiowski/magic-wormhole | 2,801 | 7139 | from __future__ import absolute_import, print_function, unicode_literals
if __name__ == "__main__":
from .cli import cli
cli.wormhole()
else:
# raise ImportError('this module should not be imported')
pass
| 1.601563 | 2 |
testing/berge_equilibrium_cndp.py | Eliezer-Beczi/CNDP | 1 | 7140 | <reponame>Eliezer-Beczi/CNDP<filename>testing/berge_equilibrium_cndp.py
import networkx as nx
import utils.connectivity_metrics as connectivity_metric
from platypus import NSGAII, EpsMOEA, NSGAIII, EpsNSGAII, Problem, Dominance, Subset, TournamentSelector, \
HypervolumeFitnessEvaluator, Archive
import statistics
im... | 2.609375 | 3 |
policykit/django_db_logger/migrations/0002_initial.py | mashton/policyk | 78 | 7141 | # Generated by Django 3.2.2 on 2021-09-02 15:10
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('django_db_logger', '0001_initial'),
('policyengine', '0001_initial'),
]
operations = [
... | 1.539063 | 2 |
Charm/models/risk_functions.py | TanyaAdams1/Charm | 17 | 7142 | <filename>Charm/models/risk_functions.py
import numpy as np
from mcerp import *
from uncertainties.core import AffineScalarFunc
class RiskFunction(object):
def get_risk(self, bar, p):
""" Computes risk for perf array w.r.t. bar.
Args:
bar: reference performance bar.
perfs: ... | 2.515625 | 3 |
code/doubanUtils.py | verazuo/douban_crawler | 1 | 7143 | <gh_stars>1-10
import requests
import re
from bs4 import BeautifulSoup
def nextPageLink(sess,soup,page,head=""):
NextPage=soup.find(class_='next').link.get('href')
req=sess.get(head + NextPage)
print(f'第{page}页:',req.status_code)
return BeautifulSoup(req.text,'html.parser') | 2.8125 | 3 |
491/491.py | kaixiang1992/python-flask | 0 | 7144 | from sqlalchemy import create_engine, Column, Integer, String, ForeignKey
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, relationship
# TODO: db_uri
# dialect+driver://username:password@host:port/database?charset=utf8
DB_URI = 'mysql+pymysql://root:root123@127.0.0.1:33... | 2.984375 | 3 |
spacy/tests/tagger/test_lemmatizer.py | TerminalWitchcraft/spaCy | 1 | 7145 | # coding: utf-8
from __future__ import unicode_literals
from ...lemmatizer import read_index, read_exc
import pytest
@pytest.mark.models
@pytest.mark.parametrize('text,lemmas', [("aardwolves", ["aardwolf"]),
("aardwolf", ["aardwolf"]),
... | 2.421875 | 2 |
sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/_generated/models/__init__.py | RAY-316/azure-sdk-for-python | 0 | 7146 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | 1.46875 | 1 |
AlgoNet2/Helper.py | Bhaney44/AlgorandDevelopment | 0 | 7147 | import numpy as np
from keras.models import Sequential
from keras.layers import LSTM, Dense, Dropout
def visualize_training_results(results):
"""
Plots the loss and accuracy for the training and testing data
"""
history = results.history
plt.figure(figsize=(12,4))
plt.plot(history['val_loss'])
... | 3.453125 | 3 |
apex/contrib/multihead_attn/self_multihead_attn_func.py | Muflhi01/apex | 6,523 | 7148 | import torch
import torch.nn.functional as F
class SelfAttnFunc(torch.autograd.Function):
@staticmethod
def forward(
ctx,
use_time_mask,
is_training,
heads,
scale,
inputs,
input_weights,
output_weights,
input_biases,
output_biases... | 2.25 | 2 |
api/app/reviews/models.py | NikolaSiplakova/Baobab | 0 | 7149 | <reponame>NikolaSiplakova/Baobab<filename>api/app/reviews/models.py
from datetime import datetime
from app import db
from app.utils import misc
class ReviewForm(db.Model):
id = db.Column(db.Integer(), primary_key=True)
application_form_id = db.Column(db.Integer(), db.ForeignKey('application_form.id'), nu... | 2.4375 | 2 |
speednet/vae/ConvVae.py | Abhranta/speednet | 1 | 7150 | <filename>speednet/vae/ConvVae.py
import torch.nn as nn
import torch
from utils import Flatten , Unflatten , weights_init , down_conv , up_conv
class Net(nn.Module):
def __init__(self , num_layers , img_dim , in_chan , act_func , latent_vector_size):
super(Net , self).__init__()
assert act... | 2.546875 | 3 |
nelpy/utils.py | IsaacBusaleh/nelpy | 1 | 7151 | """This module contains helper functions and utilities for nelpy."""
__all__ = ['spatial_information',
'frange',
'swap_cols',
'swap_rows',
'pairwise',
'is_sorted',
'linear_merge',
'PrettyDuration',
'ddt_asa',
'get_contig... | 2.34375 | 2 |
python/paddle/fluid/contrib/slim/quantization/imperative/qat.py | logan-siyao-peng/Paddle | 0 | 7152 | # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | 1.53125 | 2 |
sc/northwind.py | elliotgunn/DS-Unit-3-Sprint-2-SQL-and-Databases | 0 | 7153 | <filename>sc/northwind.py
import pandas as pd
import sqlite3
from pandas import DataFrame
n_conn = sqlite3.connect('northwind_small.sqlite3')
n_curs = n_conn.cursor()
# What are the ten most expensive items (per unit price) in the database?
query = """
SELECT ProductName, UnitPrice
FROM Product
ORDER BY UnitPrice D... | 4.0625 | 4 |
tests/test_app/library/loans/admin.py | Pijuli/django-jazzmin | 972 | 7154 | <gh_stars>100-1000
from django.contrib import admin
from django.urls import path
from .models import BookLoan, Library
from .views import CustomView
class BookLoanInline(admin.StackedInline):
model = BookLoan
extra = 1
readonly_fields = ("id", "duration")
fields = (
"book",
"imprint",... | 2.046875 | 2 |
lib/MergeMetabolicAnnotations/utils/CompareAnnotationsUtil.py | jeffkimbrel/MergeMetabolicAnnotations | 1 | 7155 | <reponame>jeffkimbrel/MergeMetabolicAnnotations<filename>lib/MergeMetabolicAnnotations/utils/CompareAnnotationsUtil.py<gh_stars>1-10
import os
import datetime
import logging
import json
import uuid
from installed_clients.WorkspaceClient import Workspace as Workspace
from installed_clients.KBaseReportClient import KBas... | 1.9375 | 2 |
models/__init__.py | TvSeriesFans/CineMonster | 15 | 7156 | from models.Model import Player, Group, Session, engine
| 1.0625 | 1 |
src/backend/tests/test_game/test_models.py | ToJestKrzysio/TheJungleGame | 0 | 7157 | <filename>src/backend/tests/test_game/test_models.py
from unittest.mock import Mock, patch
import numpy as np
from game.models import ValuePolicyModel
def test_predict():
mask = np.zeros((9, 7, 8), dtype=bool)
mask[1, 2, 3] = 1
mask[6, 6, 6] = 1
tensor_mock = Mock()
policy_tensor = np.zeros((9... | 2.59375 | 3 |
sina_spider/items.py | yanwen0614/Weibo | 0 | 7158 | # -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
from scrapy import Item, Field
class TweetsItem(Item):
# define the fields for your item here like:
Author = Field()
Title = Field()
Create_time = Fie... | 2.578125 | 3 |
emission/core/wrapper/client.py | Andrew-Tan/e-mission-server | 0 | 7159 | <filename>emission/core/wrapper/client.py
import json
import logging
import dateutil.parser
from datetime import datetime
# Our imports
from emission.core.get_database import get_profile_db, get_client_db, get_pending_signup_db
import emission.clients.common
class Client:
def __init__(self, clientName):
# TODO:... | 2.3125 | 2 |
setup.py | karianjahi/advent_of_code | 0 | 7160 | <filename>setup.py
import setuptools
setuptools.setup(name='advent_of_code') | 0.792969 | 1 |
src/csvutils.py | imco/nmx | 0 | 7161 | <gh_stars>0
def escapeQuotes(string):
return string.replace('"','""');
| 1.851563 | 2 |
test/sanity_import_vpp_papi.py | amithbraj/vpp | 751 | 7162 | #!/usr/bin/env python3
""" sanity check script """
import vpp_papi
| 1.132813 | 1 |
examples/labs/demo_dmtx.py | yarikoptic/nipy | 0 | 7163 | #!/usr/bin/env python
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
from __future__ import print_function # Python 2/3 compatibility
__doc__ = """
Examples of design matrices specification and and computation (event-related
design, FIR design, etc)
Re... | 2.453125 | 2 |
fbpcs/private_computation/test/service/test_private_computation.py | yelixu2/fbpcs | 0 | 7164 | <filename>fbpcs/private_computation/test/service/test_private_computation.py
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
from collections import de... | 1.648438 | 2 |
app.py | Eubule/Store-Manager-With-Datastructure | 0 | 7165 | from app import app
from app.database.db import Database
if __name__ == "__main__":
db = Database()
db.create_tables()
db.create_admin()
app.run(debug=True) | 1.6875 | 2 |
src/main.py | ryuichi1208/scraping-py | 2 | 7166 | # -*- coding: utf-8 -*-
# flake8: noqa
from flask import Flask
from flask_themes2 import Themes
import config
from util.auth import is_admin
from util.converter import RegexConverter
from util.csrf import generate_csrf_token
app = Flask(__name__.split('.')[0])
app.secret_key = config.SECRET_KEY
app.url_map.converter... | 1.859375 | 2 |
HoursSelect.py | Maxahoy/ClassVolumeSilencer | 0 | 7167 | <gh_stars>0
"""
This is how I'm gonna schedule hours
IDEA: import the format example file that I'm using and is saved in the same directory
"""
import csv
import pprint
from tkinter import *
from tkinter.filedialog import askopenfilename
import StringProcessing
def selectHoursFile():
Tk().withdraw() # we don... | 3.109375 | 3 |
src/bsmu/bone_age/models/dense_net/configs.py | IvanKosik/bone-age-models | 0 | 7168 | from pathlib import Path
from bsmu.bone_age.models import constants
IMAGE_DIR = Path('C:/MyDiskBackup/Projects/BoneAge/Data/SmallImages500_NoPads')
TRAIN_DATA_CSV_PATH = constants.TRAIN_DATA_CSV_PATH
VALID_DATA_CSV_PATH = constants.VALID_DATA_CSV_PATH
TEST_DATA_CSV_PATH = constants.TEST_DATA_CSV_PATH
BATC... | 1.765625 | 2 |
projection.py | ogawan/nisa | 0 | 7169 | <gh_stars>0
from matplotlib import pyplot as plt
def nisa_projection(years=30, annual_deposit=80, initial_budget=100):
"""
This is a function to plot deposit of TSUMITATE NISA
Parameters:
---------------
years: integer
How many years are you going to continue?
annual_depoist: integer
Annua... | 3.40625 | 3 |
indico/modules/oauth/models/applications.py | yamiacat/indico | 0 | 7170 | # This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from uuid import uuid4
from sqlalchemy.dialects.postgresql import ARRAY, UUID
from sqlalchemy.ext.declara... | 1.976563 | 2 |
PaddleNLP/unarchived/deep_attention_matching_net/utils/layers.py | FrancisLiang/models-1 | 3 | 7171 | <reponame>FrancisLiang/models-1
import paddle.fluid as fluid
def loss(x, y, clip_value=10.0):
"""Calculate the sigmoid cross entropy with logits for input(x).
Args:
x: Variable with shape with shape [batch, dim]
y: Input label
Returns:
loss: cross entropy
logits: predicti... | 2.703125 | 3 |
plugin.video.saltsrd.lite/js2py/translators/jsregexps.py | TheWardoctor/wardoctors-repo | 1 | 7172 | <filename>plugin.video.saltsrd.lite/js2py/translators/jsregexps.py
from salts_lib.pyjsparser.pyjsparserdata import *
REGEXP_SPECIAL_SINGLE = {'\\', '^', '$', '*', '+', '?', '.'}
NOT_PATTERN_CHARS = {'^', '$', '\\', '.', '*', '+', '?', '(', ')', '[', ']', '|'} # what about '{', '}', ???
CHAR_CLASS_ESCAPE = {'d', '... | 2.375 | 2 |
connectomics/model/block/squeeze_excitation.py | yixinliao/pytorch_connectomics | 1 | 7173 | import torch.nn as nn
from .basic import *
class squeeze_excitation_2d(nn.Module):
"""Squeeze-and-Excitation Block 2D
Args:
channel (int): number of input channels.
channel_reduction (int): channel squeezing factor.
spatial_reduction (int): pooling factor for x,y axes.
"""
def ... | 2.71875 | 3 |
duckdown/handlers/site_handler.py | blueshed/duckdown | 0 | 7174 | <reponame>blueshed/duckdown
# pylint: disable=W0201, E1101
""" handle request for markdown pages """
import logging
import os
import importlib
from tornado.web import RequestHandler, HTTPError
from tornado.escape import url_escape
from ..utils.converter_mixin import ConverterMixin
from .access_control import UserMixin
... | 2.328125 | 2 |
Problemset/binary-search-tree-to-greater-sum-tree/binary-search-tree-to-greater-sum-tree.py | KivenCkl/LeetCode | 7 | 7175 |
# @Title: 从二叉搜索树到更大和树 (Binary Search Tree to Greater Sum Tree)
# @Author: KivenC
# @Date: 2019-05-15 19:52:08
# @Runtime: 48 ms
# @Memory: 13 MB
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solu... | 3.390625 | 3 |
vine/clone.py | robinson96/GRAPE | 4 | 7176 | import os
import option
import utility
import grapeMenu
import grapeGit as git
import grapeConfig
class Clone(option.Option):
""" grape-clone
Clones a git repo and configures it for use with git.
Usage: grape-clone <url> <path> [--recursive] [--allNested]
Arguments:
<url> The URL of th... | 3 | 3 |
neo/test/iotest/test_nixio.py | pearsonlab/python-neo | 0 | 7177 | # -*- coding: utf-8 -*-
# Copyright (c) 2016, German Neuroinformatics Node (G-Node)
# <NAME> <<EMAIL>>
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted under the terms of the BSD License. See
# LICENSE file in the root of t... | 2.015625 | 2 |
lib/taudataNlpTm.py | taudata-indonesia/elearning | 3 | 7178 | <reponame>taudata-indonesia/elearning
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 28 11:25:43 2019
@author: <NAME>
<EMAIL>
https://tau-data.id
~~Perjanjian Penggunaan Materi & Codes (PPMC) - License:~~
* Modul Python dan gambar-gambar (images) yang digunakan adalah milik dari berbagai sumber sebagaimana yan... | 2.625 | 3 |
reamber/base/MapSet.py | Eve-ning/reamber_base_py | 10 | 7179 | from __future__ import annotations
from copy import deepcopy
from dataclasses import dataclass, field
from typing import List, Iterator, TypeVar, Union, Any, Generic
import pandas as pd
from pandas.core.indexing import _LocIndexer
from reamber.base.Map import Map
from reamber.base.Property import stack_props
NoteLi... | 2.5625 | 3 |
src/poretitioner/utils/filtering.py | uwmisl/poretitioner | 2 | 7180 | """
=========
filtering.py
=========
This module provides more granular filtering for captures.
You can customize your own filters too.
"""
from __future__ import annotations
import re
from abc import ABC, ABCMeta, abstractmethod
from dataclasses import dataclass
from json import JSONEncoder
from pathlib import Posi... | 2.109375 | 2 |
Chapter 11/wrong_type.py | nescience8/starting-out-with-python-global-4th-edition | 35 | 7181 | <gh_stars>10-100
def main():
# Pass a string to show_mammal_info...
show_mammal_info('I am a string')
# The show_mammal_info function accepts an object
# as an argument, and calls its show_species
# and make_sound methods.
def show_mammal_info(creature):
creature.show_species()
creature.make_s... | 3.078125 | 3 |
fase2-exercicios/cap2/lista-de-exercicios/RM94336_EX04.py | Leodf/FIAP | 0 | 7182 | <gh_stars>0
"""
4 – Um grande cliente seu sofreu um ataque hacker: o servidor foi sequestrado por um software malicioso, que criptografou todos os discos e pede a digitação de uma senha para a liberação da máquina. E é claro que os criminosos exigem um pagamento para informar a senha.
Ao analisar o código do programa ... | 3.671875 | 4 |
dosagelib/helpers.py | yasen-m/dosage | 0 | 7183 | <reponame>yasen-m/dosage
# -*- coding: iso-8859-1 -*-
# Copyright (C) 2004-2005 <NAME> and <NAME>
# Copyright (C) 2012-2014 <NAME>
from .util import fetchUrl, getPageContent, getQueryParams
def queryNamer(paramName, usePageUrl=False):
"""Get name from URL query part."""
@classmethod
def _namer(cls, imageUr... | 2.1875 | 2 |
research/object_detection/data_decoders/tf_example_decoder_test.py | akshit-protonn/models | 18 | 7184 | <gh_stars>10-100
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless re... | 2.234375 | 2 |
counting_capitals.py | m10singh94/Python-programs | 0 | 7185 | # -*- coding: utf-8 -*-
"""
Created on Tue Apr 21 08:09:31 2020
@author: <NAME>
"""
def count_capitals(string):
count = 0
for ch in string:
if ord(ch) >= 65 and ord(ch) <= 90:
count += 1
return count
def remove_substring_everywhere(string, substring):
'''
Remove all occurrence... | 3.921875 | 4 |
admit/at/GenerateSpectrum_AT.py | astroumd/admit | 4 | 7186 | """ .. _GenerateSpectrum-at-api:
**GenerateSpectrum_AT** --- Generates synthetic test spectra.
-------------------------------------------------------------
This module defines the GenerateSpectrum_AT class.
"""
from admit.AT import AT
import admit.util.bdp_types as bt
from admit.bdp.CubeSpectrum_BDP import ... | 2.453125 | 2 |
lib/flows/general/discovery_test.py | nahidupa/grr | 1 | 7187 | #!/usr/bin/env python
# -*- mode: python; encoding: utf-8 -*-
"""Tests for Interrogate."""
import socket
from grr.client import vfs
from grr.lib import action_mocks
from grr.lib import aff4
from grr.lib import artifact_test
from grr.lib import client_index
from grr.lib import config_lib
from grr.lib import flags
fro... | 1.9375 | 2 |
practices/20210112/GraphicsView.py | liff-engineer/articles | 2 | 7188 | <reponame>liff-engineer/articles
import sys
from PySide2.QtWidgets import QGraphicsView, QGraphicsScene, QApplication
from PySide2.QtCore import *
from PySide2.QtGui import *
class GraphicsView(QGraphicsView):
def __init__(self, parent=None):
super().__init__(parent)
# 画布视图尺寸
self.w = 64... | 2.15625 | 2 |
armstrong/hatband/tests/_utils.py | joncotton/armstrong.hatband | 0 | 7189 | from armstrong.dev.tests.utils import ArmstrongTestCase
import random
def random_range():
# TODO: make sure this can only be generated once
return range(random.randint(1000, 2000))
class HatbandTestCase(ArmstrongTestCase):
pass
class HatbandTestMixin(object):
script_code = """
<script type="t... | 2.421875 | 2 |
tests/propositional/test_natural_deduction.py | ariroffe/logics | 12 | 7190 | import unittest
from logics.classes.propositional import Inference, Formula
from logics.classes.propositional.proof_theories import NaturalDeductionStep, NaturalDeductionRule
from logics.utils.parsers import classical_parser
from logics.instances.propositional.natural_deduction import classical_natural_deduction_syste... | 3.109375 | 3 |
src/trusted/validator_arm/dgen_decoder_output.py | cohortfsllc/cohort-cocl2-sandbox | 2,151 | 7191 | <filename>src/trusted/validator_arm/dgen_decoder_output.py
#!/usr/bin/python
#
# Copyright (c) 2012 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
"""
Responsible for generating the decoder based on parsed
table re... | 2.296875 | 2 |
compose/progress_stream.py | ilinum/compose | 1 | 7192 | from __future__ import absolute_import
from __future__ import unicode_literals
from compose import utils
class StreamOutputError(Exception):
pass
def stream_output(output, stream):
is_terminal = hasattr(stream, 'isatty') and stream.isatty()
stream = utils.get_output_stream(stream)
all_events = []
... | 2.390625 | 2 |
tests/test_db.py | beloglazov/openstack-neat | 34 | 7193 | # Copyright 2012 <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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | 2.0625 | 2 |
libs/BIDS.py | GuillermoPerez32/EE2BIDS_backend | 0 | 7194 | import os
from bids_validator import BIDSValidator
def validate(bids_directory):
print('- Validate: init started.')
file_paths = []
result = []
validator = BIDSValidator()
for path, dirs, files in os.walk(bids_directory):
for filename in files:
if filename == '.bidsignore':
... | 2.78125 | 3 |
src/python/triangula/chassis.py | peterbrazil/brazil | 0 | 7195 | from math import cos, sin, degrees, radians, pi
from time import time
from euclid import Vector2, Point2
from numpy import array as np_array
from numpy.linalg import solve as np_solve
__author__ = 'tom'
def test():
chassis = HoloChassis(wheels=[
HoloChassis.OmniWheel(position=Point2(1, 0), angle=0, radi... | 3.421875 | 3 |
libs/PureCloudPlatformClientV2/models/management_unit.py | rocketbot-cl/genesysCloud | 1 | 7196 | # coding: utf-8
"""
Copyright 2016 SmartBear Software
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 applica... | 1.828125 | 2 |
harmony_tools/core/colors.py | a1fred/guitar_gammas | 1 | 7197 | COLOR_BLUE = '\033[0;34m'
COLOR_GREEN = '\033[0;32m'
COLOR_CYAN = '\033[0;36m'
COLOR_RED = '\033[0;31m'
COLOR_PURPLE = '\033[0;35m'
COLOR_BROWN = '\033[0;33m'
COLOR_YELLOW = '\033[1;33m'
COLOR_GRAY = '\033[1;30m'
COLOR_RESET = '\033[0m'
FG_COLORS = [
# COLOR_BLUE,
COLOR_GREEN,
# COLOR_CYAN,
# COLOR_R... | 2.53125 | 3 |
Common_Questions/TextBookQuestions/PythonCrashCourse/Chapter_8/8_5.py | tegamax/ProjectCode | 0 | 7198 | <reponame>tegamax/ProjectCode
'''
8-5. Cities: Write a function called describe_city() that accepts the name of a city and its country.
The function should print a simple sentence, such as Reykjavik is in Iceland. Give the parameter for the country a default value.
Call your function for three different cities, at le... | 4.5625 | 5 |
tests/test_geometry_loader.py | trnielsen/nexus-constructor | 0 | 7199 | <filename>tests/test_geometry_loader.py<gh_stars>0
from nexus_constructor.geometry import OFFGeometryNoNexus
from nexus_constructor.geometry.geometry_loader import load_geometry_from_file_object
from nexus_constructor.off_renderer import repeat_shape_over_positions
from PySide2.QtGui import QVector3D
from io import Str... | 2.265625 | 2 |