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 |
|---|---|---|---|---|---|---|
math-and-algorithm/022.py | silphire/training-with-books | 0 | 53500 | # https://atcoder.jp/contests/math-and-algorithm/tasks/math_and_algorithm_v
from collections import Counter
n = int(input())
aa = list(map(int, input().split()))
ctr = Counter(aa)
ans = 0
for x, c in ctr.items():
if x == 100000 // 2:
ans += ctr[x] * (ctr[x] - 1)
else:
ans += ctr[x] * ctr[100000... | 2.625 | 3 |
autofit/graphical/declarative.py | jonathanfrawley/PyAutoFit | 0 | 53501 | from abc import ABC, abstractmethod
from typing import Callable, cast, Set, List, Dict, Optional
import numpy as np
from autofit import ModelInstance, Analysis, DirectoryPaths
from autofit.graphical.expectation_propagation import AbstractFactorOptimiser
from autofit.graphical.expectation_propagation import EPMeanFiel... | 2.421875 | 2 |
main.py | ahsankhatri/cows-and-bulls | 0 | 53502 | import random
import time
def ask_input(text=""):
try:
enteredNumber = (input(("Enter a 3-digit number:" if text == "" else text) + "\n>>>> "))
startTime()
if len(str(abs(enteredNumber))) != 3:
raise ValueError
else:
return str(enteredNumber)
except Val... | 4 | 4 |
lessons/04/perm_check/challenge.py | jimlawton/codility | 0 | 53503 | # A non-empty zero-indexed array A consisting of N integers is given.
#
# A permutation is a sequence containing each element from 1 to N once, and
# only once.
#
# For example, array A such that:
# A = [4, 1, 3, 2]
# is a permutation, but array A such that:
# A = [4, 1, 3]
# is not a permutation, because value... | 3.953125 | 4 |
correctiv_eurosfueraerzte/migrations/0022_auto_20170323_1642.py | correctiv/correctiv-eurosfueraerzte | 4 | 53504 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-23 15:42
from __future__ import unicode_literals
import django.contrib.postgres.fields.hstore
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('correctiv_eurosfueraerzte', '0021_paymentrecipi... | 1.625 | 2 |
telegraph_api/models/node.py | IvanProgramming/Telegraph_api | 0 | 53505 | <reponame>IvanProgramming/Telegraph_api<gh_stars>0
from typing import Optional, List, ForwardRef, Union
from pydantic import BaseModel
Node = ForwardRef("Node")
class Node(BaseModel):
""" This abstract object represents a DOM Node. """
tag: str
""" Name of the DOM element. """
attrs: Optional[dict]
... | 2.765625 | 3 |
src/xport/v89.py | gaineleanor/xport | 0 | 53506 | <filename>src/xport/v89.py
"""
Read and write the SAS XPORT/XPT file format from SAS Version 8 or 9.
The SAS V8 Transport File format, also called XPORT, or simply XPT, ...
"""
# Member names may now be up to 32 characters.
# Variable names may now be up to 32 characters.
# Variable labels may now be up to 256 charac... | 1.984375 | 2 |
number_extraction.py | subhrajit02/handwritten-digit-recognision | 0 | 53507 | <reponame>subhrajit02/handwritten-digit-recognision<gh_stars>0
import cv2 as cv
import imutils
from number_detection import *
path = "/home/pks/Downloads/Assignment/IVP/mini project/"
def approx_rect(con):
'''
Determine boundary rectangle of a contour
Parameters:
con : Given contour
Returns:
... | 3.390625 | 3 |
tests/test_models.py | nyu-devops-squad/shopcarts | 3 | 53508 | <gh_stars>1-10
"""
Test cases for YourResourceModel Model
"""
import logging
import unittest
import os
from services.models import Shopcart, DataValidationError, db
from tests.factories import ShopcartFactory
from services import app
from werkzeug.exceptions import NotFound
DATABASE_URI = os.getenv(
"DATABASE_URI... | 2.5 | 2 |
justfunc/__init__.py | justland/just-func-python | 1 | 53509 | import json
from justfunc.env import setup_env
from justfunc.evaluator import evaluate
from justfunc.reader import read
class JustFunc:
def __init__(self):
self.env = setup_env()
def run(self, src):
return evaluate(read(src), self.env)
def run_repl(self, prompt=">>> "):
while li... | 2.53125 | 3 |
src/ctc/protocols/coingecko_utils/market_utils.py | fei-protocol/checkthechain | 94 | 53510 | <reponame>fei-protocol/checkthechain
from __future__ import annotations
import math
import typing
if typing.TYPE_CHECKING:
import aiohttp
import toolstr
url_template = 'https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&order=market_cap_desc&per_page=100&page={page}&sparkline=true&price_change_perc... | 2.40625 | 2 |
fairseq_ext/binarize.py | IBM/transition-amr-parser | 76 | 53511 | import numpy as np
import torch
from fairseq.data.indexed_dataset import __best_fitting_dtype, MMapIndexedDatasetBuilder, IndexedDatasetBuilder
from fairseq.tokenizer import tokenize_line
# TODO move this file into data folder
def make_builder(out_file, impl, vocab_size=None, dtype=None):
if impl == 'mmap':
... | 2.375 | 2 |
robot-server/robot_server/robot/calibration/pipette_offset/constants.py | anuwrag/opentrons | 235 | 53512 | from __future__ import annotations
from enum import Enum
from typing import TYPE_CHECKING
from robot_server.robot.calibration.constants import STATE_WILDCARD
if TYPE_CHECKING:
from typing_extensions import Final
class PipetteOffsetCalibrationState(str, Enum):
sessionStarted = "sessionStarted"
labwareLoa... | 2.453125 | 2 |
boomerang.py | codegolfer/boomerang | 0 | 53513 | """
bot implementation.
"""
import os
import boto3
from botocore.exceptions import ClientError
import sendgrid
import ciscospark
# Sets config values from the config file
ACCESS_TOKEN_SPARK = "Bearer " + os.environ['access_token_spark']
MYSELF = os.environ['my_person_id']
SENDGRID_API_TOKEN = os.environ['sendgrid_ap... | 2.578125 | 3 |
bb-master/sandbox/lib/python3.5/site-packages/buildbot_worker/util/_hangcheck.py | Alecto3-D/testable-greeter | 2 | 53514 | """
Protocol wrapper that will detect hung connections.
In particular, since PB expects the server to talk first and HTTP
expects the client to talk first, when a PB client talks to an HTTP
server, neither side will talk, leading to a hung connection. This
wrapper will disconnect in that case, and inform the caller.
"... | 2.96875 | 3 |
ggcontable/production.py | jmjacquet/IronWeb | 0 | 53515 | <reponame>jmjacquet/IronWeb
# Django settings for sistema_bomberos project.
from .settings import *
from decouple import config
DEBUG = False
STATIC_URL = '/staticfiles/'
DB_USER = config('DB_USER')
DB_PASS = config('DB_PASS')
DB_HOST = config('DB_HOST')
DATABASES = {
'default': {
'ENGINE': 'dja... | 1.4375 | 1 |
examples/verlet_chain/relax.py | Peque/pyqtgraph | 0 | 53516 | import ctypes
import os
so = os.path.join(os.path.dirname(__file__), 'maths.so')
lib = ctypes.CDLL(so)
lib.relax.argtypes = [
ctypes.c_void_p,
ctypes.c_void_p,
ctypes.c_void_p,
ctypes.c_void_p,
ctypes.c_void_p,
ctypes.c_void_p,
ctypes.c_void_p,
ctypes.c_int,
ctypes.c_int,
]
de... | 1.9375 | 2 |
code/newspaperclassifier/scripts/merge.py | dhlab-epfl-students/newspaper-image-classification | 1 | 53517 | from newspaperclassifier.evaluation.merging import merge_labels
import click
@click.command()
@click.option('--aws-dir', type=str, help="Directory where AWS labels are stored")
@click.option('--gc-dir', type=str, help="Directory where GC labels are stored")
@click.option('--destination', type=str, help="Destination f... | 2.609375 | 3 |
telegram_bot_sdk/exceptions/message_exception.py | myOmikron/TelegramBotSDK | 0 | 53518 | class MessageError:
def __init__(self):
print("Message Result \"ok\" was False")
| 2.28125 | 2 |
status.py | OscarMederos/network-status | 0 | 53519 | <reponame>OscarMederos/network-status
from email.headerregistry import HeaderRegistry
import os
import sys
import socket
import datetime
import time
FILE = os.path.join(os.getcwd(), "networkinfo.log")
# creating log file in the currenty directory
# ??getcwd?? get current directory,
# os function, ??path?? to specif... | 3.046875 | 3 |
src/Variational_dropout/model.py | Neronjust2017/Bayesian-neural-networks | 4 | 53520 | <gh_stars>1-10
from src.priors import *
from src.base_net import *
import torch.nn.functional as F
import torch.nn as nn
import copy
import math
def calculate_kl(log_alpha):
return 0.5 * torch.sum(torch.log1p(torch.exp(-log_alpha)))
class VdLinear(nn.Module):
"""
variational dropout
"""
def __i... | 2.125 | 2 |
astar.py | UTM-Society-for-Algorithmic-Modelling/project-celer | 4 | 53521 | from shapely.geometry import shape
import fiona
import networkx as nx
import matplotlib.pyplot as plt
import math
import random
import traffic
import pickle
from datetime import datetime
from request import Request
import numpy as np
try:
from itertools import izip as zip
except ImportError:
pass
def main():... | 2.71875 | 3 |
experiment_gathering.py | viciouspetal/meta-project-1 | 0 | 53522 | import time
from TSP_toStudents import *
def main():
maxMenu = 6
iterationNumber = 1
maxIterations = 4
for i in range(1, maxMenu + 1):
for j in range(1, maxIterations+1):
BasicTSP.menuChoice = i
data_input_file = sys.argv[1]
print('=========================... | 3.265625 | 3 |
Python/leftbeehind/leftbeehind.py | rvrheenen/OpenKattis | 12 | 53523 | while(True):
jars = [int(x) for x in input().split()]
if sum(jars) == 0:
break
if sum(jars) == 13:
print("Never speak again.")
elif jars[0] > jars[1]:
print("To the convention.")
elif jars[1] > jars[0]:
print("Left beehind.")
elif jars[1] == jars[0]:
print... | 3.75 | 4 |
Assignment 1/ExactDeDup.py | AravindRam/CSCI-572 | 1 | 53524 | import hashlib
import sys
import os
import tika
from tika import parser
fnamesDict = {} # dictionary used to store the names of the filenames.
checksumDict = {} # dictionary used to store the fingerprints of each image file.
countDict = {} ... | 3.078125 | 3 |
facenet/apps/dataset.py | sMedX/facenet | 2 | 53525 | <gh_stars>1-10
# coding:utf-8
"""Application to print information about dataset
"""
# MIT License
#
# Copyright (c) 2020 sMedX
#
import click
from tqdm import tqdm
from pathlib import Path
from PIL import Image
from facenet import dataset
@click.command()
@click.option('--path', type=Path,
help='Path... | 2.40625 | 2 |
bddtests/steps/bdd_remote_util.py | pfoytik/blueMixTest | 0 | 53526 | #
# Copyright IBM Corp. 2016 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.929688 | 2 |
providers/WMIStorageProvider.py | g-mc/AltFS | 54 | 53527 | #!/usr/bin/env python
"""
BSD 3-Clause License
Copyright (c) 2017, SafeBreach Labs
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notic... | 1.265625 | 1 |
conllu/conllu.py | spyysalo/conllu.py | 13 | 53528 | #!/usr/bin/env python
# CoNLL-U format support
import re
import codecs
import brat
from itertools import groupby
# feature name-value separator
FSEP = '='
# dependency head-rel separator
DSEP = ':'
# Free-form text annotation type in brat export
COMMENT_TYPE = 'AnnotatorNotes'
class FormatError(Exception):
d... | 2.40625 | 2 |
QGISplugin/coins/get_links_parallel.py | PratyushTripathy/CONTRA | 13 | 53529 | <filename>QGISplugin/coins/get_links_parallel.py<gh_stars>10-100
import argparse, multiprocessing, math
from functools import partial
import numpy as np
parser = argparse.ArgumentParser()
parser.add_argument("--input", help="Path to the input array")
parser.add_argument("--output", help="Path to the processed ar... | 2.703125 | 3 |
bit/keygen.py | richardkiss/bit | 0 | 53530 | <filename>bit/keygen.py
from multiprocessing import Event, Process, Queue, cpu_count
from bit.base58 import BASE58_ALPHABET
from bit.crypto import (
DEFAULT_BACKEND, SECP256K1, gen_privkey, derive_privkey
)
from bit.format import point_to_public_key, public_key_to_address
from bit.utils import int_to_hex
def der... | 2.34375 | 2 |
create_table.py | taniokaeiji/rmmini-control | 0 | 53531 | <reponame>taniokaeiji/rmmini-control<gh_stars>0
from models import *
import db
import os
if __name__ == "__main__":
path = SQLITE3_NAME
if not os.path.isfile(path) or \
db.engine.dialect.has_table(db.engine, 'devices') or \
db.engine.dialect.has_table(db.engine, 'commands'):
# テーブルを作成する... | 1.960938 | 2 |
torch_inception_resnet_v2/utils/functions.py | mhconradt/inception-resnet-v2 | 9 | 53532 | <reponame>mhconradt/inception-resnet-v2
from .convolution_config import PadConfig
def find_first_before(filter_fn, arr, idx):
for item in arr[:idx][::-1]:
if filter_fn(item):
return item
def parallel_shifted_map(fn, start):
is_not_pad = lambda node: not isinstance(node, PadConfig)
d... | 2.4375 | 2 |
wordPattern2.py | pflun/learningAlgorithms | 0 | 53533 | # -*- coding: utf-8 -*-
# pattern = "abab", str = "redblueredblue" should return true.
# pattern = "aaaa", str = "asdasdasdasd" should return true.
# pattern = "aabb", str = "xyzabcxzyabc" should return false.
class Solution(object):
def wordPatternMatch(self, pattern, str):
dic = {}
return self.is... | 3.578125 | 4 |
keystone/test/unit/test_normalizingfilter.py | admiyo/keystone | 0 | 53534 | <filename>keystone/test/unit/test_normalizingfilter.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010-2011 OpenStack, 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
#
... | 2.46875 | 2 |
python/paddle/fluid/tests/unittests/test_psroi_pool_op.py | zmxdream/Paddle | 17,085 | 53535 | # Copyright (c) 2018 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.898438 | 2 |
lecture09/colors_test.py | nd-cse-30872-fa20/cse-30872-fa20-examples | 1 | 53536 | <gh_stars>1-10
#!/usr/bin/env python3
import unittest
import colors
# Test Case
class ColorsTestCase(unittest.TestCase):
def test_00_count_colors(self):
self.assertEqual(
colors.count_colors([0, 1, 2]),
[1, 1, 1]
)
self.assertEqual(
colors.count_colo... | 3.0625 | 3 |
Net640/apps/images/urls.py | 86Ilya/net640kb | 1 | 53537 | from django.urls import path, re_path
from Net640.apps.images import views
app_name = 'images'
urlpatterns = [
path(r'my_images/', views.user_images_view, name="my_images"),
# TODO move to rest api
path(r'action/', views.user_image_action, name="user_image_action"),
]
| 1.71875 | 2 |
bin/rename-email.py | liweitianux/atoolbox | 4 | 53538 | <gh_stars>1-10
#!/usr/bin/env python3
#
# Copyright (c) 2017 <NAME>
# MIT license
#
# 2017-04-17
#
"""
Rename email filename according to the given pattern.
"""
import os
import sys
import email
import argparse
class Email:
def __init__(self, filename):
self.filename = filename
self.message = em... | 3.625 | 4 |
undatum/constants.py | datacoon/undatum | 26 | 53539 | <reponame>datacoon/undatum<filename>undatum/constants.py
DATE_PATTERNS = ["%d.%m.%Y", "%Y-%m-%d", "%y-%m-%d", "%Y-%m-%dT%H:%M:%S",
"%Y-%m-%d %H:%M:%S",
"%d.%m.%Y %H:%M"]
DEFAULT_DICT_SHARE = 70
SUPPORTED_FILE_TYPES = ['xls', 'xlsx', 'csv', 'xml', 'json', 'jsonl', 'yaml', 'tsv', 'sql... | 1.3125 | 1 |
matchms/old/plotting_functions.py | matchms/old-iomega-spec2vec | 0 | 53540 | <filename>matchms/old/plotting_functions.py
#
# Spec2Vec
#
# Copyright 2019 Netherlands eScience Center
#
# 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/... | 1.820313 | 2 |
symphony/cli/graphql_compiler/gql/utils_codegen.py | remo5000/magma | 1 | 53541 | <reponame>remo5000/magma
#!/usr/bin/env python3
import os
SPACES = ' ' * 4
class CodeChunk:
class Block:
def __init__(self, codegen: 'CodeChunk'):
self.gen = codegen
def __enter__(self):
self.gen.indent()
return self.gen
def __exit__(self, exc_type, e... | 3.125 | 3 |
TWLight/graphs/tests.py | Chinmay-Gurjar/TWLight | 0 | 53542 | import csv
# django-request analytics package, NOT requests URL library!
from request.models import Request
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test.client import RequestFactory
from . import views
class GraphsTestCase(... | 2.65625 | 3 |
day1.py | gitkoogie/AdventOfCode2021 | 0 | 53543 | <filename>day1.py
import numpy
import time
start = time.perf_counter()
data = numpy.loadtxt("inputs/day1.txt")
# day1 func 1
def find_increase(lines):
increase = 0
for i in range(1,len(lines)):
if lines[i] > lines[i-1]:
increase += 1
return increase
# day1 func 2
def measure_window(data):
increase = 0
temp... | 3.3125 | 3 |
main/SteppableDemos/ReactionDiffusionSolverFE/RD_test/Simulation/ReactionDiffusion_2D.py | JulianoGianlupi/nh-cc3d-4x-base-tool | 0 | 53544 | <gh_stars>0
from cc3d import CompuCellSetup
from .RD_steppables import FieldSteppable
CompuCellSetup.register_steppable(steppable=FieldSteppable(frequency=1))
CompuCellSetup.run()
| 1.226563 | 1 |
src/kemokrw/transfer_basic.py | Kemok-Repos/kemokrw | 0 | 53545 | from kemokrw.transfer import Transfer
class BasicTransfer(Transfer):
"""Clase BasicTransfer implementación de la clase Transfer.
Cumple la función de verficar la compatibilidad de los objetos a transferir,
verifica si ambos extremos son "iguales" y transfiere un los atos de una fuente a la otra.
... | 3.265625 | 3 |
responses/test.py | YousefEZ/pydiscord | 3 | 53546 | import sys, inspect
class Tutorial:
flow = "TUTORIAL"
type = "embed"
title = "__TUTORIAL HELP__"
colour = "green"
def __init__(self, player=None):
self.fields = (('Official Discord Server:',
'''
https://discord.com/invite/discord-developers... | 2.40625 | 2 |
galleries/annotations_filtering/__init__.py | mnicolas94/galleries | 0 | 53547 | <gh_stars>0
import enum
class ComparisonType(enum.Enum):
EQUAL = 0
NOTEQUAL = 1
LESS = 2
GREATER = 3
GREATER_EQUAL = 4
LESS_EQUAL = 5
CONTAINS = 6
data_type_to_comparison_type = {
bool: [
ComparisonType.EQUAL,
ComparisonType.NOTEQUAL
],
int: [
Comparis... | 3.03125 | 3 |
aula5/aula5ex9.py | otaviobizulli/python-exercices | 0 | 53548 | <filename>aula5/aula5ex9.py
#9. Elabore um programa para mostrar a sequência dos N primeiro números da série de Fibonacci:
#1 1 2 3 5 8 13 21 34 55 89 ....
#Sempre o próximo elemento é a soma dos dois anteriores, assim, no exemplo o próximo é 144.
ult = 0
num = 1
while num <= 144:
print(num)
ult, num = num, ul... | 3.96875 | 4 |
examples/typed_options.py | synesissoftware/CLASP.Python | 1 | 53549 | <gh_stars>1-10
#!/usr/bin/env python
import pyclasp as clasp
import sys
# constants
VERSION = '0.0.2'
INFO_LINES = (
'CLASP.Python examples',
':version',
"Illustrates use of CLASP.Python's typed option values",
'',
)
# Specify specifications, parse, and checking standard flags
specifications = (... | 2.671875 | 3 |
padmini/prakarana/ac_sandhi.py | sanskrit/padmini | 1 | 53550 | <reponame>sanskrit/padmini<filename>padmini/prakarana/ac_sandhi.py
"""
ac_sandhi
~~~~~~~~~
(6.1.66 - 6.1.101)
"""
import re
from padmini import operations as op, sounds
from padmini.sounds import s
from padmini.prakriya import Prakriya
from padmini.constants import Tag as T
from padmini.term_views import StringView
... | 2.71875 | 3 |
server/controllers/score_controller.py | KohlbacherLab/deregnet-rest | 0 | 53551 | import connexion
import six
from deregnet_rest.models.score import Score # noqa: E501
from deregnet_rest.models.score_info import ScoreInfo # noqa: E501
from deregnet_rest import util
from deregnet_rest.controllers_impl.scores import ScoreController
def delete_score(score_id): # noqa: E501
"""Delete a previo... | 2.328125 | 2 |
kernel/tools/genmap.py | narke/Einherjar.tmp | 3 | 53552 | #!/usr/bin/env python
#
# Copyright (c) 2006 <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# - Redistributions of source code must retain the above copyright
# notice, this list of ... | 1.601563 | 2 |
lifegame.py | finshope/lifegame | 0 | 53553 | #!/usr/bin/env python3
import random
import time
import sys
import pygame
from pygame.locals import *
import pygame.surfarray as surfarray # for performance
import numpy as np
import colors # color definition
SCREEN_SIZE = (1600, 900) # change it to your screen size
#color definition... | 3.125 | 3 |
tests/test_forecast_io.py | dandesousa/gardenbot | 1 | 53554 | <filename>tests/test_forecast_io.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import os
import unittest
from datetime import date, timedelta
from unittest.mock import Mock, patch
from gardenbot.weather import ForecastIODataSource
# historical fixture
historical_filename = os.path.join(os.path.dirna... | 2.734375 | 3 |
api/src/near/debugger_api/web/blueprint.py | marcinbodnar/debugger | 0 | 53555 | <reponame>marcinbodnar/debugger<filename>api/src/near/debugger_api/web/blueprint.py
import json
from flask import current_app, Blueprint, jsonify, request
from near.debugger_api.models import (
BeaconBlock, ContractInfo, ListBeaconBlockResponse, ListShardBlockResponse,
PaginationOptions, ShardBlock, Transacti... | 2.046875 | 2 |
password_test.py | John-Kimani/Password-Manager | 0 | 53556 | import unittest #unitest module
from password import Credential #imports Credential class for testing
from password import User #imports User class for testing
class TestUser(unittest.TestCase):
'''
Test class that helps define test cases for the credentials class behaviours
Args:
Testcase class ta... | 3.265625 | 3 |
main.py | fhardison/hebrew-vocab-tools | 3 | 53557 | import enum
import sys
import os.path
TokenType = enum.Enum("TokenType", "form lemma parse morph_lemma all")
ChunkType = enum.Enum("ChunkType", "book chapter verse paragraph pericope")
chunk_data_filename = {
ChunkType.book: "books.txt",
ChunkType.chapter: "chapters.txt",
ChunkType.verse: "verses.txt",
... | 2.65625 | 3 |
r-net.py | gypleon/SQuAD | 0 | 53558 | import tensorflow as tf
import numpy as np
from word_embedding import WORD_EMBEDDING as WE
class R_NET(object):
'''
refer to
R-NET: Machine Reading Comprehension with Self-matching Networks
Natural Language Computing Group, Microsoft Research Asia
https://www.microsoft.com/en-us/research/publication/mrc/
... | 2.921875 | 3 |
models.py | kaflesudip/TweetStats | 0 | 53559 | <reponame>kaflesudip/TweetStats<filename>models.py
from mongoengine import DynamicDocument, fields, connect
connect('tweetpredict')
class Tweet(DynamicDocument):
tweet_id = fields.StringField()
tweets = fields.ListField()
total_fetched = fields.IntField()
error_occured = fields.BooleanField()
| 2.640625 | 3 |
sample-viewer-api/src/static/data/exploratory_scripts/2019-07-10_outcomemerge_Refugio.py | cvisb/cvisb_data | 2 | 53560 | # Script to pull outcome data for most recent HLA data from Refugio
import pandas as pd
import os
os.chdir("/Users/laurahughes/GitHub/cvisb_data/sample-viewer-api/src/static/data/")
# from getHLApatients import cleanCohort, cleanOutcome, cleanCountry, getAltIDs
import helpers
import_path = "/Users/laurahughes/GitHub/c... | 2.125 | 2 |
yolo/config.py | chemetc/maskcam | 179 | 53561 | ################################################################################
# Copyright (c) 2020-2021, Berkeley Design Technology, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to ... | 1.476563 | 1 |
source/remediation_runbooks/scripts/CreateAccessLoggingBucket_createloggingbucket.py | j-erickson/aws-security-hub-automated-response-and-remediation | 129 | 53562 | #!/usr/bin/python
###############################################################################
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# #
# Licensed under the Apache License Version 2.0 (the "License"). Y... | 2.015625 | 2 |
ECUInteraction/main.py | arturmrowca/IVNS | 8 | 53563 | <filename>ECUInteraction/main.py
from PyQt4 import QtGui
from gui.main_window import MainWindow
import sys
from gui.direct_view_window import DirectViewWindow, DirectViewer
'''
Later configure from here in some code lines: GUI On GUI off, want to have view x and view y
maybe a api for gui ?
'''
q_app = QtGui.QAppl... | 2.484375 | 2 |
sousvide.py | jscuffell/sous-vide | 0 | 53564 | <filename>sousvide.py<gh_stars>0
import os
import glob
import time
from bottle import Bottle, run, request, response, post, get
import re, json
import RPi.GPIO as GPIO
from lcdtools import LCDDisplay
#import Adafruit_CharLCD as LCD
import threading
import collections
# This script defines the sous vide class, which ca... | 2.671875 | 3 |
src/jirahelper.py | drehtuer/JiraHelper | 0 | 53565 | <gh_stars>0
#!/usr/bin/env python3
"""
This is the main file for JiraHelper
"""
import argparse
import sys
import os
from jira_helper import jirahelper, im_export
def parse_args(argv):
"""
Parse and document arguments
"""
default_start_at = 0
default_max_results = 50
basename = os.path.basenam... | 2.515625 | 3 |
Accounts/serializers.py | oluwex/quizApp | 0 | 53566 | <reponame>oluwex/quizApp
from django.contrib.auth import get_user_model
from rest_framework import serializers
User = get_user_model()
# class RegisterSerializer(serializers.Serializer):
class RegisterSerializer(serializers.ModelSerializer):
# email = serializers.EmailField(
# label='Email Address',
# max_leng... | 2.578125 | 3 |
weis/glue_code/gc_PoseOptimization.py | ebranlard/WEIS | 0 | 53567 | from wisdem.glue_code.gc_PoseOptimization import PoseOptimization
class PoseOptimizationWEIS(PoseOptimization):
def get_number_design_variables(self):
# Determine the number of design variables
n_DV = super(PoseOptimizationWEIS, self).get_number_design_variables()
n_add = 0
... | 2.046875 | 2 |
adelie/train/__init__.py | JRBCH/adelie | 0 | 53568 | from .OnlineTrainer import OnlineTrainer
| 1.09375 | 1 |
Tests/test_testing/_common.py | craneworks/srl-python-lib | 0 | 53569 | <reponame>craneworks/srl-python-lib
from srllib.testing import * | 1.039063 | 1 |
tasks/views.py | hishamkaram/minikube-tutorial | 1 | 53570 | <gh_stars>1-10
from django.http.response import HttpResponse
# Create your views here.
def index(request):
return HttpResponse(b'Hello World!', status=200)
| 2.0625 | 2 |
utils/utils.py | kibeomKim/GACE-GDAN | 28 | 53571 | <reponame>kibeomKim/GACE-GDAN
import numpy as np
import torch
def norm_col_init(weights, std=1.0):
x = torch.randn(weights.size())
x *= std / torch.sqrt((x ** 2).sum(1, keepdim=True))
return x
def ensure_shared_grads(model, shared_model, gpu=False):
for param, shared_param in zip(model.parameters(),
... | 2.328125 | 2 |
tools/w3af/w3af/core/controllers/misc/decorators.py | sravani-m/Web-Application-Security-Framework | 3 | 53572 | <filename>tools/w3af/w3af/core/controllers/misc/decorators.py
"""
decorators.py
Copyright 2011 <NAME>
This file is part of w3af, http://w3af.org/ .
w3af 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 version 2 ... | 2.21875 | 2 |
clippy/command_return.py | gowithfloat/clippy | 2 | 53573 | <filename>clippy/command_return.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Defines the return value from a function, including its documentation and type annotation, if provided.
"""
from typing import Optional
from clippy.command_protocols import CommandProtocol
class CommandReturn(CommandProtocol):
... | 3.078125 | 3 |
Notifier.py | xcollantes/commute-ping | 0 | 53574 | <gh_stars>0
"""Desktop notification system for commuters.
TODO(xcollantes): DO NOT SUBMIT without a detailed description of Notifier.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import subprocess
import requests
from typing import List
from bs4 imp... | 2.9375 | 3 |
gym_multipendulum/__init__.py | GitYiheng/gym-multipendulum | 0 | 53575 | <filename>gym_multipendulum/__init__.py
from gym.envs.registration import register
register(
id='multipendulum-v0',
entry_point='gym_multipendulum.envs:MultipendulumEnv',
)
| 1.4375 | 1 |
risk_sorted/beta/CNY_beta/cal_cny_beta.py | evelynpurse/CTA_summart | 5 | 53576 | <gh_stars>1-10
import pandas as pd
import numpy as np
import statsmodels.api as sm
#读入数据
cnyr=pd.read_csv("../../../data_extraction/cnyr.csv")
cnyx=pd.read_csv("../../../data_extraction/cnyx.csv")
future_price=pd.read_csv("../../../adjust_price/adjust_price.csv")
future_price=future_price.set_index('date')
cnyr=cnyr.s... | 2.296875 | 2 |
xively/managers.py | xively/xively-python | 15 | 53577 | # -*- coding: utf-8 -*-
from collections import Sequence
from datetime import datetime
try:
from urlparse import urljoin
except ImportError:
from urllib.parse import urljoin # NOQA
from xively.models import (
Datapoint,
Datastream,
Feed,
Key,
Location,
Permission,
Resource,
T... | 2.421875 | 2 |
autocat/views.py | maneran/autocat | 0 | 53578 | from django.shortcuts import render
from django.views.generic import CreateView
from django.urls import reverse_lazy
from dal import autocomplete
# from .models import Country, Person
# from .forms import PersonForm
from .models import Country
from .forms import CountryForm
# Create your views here.
# class PersonCrea... | 2.421875 | 2 |
API-extract/flask/extract_members.py | sqlab-sustech/PyCompat | 4 | 53579 | #! /usr/bin/python3
from library_traverser import traverse_module, MemberVisitor, MemberInfoExtractor
import re
import inspect
import pymongo
import flask
import pkgutil
import importlib
sub_modules = [m for m in pkgutil.iter_modules(flask.__path__) if m[2]]
for m in sub_modules:
importlib.import_module("flask.... | 2.3125 | 2 |
talk/src/_1_decorators_bad.py | zangyuchen2008/Clean-Code-in-Python-Second-Edition | 133 | 53580 | <reponame>zangyuchen2008/Clean-Code-in-Python-Second-Edition
"""
Examples of the application of Python decorators in order to
reduce code duplication.
It presents first, the naïve approach, with duplicated code,
and then, the improved solution using decorators.
"""
from base import logger
def decorator(original_funct... | 3.625 | 4 |
Pixelcopter-Agent.py | oghahroodi/RL-Agent | 0 | 53581 | <filename>Pixelcopter-Agent.py
import numpy as np
from ple import PLE
from ple.games.pixelcopter import Pixelcopter
import random
def roundState(state):
newState = {}
for i in state:
if i != 'player_y':
newState[i] = (int(state[i])/60)
return newState
# Making an agent from game env
... | 2.75 | 3 |
Dragon/python/dragon/vm/torch/ops/primitive.py | awesome-archive/Dragon | 0 | 53582 | # ------------------------------------------------------------
# Copyright (c) 2017-present, SeetaTech, Co.,Ltd.
#
# Licensed under the BSD 2-Clause License.
# You should have received a copy of the BSD 2-Clause License
# along with the software. If not, See,
#
# <https://opensource.org/licenses/BSD-2-Clause>
#
# ... | 2.265625 | 2 |
build/lib/bullet/__init__.py | nelice/bullet | 1 | 53583 | from .client import Bullet
from .client import Check | 0.988281 | 1 |
codeBase/ACES_Coders/v8.0/coders/A-walk-to-remember/Solution.py | suren3141/codeBase | 3 | 53584 | '''
This solution was submitted by Team: eyeCoders_UOP
during ACES Coders v8 2020
Team lead: <NAME> <EMAIL>
The solution runs in O(n)
'''
def getline():return [float(x) for x in input().strip().split(' ')]
c,e,n,s0 = getline()
arr, lst = [], []
m = c/s0
for i in range(int(n)):
x,s = getline()
arr.append... | 2.75 | 3 |
stat_result.py | cao13jf/CShaper | 3 | 53585 | <filename>stat_result.py<gh_stars>1-10
import os
import glob
import multiprocessing as mp
import numpy as np
import pandas as pd
from tqdm import tqdm
from scipy import ndimage
from scipy.ndimage.morphology import binary_erosion, binary_dilation
# import user defined library
from Util.data_process import load_3d_volum... | 2.1875 | 2 |
stats.py | firebird631/siis | 0 | 53586 | <reponame>firebird631/siis
import pstats
from pstats import SortKey
p = pstats.Stats('profiling.txt')
p.strip_dirs().sort_stats(-1).print_stats()
| 1.617188 | 2 |
config.py | FarmCodeGary/BlogCompile | 0 | 53587 | # TODO: Make this a relative path
local_url = "/home/garrison/Code/blogengine/output"
remote_url = "http://www.example.com"
site_title = "My Vanilla Blog"
site_description = "The really cool blog in which I write about stuff"
copy_rst = False
disqus_shortname = "mydisqusshortname"
| 1.429688 | 1 |
rest_registration/__init__.py | Neraste/django-rest-registration | 0 | 53588 | __version__ = "0.6.2"
default_app_config = 'rest_registration.apps.RestRegistrationConfig'
| 1.09375 | 1 |
Lab7/Scripts/Registartion.py | sNoDliD/SecondTerm | 0 | 53589 | from Scripts.Resources import Bot, timer
from Scripts.Classes import Markup, button, User
from Scripts.Additional import all_groups, yes_no_markup, get_info
from Scripts.MainMenu import send_student_menu
from DataBase.DataBaseWork import get_query
bot = Bot()
def confirm_user(update, user, params):
answer, stude... | 2.25 | 2 |
test_connection.py | mugofjoe/google-cloud-spanner | 0 | 53590 | from google.cloud import storage
# Explicitly use service account credentials by specifying the private key
# file.
storage_client = storage.Client.from_service_account_json(
'credentials.json')
# Make an authenticated API request
buckets = list(storage_client.list_buckets())
print(buckets) | 2.34375 | 2 |
tests/test_pkg_metadata.py | Algorithmism/quantopian-tools | 1 | 53591 | # -*- coding: utf-8 -*-
import re
import semantic_version
import pytest
import validators
from datetime import datetime
import quantopian_tools
def test_valid_pkg_name():
assert quantopian_tools
assert re.match(r'[a-z][a-z_.]+', quantopian_tools.__pkg_name__)
def test_valid_version():
assert semantic_... | 2.265625 | 2 |
example.py | A1rPun/GarterLine | 0 | 53592 | from garterline import GarterLine
def example1():
line = GarterLine()
line.color("red")
line.text("Hello")
line.color("blue")
line.text("World")
return line
def example2():
percentReady90 = ["In", "other", "words", "it's", "almost", "completed"]
line = GarterLine()
line.color("blue... | 2.71875 | 3 |
imagedt/tensorflow/tools/tfrecords.py | Eddy-zheng/ImageDT | 9 | 53593 | <reponame>Eddy-zheng/ImageDT
# coding: utf-8
from __future__ import absolute_import
from __future__ import print_function
import numpy as np
import tensorflow as tf
from PIL import Image
def visual_records(tfrecords_path):
# make an input queue from the tfrecord file
filename_queue = tf.train.string_inpu... | 2.640625 | 3 |
media/transcoder/create_job_template.py | BaljitSingh919/Project360 | 5,938 | 53594 | <filename>media/transcoder/create_job_template.py
#!/usr/bin/env python
# Copyright 2020 Google 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.... | 2.453125 | 2 |
Fundamentals/Solo_Practice/translate.py | bnonni/Python | 4 | 53595 | in_code = 'abcdefghijklmnopqrstuvwxyz'
out_code = '9128645!@#$%^&*()/.,;:~|[]'
code = str.maketrans(in_code, out_code)
print('this is encrypted!'.translate(code))
| 2.421875 | 2 |
scrapper/new_scrap_data/page_classifier.py | ARQtty/grouple-recsys | 0 | 53596 | import re
from arqtty_scrapper.page_types import Page_types
class Classifier:
def __init__(self, page_str):
self.page = page_str
def _is_404(self):
marker1 = 'Ой, ой, страничка потерялась'
marker2 = 'Спокойно! Логи записаны. Все будет исправлено.'
return re.search(marker1, se... | 2.65625 | 3 |
src/amira_blender_rendering/scenes/__init__.py | nwaniek/amira_blender_rendering | 0 | 53597 | #!/usr/bin/env python
# Copyright (c) 2020 - for information on the respective copyright owner
# see the NOTICE file and/or the repository
# <https://github.com/boschresearch/amira-blender-rendering>.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance w... | 2.03125 | 2 |
agent/sn_agent/agent/test.py | akolonin/singnet | 0 | 53598 | #
# sn_agent/base.py - implementation of abstract class defining API for Network
# communication with block-chain implementations through connections with
# smart contracts and block-chain messaging systems.
#
# Copyright (c) 2017 SingularityNET
#
# Distributed under the MIT software license, see LICENSE file.
#
from ... | 2.1875 | 2 |
app/migrations/0002_alter_project_user.py | kibetrono/Django-Awwards | 0 | 53599 | <reponame>kibetrono/Django-Awwards
# Generated by Django 4.0.3 on 2022-03-13 05:59
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),... | 1.335938 | 1 |