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 |
|---|---|---|---|---|---|---|
trie.py | shivchander/word_grid_solver | 0 | 46000 | #!/usr/bin/env python
"""
trie.py: contains the definition and declaration of the trie class
"""
__author__ = "<NAME>"
__email__ = "<EMAIL>"
class Trie:
"""
Trie/Prefix Tree data structure to efficiently load the dictionary of all valid words
https://en.wikipedia.org/wiki/Trie
"""
def __init__(... | 4.25 | 4 |
Python3/Lists/swapping.py | norbertosanchezdichi/TIL | 0 | 46001 | <filename>Python3/Lists/swapping.py<gh_stars>0
names = ['John', 'Mary']
print(names)
names[0], names[1] = names[1], names[0]
print(names) | 3.453125 | 3 |
2019/day9.py | ellull/codeofadvent2017 | 0 | 46002 | #!/usr/bin/env python3
import fileinput
from collections import defaultdict
from threading import Thread
from queue import Queue
class Memory(defaultdict):
def __init__(self, content):
super(Memory, self).__init__(int, enumerate(content))
def __getitem__(self, address):
if address < 0:
... | 3.203125 | 3 |
test/runtime/frontend_test/onnx_test/defs_test/nn_test/average_pool_test.py | steerapi/webdnn | 1 | 46003 | <reponame>steerapi/webdnn<gh_stars>1-10
import chainer
import numpy as np
from test.runtime.frontend_test.onnx_test.util import make_node, make_tensor_value_info, make_model
from test.util import wrap_template, generate_kernel_test_case
from webdnn.frontend.onnx import ONNXConverter
@wrap_template
def template(N=2, ... | 2.296875 | 2 |
backend/api/adminViews/adminListView.py | CMPUT404-wi21-project/CMPUT404-project-socialdistribution | 1 | 46004 | from django.contrib import admin
from ..services.adminActions import accept_signup_request
# admin list view for signup requests
class signup_request_admin_list_view(admin.ModelAdmin):
list_display = ['username','displayName', 'github', 'host']
ordering = ['username']
actions = [accept_signup_request] | 1.640625 | 2 |
Ex0014/ex0014.py | Rodrigo-Antonio-Silva/ExerciciosPythonCursoemVideo | 0 | 46005 | #utf-8
#Exercício 14 do curso em vídeo de Python
celsius = float((input('Informe a temperatura em °C: ')))
#transformando de celsius para fahrenheit
fahr = (celsius * 9/5) + 32
print('A temperatura de {}°C corresponde a {}°F!'.format(celsius, fahr))
| 3.984375 | 4 |
NestedLoops/SpecialNumbers.py | Mirkonito/Softuni-Python-Basic | 1 | 46006 | number = int(input())
for numbers in range(1111, 9999):
is_Magic = True
number_as_string = str(numbers)
for digit in number_as_string:
if int(digit) == 0:
is_Magic = False
break
elif number % int(digit) != 0:
is_Magic = False
break
if is_Ma... | 3.828125 | 4 |
Algorithm_Functions.py | Karansutradhar/Multi-Penalty-Algorithm-for-Local-Predator-Prey-Planning | 0 | 46007 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import math
def get_min_node_pred(queue):
min_node = 0
for node in range(len(queue)):
if queue[node].cost_for_pred < queue[min_node].cost_for_pred:
min_node = node
return queue.pop(min_node)
def get_min_node_prey(queue):... | 3.546875 | 4 |
pyscrap3/template/+package.name+/+package.name+/items.py | Zincr0/pyscrap3 | 1 | 46008 | #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, software
#distributed under the License is distributed on an "AS IS" BASIS,
#WITHOUT WARRANTIES OR CO... | 2.421875 | 2 |
tests/integration/test_termination.py | jobvs/cf-mendix-buildpack | 1 | 46009 | from tests.integration import basetest
class TestCaseTermination(basetest.BaseTest):
# Tests that the process terminates with a stack trace when Python code
# errors. The env variable S3_ENCRYPTION_KEYS is used here, it doesn't
# have a try-except on it.
# TODO determine if we can unit test this / sh... | 2.40625 | 2 |
lib/horizontal_lines.py | rafelafrance/boyd-bird-journal | 0 | 46010 | """Contains logic that is unique to the horizontal grid lines."""
from lib.grid_lines import GridLines
class Horizontal(GridLines):
"""Contains logic that is unique to the horizontal grid lines."""
def __init__(self, image):
"""Build horizontal grid lines."""
super().__init__(image)
... | 3.671875 | 4 |
Testing/StatusChangerTest.py | crzdg/TrainControlSystem | 2 | 46011 | import StatusChanger.StatusChanger as StatusChanger
from States.States import States
import unittest
class StatusChangerTest(unittest.TestCase):
def test_motor(self):
# start motor, slow
StatusChanger.status_changer(132)
self.assertTrue(States.MOTOR_STARTED)
self.assertTrue(States... | 2.90625 | 3 |
2020/CVE-2020-6207/poc/pocsploit/CVE-2020-6207.py | hjyuan/reapoc | 421 | 46012 | <reponame>hjyuan/reapoc
import requests
# Vuln Base Info
def info():
return {
"author": "cckuailong",
"name": '''SAP Solution Manager remote unauthorized OS commands execution''',
"description": '''SAP Solution Manager (SolMan) running version 7.2 has CVE-2020-6207 vulnerability within the... | 2.15625 | 2 |
tests/models/r-net_dynamic_test.py | matthew-z/pytorch_rnet | 227 | 46013 | <filename>tests/models/r-net_dynamic_test.py
from allennlp.common.testing import ModelTestCase
from qa.squad.rnet import RNet
class RNetDynamicTest(ModelTestCase):
def setUp(self):
super().setUp()
self.set_up_model('tests/fixtures/rnet/experiment_dynamic.jsonnet',
'tests/f... | 2.140625 | 2 |
terraformer.py | nicolebranagan/terraformer | 11 | 46014 | <filename>terraformer.py
#!/usr/bin/python3
import tkinter as tk
import tkinter.ttk as ttk
from tkinter import colorchooser
from tkinter import filedialog
from tkinter import messagebox
import math
import json
import time
import os
import sys
import terralib.palette as palette
import terralib.tool as tool
from terral... | 2.515625 | 3 |
photutils/psf/matching/tests/test_fourier.py | barentsen/photutils | 0 | 46015 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from astropy.tests.helper import pytest
import numpy as np
from numpy.testing import assert_allclose
from astropy.modeling.models import Gaussian2D... | 1.984375 | 2 |
modules/User/UserServices.py | Ankush1122/TripIndia | 3 | 46016 | <filename>modules/User/UserServices.py<gh_stars>1-10
from flask import session
from User import UserRepo
import bcrypt
from datetime import date
class UserServices:
def __init__(self, db) -> None:
self.db = UserRepo.Repo(db)
def login(self, user):
if('@' not in user.userid or len(user.userid... | 3.078125 | 3 |
exercicios.py/ex070.py | Gabriel-Richard/Python-projects | 1 | 46017 | total = contV = mv = 0
nomeMB = ' '
while True:
print('-'*20)
print('LOJA SUPER BARATÃO')
print('-'*20)
nome = str(input('Nome do produto: '))
valor = float(input('Preço: R$'))
total += valor
if valor >= 1000:
contV +=1
if mv == 0 or valor < mv:
mv = valor
... | 3.5625 | 4 |
keylog_no_display.py | Reyogin/py-keylogger | 0 | 46018 | from pynput.keyboard import Key, Listener
import logging
import datetime
import sys
log_file='/home/bertrand/Desktop/file_no_display.log'
logging.basicConfig(filename=log_file, level=logging.DEBUG, format='%(message)s')
message = ""
# stop = False
def on_press(key):
global message
if (hasattr(key, 'name')):
... | 3.046875 | 3 |
pwndb/banner.py | jxlil/pwndb | 5 | 46019 | <gh_stars>1-10
#!/usr/bin/env python3.8
from string import ascii_uppercase, digits
from pwndb import __version__
from pwndb import __author__
from pwndb import __name__
from random import randint, sample
from time import sleep
def _get_random_char_line(num_chars: int) -> list:
return sample(ascii_uppercase + di... | 3.109375 | 3 |
scrapenhl2/plot/game_h2h.py | muneebalam/scrapenhl2 | 17 | 46020 | """
This module contains methods for creating a game H2H chart.
"""
import matplotlib.pyplot as plt
import numpy as np # standard scientific python stack
import pandas as pd # standard scientific python stack
from scrapenhl2.manipulate import manipulate as manip
from scrapenhl2.scrape import schedules, team_info, p... | 3.625 | 4 |
model/contact.py | Dimonaz84/python_course | 0 | 46021 | <filename>model/contact.py
from sys import maxsize
class Contact:
def __init__(self, id=None, first_name=None, last_name=None, home_phone=None,
mobile_phone=None, work_phone=None, secondary_phone=None, all_phones_from_homepage=None,
all_emails_from_homepage=None, address=None, e... | 3.3125 | 3 |
utils/tester.py | niloofar17/MetaDialog | 204 | 46022 | # coding: utf-8
from typing import List, Tuple, Dict
import torch
import logging
import sys
import os
import copy
import json
import collections
import subprocess
from tqdm import tqdm, trange
from torch.utils.data import TensorDataset, DataLoader, RandomSampler, SequentialSampler
from torch.utils.data.distributed impo... | 2.0625 | 2 |
hooks/hooks.py | dellstorage/charm-cinder-dellsc | 0 | 46023 | #!/usr/bin/python
# Copyright 2016 Dell 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 appl... | 1.875 | 2 |
PhythonExercicios/ex056.py | Luis-Otavio-Araujo/Curso-de-Python | 1 | 46024 | <filename>PhythonExercicios/ex056.py
idvelho = 0
nmvelho = ''
idade = 0
media = 0
contM = 0
sexo = ''
for p in range(1, 5) :
print('---- {}° PESSOA ----'.format(p))
nome = str(input('Nome: '))
idade = int(input('Idade: '))
media += idade
sexo = str(input('Sexo [M/F]: '))
if p == 1 and sexo i... | 3.203125 | 3 |
tests/unit/loop/test_splitfuncs.py | benkrikler/alphatwirl | 0 | 46025 | <filename>tests/unit/loop/test_splitfuncs.py<gh_stars>0
import sys
import unittest
from alphatwirl.loop.splitfuncs import *
from alphatwirl.loop.splitfuncs import _apply_max_events_total
from alphatwirl.loop.splitfuncs import _file_start_length_list
from alphatwirl.loop.splitfuncs import _start_length_pairs_for_split_... | 2.609375 | 3 |
tests/helpers/examples/failure_reasons/__init__.py | proofit404/userstories | 187 | 46026 | from enum import Enum
from stories import story
# Base classes.
class ChildWithNull:
@story
def x(I):
I.one
class NextChildWithNull:
@story
def y(I):
I.two
class ParentWithNull:
@story
def a(I):
I.before
I.x
I.after
class SequenceParentWithNull:... | 2.921875 | 3 |
collector.py | sgedward/PL_Hack_2018 | 0 | 46027 | from survey import Survey
from question import Question
class Collector:
def __init__(self,phone,name):
self.phone=phone
self.name=name
self.survey_list={}
self.contact_list={}
self.state=0;
self.cur=None
self.cur_question=None
def create_Survey(self,na... | 3.578125 | 4 |
Python/Books/Learning-Programming-with-Python.Tamim-Shahriar-Subeen/chapter-007/pg-7.4-local-variable.py | shihab4t/Books-Code | 0 | 46028 | <gh_stars>0
def myfnc(x):
print("inside myfnc", x)
x = 10
print("inside myfnc", x)
x = 20
myfnc(x)
print(x)
| 2.703125 | 3 |
figcon/core.py | seismopy/figcon | 0 | 46029 | """
Class for handling options.
"""
import inspect
from typing import Union, Optional
from importlib._bootstrap import module_from_spec
from importlib._bootstrap_external import spec_from_file_location
from pathlib import Path
_path_directives = {'primary', 'secondary', 'default'}
class Figcon:
""" Class for ha... | 2.859375 | 3 |
backend/app/paste/schemas/paste_schema.py | d4sein/Pastebin | 3 | 46030 | <reponame>d4sein/Pastebin
from app import ma
from app.paste.models.paste_model import Paste
class PasteSchema(ma.ModelSchema):
class Meta:
model = Paste
include_fk = True
| 1.765625 | 2 |
UE4Parse/IO/IoObjects/FIoDirectoryIndexEntry.py | MinshuG/pyUE4Parse | 13 | 46031 | from UE4Parse.BinaryReader import BinaryStream
class FIoDirectoryIndexEntry:
Name: int
FirstChildEntry: int
NextSiblingEntry: int
FirstFileEntry: int
def __init__(self, reader: BinaryStream):
self.Name = reader.readUInt32()
self.FirstChildEntry = reader.readUInt32()
self.N... | 2.359375 | 2 |
python/multi_view_learning/nn_leaveOneOut.py | thekingofkings/chicago-crime | 10 | 46032 | <filename>python/multi_view_learning/nn_leaveOneOut.py
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Tensor flow NN model for leave-one-out evaluation.
Created on Fri Apr 7 14:25:01 2017
@author: hxw186
"""
import tensorflow as tf
import numpy as np
import sys
sys.path.append("../")
from feature_evaluation... | 3.125 | 3 |
algo/PDL1net/PDL1netTester.py | itamargru/pathologylab | 0 | 46033 | <reponame>itamargru/pathologylab<gh_stars>0
class PDL1netTester:
"""
class represents a PDL1 net Tester
"""
def __init__(self):
pass
def test(self):
pass
# TODO: add here function to show results and compare different settings result
| 1.96875 | 2 |
tests/unit/test_engine_detection.py | blinkhealth/vault-anyconfig | 6 | 46034 | import pytest
from hypothesis import given, example
import hypothesis.strategies as strat
from vault_anyconfig.vault_anyconfig import VaultAnyConfig
@given(
contents=strat.text(min_size=1, alphabet=strat.characters(blacklist_categories=("C"))),
secret_key=strat.text(min_size=1, alphabet=strat.characters(blac... | 2.21875 | 2 |
Sem8/Server Code with Link.py | sban2009/STCET | 0 | 46035 | """BrandComparator2.ipynb
Server Link: https://colab.research.google.com/drive/15x-yWFGtF57rOCfi9tqEONlYWeGlkoml
[Colab Notebook with Explanation](https://colab.research.google.com/drive/1dYH5PAausru6lQy1dh5-aGC9S9DXO_bV?usp=sharing)
[Anvil App](https://NPFLBAAEVOXXUYZK.anvil.app/QED54JFBPJMZBQPITDWWVL75)
# Inst... | 2.375 | 2 |
Week 3/ex2/courses/course.py | rmit-s3559384-andrew-alvaro/IoT | 0 | 46036 | from abc import ABC, ABCMeta, abstractmethod
class Course(ABC):
def __init__(self, id, name, teacherName, students):
super().__init__()
self.__id = id
self.__name = name
self.__teacherName = teacherName
self.__students = students if students is not None else set()
... | 3.78125 | 4 |
train_xception_unet.py | doublechenching/ship_detection | 8 | 46037 | <filename>train_xception_unet.py
#encoding: utf-8
from __future__ import print_function
from config import config as cfg
from utils import init_env
sess = init_env('0')
from dataset.data import clean_df, dataset_split
from dataset.generators import BaseGenerator
from models import XceptionUnet
from metrics import dice_... | 2.109375 | 2 |
{{ cookiecutter.repo_name }}/{{cookiecutter.source_name}}/core/mixins/pickle_mixin.py | IngerMathilde/cookiecutter-data-science-dev | 1 | 46038 | <filename>{{ cookiecutter.repo_name }}/{{cookiecutter.source_name}}/core/mixins/pickle_mixin.py
import gzip
import pickle
class PickableMixin:
"""A mixins to make a class a pickable object"""
def dump(self, file_name: str) -> None:
with open('{}.pkl'.format(file_name), 'wb') as f:
pickle.d... | 2.34375 | 2 |
tests/test_get_drive_url.py | fem-on-colab/open-in-colab-workflow | 0 | 46039 | # Copyright (C) 2021-2022 by the FEM on Colab authors
#
# This file is part of FEM on Colab-related actions.
#
# SPDX-License-Identifier: MIT
"""Tests for the open_in_colab_workflow.get_drive_url package."""
import os
import tempfile
import pytest
from open_in_colab_workflow.get_drive_url import get_drive_url
@pyt... | 2.40625 | 2 |
cvpysdk/instances/sharepointinstance.py | mattmorganpdx/cvpysdk | 35 | 46040 | # -*- coding: utf-8 -*-
# --------------------------------------------------------------------------
# Copyright Commvault Systems, 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
#
# ... | 1.617188 | 2 |
ecdsa_keygen.py | seandsanders/ecdsa_keygen | 1 | 46041 | import argparse
from binascii import hexlify
from ecdsa import SigningKey, NIST256p
from ecdsa.curves import curves
def generate_ecdsa_keypair(curve):
signing_key = SigningKey.generate(curve=curve)
signing_key.to_string()
verifying_key = signing_key.get_verifying_key()
return signing_key, verifying_ke... | 2.828125 | 3 |
BlockingThreadPoolExecutor.py | etherandrius/information-networks | 0 | 46042 | from concurrent.futures import ThreadPoolExecutor
import queue
class BlockingThreadPoolExecutor(ThreadPoolExecutor):
def __init__(self, max_workers=None, thread_name_prefix=''):
super().__init__(max_workers=max_workers, thread_name_prefix=thread_name_prefix)
self._work_queue = queue.Queue(maxsize=... | 3.125 | 3 |
Data_Conversion/Data_split_result.py | KristofferLM96/TsetlinMachine-GO | 2 | 46043 | import csv
name = "100_9x9Aya"
win = open("Data/Results-Split/" + name + "_win.txt", 'w+')
loss = open("Data/Results-Split/" + name + "_loss.txt", 'w+')
draw = open("Data/Results-Split/" + name + "_draw.txt", 'w+')
def convert(_input):
rows = ''
i = 0
while i < len(_input)-1:
rows = rows + _input... | 3.140625 | 3 |
dev_scripts/git/gsp.py | ajmal017/amp | 0 | 46044 | <filename>dev_scripts/git/gsp.py
#!/usr/bin/env python
"""
Stash the changes in a Git client without changing the client, besides a reset
of the index.
"""
import argparse
import logging
import helpers.dbg as dbg
import helpers.git as git
import helpers.parser as prsr
import helpers.printing as pri
import helpers.sy... | 2.59375 | 3 |
Qt-Widgets-and-more/debuggingHelper/QWAMTypes.py | jgompis/kdabtv | 140 | 46045 | # Check http://doc.qt.io/qtcreator/creator-debugging-helpers.html
# for more details or look at qttypes.py, stdtypes.py, boosttypes.py
# for more complex examples.
from dumper import Children, SubItem, UnnamedSubItem, DumperBase
from utils import DisplayFormat, TypeCode
from qttypes import *
import struct
############... | 2.71875 | 3 |
framework/boards/PUCKJS.py | leeeastwood/Haiway | 162 | 46046 | #!/bin/false
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
#
# Copyright (C) 2013 <NAME> <<EMAIL>>
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.o... | 1.984375 | 2 |
nilearn/reporting/tests/test_sphinx_report.py | ryanhammonds/nilearn | 3 | 46047 | <filename>nilearn/reporting/tests/test_sphinx_report.py
import numpy as np
import os.path as op
from nibabel import Nifti1Image
from sklearn.utils import Bunch
from nilearn.input_data import NiftiMasker
from nilearn.reporting import _ReportScraper
def _gen_report():
""" Generate an empty HTMLReport for testing ""... | 2.328125 | 2 |
libs/utils/energy.py | BayLibre/lisa | 0 | 46048 | # SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2015, ARM Limited and contributors.
#
# 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
#
# ... | 1.90625 | 2 |
tests/processor/data_logminer_rejected_alters.py | albertteoh/data_pipeline | 0 | 46049 | import collections
TestCase = collections.namedtuple('TestCase', "description input_table_name input_commit_statement input_primary_key_fields expected_entries expected_sql")
tests=[
TestCase(
description="Rejected",
input_table_name="ALS2",
input_commit_statement="""ALTER TABLE ALS2 shrink space check"... | 2.015625 | 2 |
graphitepager/graphite_target.py | ProsperWorks/graphite-pager | 0 | 46050 | <filename>graphitepager/graphite_target.py
import os
def get_records(base_url,
http_get,
data_record,
target,
from_ = '-1min',
until_ = None,
http_connect_timeout_s_ = 0.1,
... | 3 | 3 |
c3.4-6_1201_softmax.py | Julia-Run/Dive-into-DL-PyTorch | 0 | 46051 | <filename>c3.4-6_1201_softmax.py<gh_stars>0
import torch
import torchvision
import torchvision.transforms as transforms
import matplotlib.pyplot as plt
import time
import sys
sys.path.append("..")
import d2lzh_pytorch as d2l
mnist_train = torchvision.datasets.FashionMNIST(root='~/Datasets/FashionMNIST', tra... | 2.609375 | 3 |
.archived/snakecode/0007.py | gearbird/calgo | 4 | 46052 | <gh_stars>1-10
class Solution:
def reverse(self, x: int) -> int:
self.setLimit(x)
result = 0
while x != 0:
tail: int = self.mod10(x)
if self.overflow(result, tail):
return 0
result = result * 10 + tail
x = self.divide10(x)
... | 2.828125 | 3 |
tests/runner/test_bobo3_profile.py | andyfase/awscfncli | 60 | 46053 | from awscfncli2.runner import Boto3Profile
class TestStackSelector(object):
def test_update(self):
s1 = Boto3Profile('foo','bar')
s2 = Boto3Profile('foo', 'baz')
assert s1.region_name == 'bar'
s1.update(s2)
| 2.3125 | 2 |
Lectures_Codes/examples-05/lecture05/lenghts_of_words_example/lengths_of_words.py | MichalKyjovsky/NPRG065_Programing_in_Python | 0 | 46054 | <reponame>MichalKyjovsky/NPRG065_Programing_in_Python
from collections import Counter, defaultdict
from stats import print_histogram_2d
# This is a list of characters that are interpreted as punctuations and thus ignored.
punctuation_chars = ",;:.?!()[]<>/-'\""
trtrable = str.maketrans(punctuation_chars, " " * len(pun... | 4.03125 | 4 |
results_to_csv.py | swenkel/python-math-benchmark | 2 | 46055 | <filename>results_to_csv.py<gh_stars>1-10
################################################################################
# #
# Script to convert results to csv #
# ... | 2.59375 | 3 |
malaya_speech/train/model/resnet_unet_enhancement/model.py | ishine/malaya-speech | 111 | 46056 | import tensorflow as tf
from tensorflow.keras.layers import (
BatchNormalization,
LeakyReLU,
Activation,
Conv1D,
ELU,
Add,
)
from functools import partial
from tensorflow.compat.v1.keras.initializers import he_uniform
def _get_conv_activation_layer(params):
"""
:param params:
:retu... | 2.515625 | 3 |
mnist_TF_layers.py | hughkong/asstarer | 1 | 46057 | # 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, software
# distributed under th... | 2.296875 | 2 |
src/isl_utils.py | kkourt/cmnnc | 8 | 46058 | <reponame>kkourt/cmnnc
# Copyright (c) 2019, IBM Research.
#
# Author: <NAME> <<EMAIL>>
#
# vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4:
import typing
import ast as pyast
import islpy as isl
# import ast as pyast
# import astor as pyastor
# from astpp import parseprint, dump as astpp_dump
# TODO: add a... | 2.203125 | 2 |
src/robotide/lib/robot/running/outputcapture.py | veryl-technologies/t24-tests-ide | 8 | 46059 | <gh_stars>1-10
# Copyright 2008-2012 Nokia Siemens Networks Oyj
#
# 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... | 1.898438 | 2 |
utils.py | yinziyan1206/nado_unit | 0 | 46060 | <gh_stars>0
#!/usr/bin/python3
__author__ = 'ziyan.yin'
from threading import Lock
from typing import Dict
from .unit import units
locks: Dict[str, Lock] = dict()
def synchronized(func):
key = f"{repr(func)}"
if key not in locks:
locks[key] = Lock()
def wrapper(*args, **kwargs):
with l... | 2.609375 | 3 |
old_bin/fwhmSweepTmp.py | sdss/ObserverTools | 0 | 46061 | #!/usr/bin/env python3
# usage:
# fwhmSweep.py 56530 7 14
# fwhmSweep.py <mjd> <file number first> <file nimber last>
import glob
import pyfits
import sys, os
import numpy as np
from scipy import ndimage
from pylab import *
import scipy
directory="/data/ecam/%s/" % (sys.argv[1])
# if directory exist?
if os.pa... | 1.953125 | 2 |
code/satellite_shuffler.py | mjvakili/gambly | 1 | 46062 | <filename>code/satellite_shuffler.py
'''
This is copied from <NAME>'s
galactic conformity repo:
https://github.com/duncandc/galactic_conformity/blob/d34499507558d90c68e50adb559aa3671d1cc420/mock/shuffling/make_satrel_shuffle_hearin_mocks.py
'''
import numpy as np
import h5py
import sys
from astropy.io import ascii
fr... | 2.421875 | 2 |
tests/test_stopwatch.py | Harlocks/python-stopwatch2 | 0 | 46063 | from pytest import fixture
from pytest_mock import MockerFixture
from stopwatch import Stopwatch
from .mocks.time import TimeMock
def describe_stopwatch() -> None:
@fixture
def time_mock() -> TimeMock:
return TimeMock()
def describe_start() -> None:
def with_stop(mocker: MockerFixture, ... | 2.4375 | 2 |
Curso de Cisco/Actividades/Operaciones con cadenas - min().py | tomasfriz/Curso-de-Cisco | 0 | 46064 | <reponame>tomasfriz/Curso-de-Cisco
# Demonstrando min() - Ejemplo 1
print(min("aAbByYzZ"))
# Demonstrando min() - Examplos 2 y 3
t = 'Los Caballeros Que Dicen "¡Ni!"'
print('[' + min(t) + ']')
t = [0, 1, 2]
print(min(t)) | 3.65625 | 4 |
tests/ribbon/loadbalancer/dynamic_server_list_load_balancer_test.py | haribo0915/Spring-Cloud-in-Python | 5 | 46065 | # -*- coding: utf-8 -*-
__author__ = "MJ (<EMAIL>)"
__license__ = "Apache 2.0"
# scip plugin
from ribbon.client.config.client_config import ClientConfig
from ribbon.eureka.discovery_enabled_server import DiscoveryEnabledServer
from ribbon.loadbalancer.dynamic_server_list_load_balancer import DynamicServerListLoadBala... | 1.796875 | 2 |
modes.py | nondejus/bitcoind-ncurses2 | 72 | 46066 | # Copyright (c) 2014-2017 esotericnonsense (<NAME>)
# Distributed under the MIT software license, see the accompanying
# file COPYING or https://opensource.org/licenses/mit-license.php
from macros import MODES
class ModeHandler(object):
def __init__(self, base_callbacks):
self._mode = None
self.... | 2.046875 | 2 |
check_requirements_txt.py | ferstar/check-requirements-txt | 1 | 46067 | <filename>check_requirements_txt.py
import argparse
import os
import re
import sys
from collections import defaultdict
from pathlib import Path
from typing import Dict
from typing import Generator
from typing import Iterable
from typing import List
from typing import Optional
from typing import Sequence
from typing imp... | 2.515625 | 3 |
bpg_file_size.py | yoshitomo-matsubara/supervised-compression | 12 | 46068 | import argparse
import os
import numpy as np
from torchdistill.datasets.transform import CustomCompose, CustomRandomResize
from torchdistill.datasets.util import load_coco_dataset, build_transform
from torchvision.datasets import ImageFolder, VOCSegmentation
from torchvision.transforms import transforms
from custom.t... | 2.21875 | 2 |
setup.py | Don-Felice/photoraspi | 0 | 46069 | <filename>setup.py
from setuptools import setup
setup(
name='photoraspi',
version='0.1.0',
author='<NAME>',
packages=['photoraspi'],
license='LICENSE',
description='Photography tools using the raspberry pi',
entry_points={
'console_scripts': [
'photoraspi = photoraspi._... | 1.132813 | 1 |
psx/_dump_/17/_dump_ida_/set_vars.py | maoa3/scalpel | 15 | 46070 | <filename>psx/_dump_/17/_dump_ida_/set_vars.py
del_items(0x80114B24)
SetType(0x80114B24, "int NumOfMonsterListLevels")
del_items(0x800A49E4)
SetType(0x800A49E4, "struct MonstLevel AllLevels[16]")
del_items(0x80114820)
SetType(0x80114820, "unsigned char NumsLEV1M1A[4]")
del_items(0x80114824)
SetType(0x80114824, "unsigne... | 1.359375 | 1 |
sdk/python/pulumi_grafana/organization.py | mazamats/pulumi-grafana | 7 | 46071 | <filename>sdk/python/pulumi_grafana/organization.py
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import json
import warnings
import pulumi
import pulumi.runtime
from typing import ... | 2.234375 | 2 |
backend/chineseocr_lite/config.py | MrZilinXiao/Fighting-Meme-python-wechaty | 6 | 46072 | import os
filt_path = os.path.abspath(__file__)
father_path = os.path.abspath(os.path.dirname(filt_path) + os.path.sep + ".")
GPU_ID = 0
# psenet相关
pse_long_size = 960 # 图片长边
pse_model_type = "mobilenetv2"
pse_scale = 1
if pse_model_type == "mobilenetv2":
pse_model_path = os.path.join(father_path, "models/psen... | 2.140625 | 2 |
stac/test_sort.py | amandaortega/stac | 0 | 46073 | <filename>stac/test_sort.py<gh_stars>0
from sort_algorithms import sort_algorithms
def print_sort(database_path, alpha, header):
print(header)
[rankings, average, better, worse] = sort_algorithms(database_path, alpha)
print('Rankings: ', rankings, '\n')
print('Average: ', average, '\n')
print('#<... | 2.640625 | 3 |
src/utils.py | zongxj/simple-cloud-disk | 1 | 46074 | import os
from . import db
from .form import User
from .const import SCP_DIR, DISK_DIR
def delete_admin():
"""
删除管理员账号
:return:
"""
users = User.query.all()
for u in users:
db.session.delete(u)
db.session.commit()
def get_disk_main_dir():
"""
获取网盘主目录
:return:
"""... | 2.78125 | 3 |
sloth_job/admin.py | Alexoner/sloth | 0 | 46075 | <filename>sloth_job/admin.py
from django.contrib import admin
from .models import Proxy
# Register your models here.
admin.site.register(Proxy)
| 1.429688 | 1 |
gerritviewer/views/groups.py | tivaliy/gerrit-quick-viewer | 0 | 46076 | <reponame>tivaliy/gerrit-quick-viewer<filename>gerritviewer/views/groups.py
#
# Copyright 2017 <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... | 1.914063 | 2 |
postRunScripts/convergence.py | burks-pub/gecco2015 | 0 | 46077 | <reponame>burks-pub/gecco2015<gh_stars>0
#!/usr/bin/python
import sys
import os
import re
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D
import numpy as np
import scipy.stats as stats
#Matplotlib font stuff (for making figures with legible text)
font = {'size': '9'}
matplotlib.r... | 2.296875 | 2 |
doppler_imaging/training/lstm.py | aasensio/DeepLearning | 0 | 46078 | import numpy as np
import matplotlib.pyplot as pl
import os
from ipdb import set_trace as stop
os.environ["KERAS_BACKEND"] = "tensorflow"
from keras.optimizers import Adam
from keras.layers import Dense, LSTM, Input, TimeDistributed, Flatten
from keras.models import Model
import tensorflow as tf
import keras.backend.... | 2.703125 | 3 |
nautobot_ssot/tests/test_views.py | smk4664/nautobot-plugin-ssot | 9 | 46079 | <reponame>smk4664/nautobot-plugin-ssot
"""View test cases for nautobot_ssot."""
from datetime import datetime
import uuid
from django.contrib.contenttypes.models import ContentType
from django.urls import reverse
from nautobot.extras.models import Job, JobResult
from nautobot.users.models import ObjectPermission
fro... | 2.171875 | 2 |
src/aspire/utils/em.py | janden/ASPIRE-Python | 0 | 46080 | """
Utility functions for Electron-Microscopy
"""
import math
def voltage_to_wavelength(voltage):
"""
Convert from electron voltage to wavelength.
:param voltage: float, The electron voltage in kV.
:return: float, The electron wavelength in nm.
"""
return 12.2643247 / math.sqrt(voltage*1e3 + ... | 3.09375 | 3 |
larpWikiAnomalyScanner.py | AllanWegan/larpWikiAnomalyScanner | 0 | 46081 | #!/usr/bin/env python3
import time
import re
import glob
import os
import platform
import sys
import unicodedata
import urllib.parse
import codecs
import queue
from multiprocessing import Process, Event, Queue
from collections import Counter
baseDir = os.path.dirname(__file__)
sourceDir = os.path.join(baseDir, 'back... | 2.28125 | 2 |
1 MyPractice/A_Tutorials/Socratica/2InteractiveHelp.py | Davidjbennett/DavidBennett.github.io | 3 | 46082 | <reponame>Davidjbennett/DavidBennett.github.io
import math
print(dir()) #short for directory
#print(dir(__builtins__)) #containes many functions and types
help(pow) #shows documentation for specific function
print(pow(2,10),"\n")
help(hex)
print("\n", hex(10))
print(0xa,"\n")
#help('modules')
print(dir(math))
| 2.5 | 2 |
voicefixer/vocoder/config.py | ishine/voicefixer | 159 | 46083 | <reponame>ishine/voicefixer<filename>voicefixer/vocoder/config.py
import torch
import numpy as np
import os
from voicefixer.tools.path import root_path
class Config:
@classmethod
def refresh(cls, sr):
if sr == 44100:
Config.ckpt = os.path.join(
os.path.expanduser("~"),
... | 2.03125 | 2 |
build/platform/python/tests/test_common.py | jochenater/catboost | 6,989 | 46084 | import subprocess
import pytest
from build.platform.python.tests import testlib
PYTHON_VERSIONS = ["2.7", "3.4", "3.5", "3.6"] # 3.7, 3.8 are not runnable
@pytest.mark.parametrize("pyver", PYTHON_VERSIONS)
def test_version_matched(pyver):
testlib.check_python_version(pyver)
@pytest.mark.parametrize("pyver",... | 2.0625 | 2 |
test.py | grvkmrpandit/competitiveprogramming | 3 | 46085 | class MinStack(object):
def __init__(self):
"""
data structure .
"""
self.stack = []
self.minimum = None
def push(self, x):
"""
:type x: int
:rtype: None
"""
if len(self.stack) == 0:
self.stack.append(x)
... | 4 | 4 |
app.py | Garimadhall4/Breast-cancer-detection | 0 | 46086 | <reponame>Garimadhall4/Breast-cancer-detection
from flask import Flask ,request,render_template
import requests
import numpy as np
import pandas as pd
import pickle
app= Flask(__name__, static_url_path="/static")
model=pickle.load(open("BREAST_CANCER_MODEL.pkl",'rb'))
@app.route("/",methods=["GET"])
def... | 2.875 | 3 |
faststats/hist.py | mfouesneau/faststats | 25 | 46087 | from __future__ import print_function
import numpy as np
from scipy import sparse
from scipy.interpolate import griddata
def fast_histogram2d(x, y, bins=10, weights=None, reduce_w=None, NULL=None,
reinterp=None):
"""
Compute the sparse bi-dimensional histogram of two data samples where *x... | 3.3125 | 3 |
wetrunner/classes.py | DavidMStraub/python-wetrunner | 0 | 46088 | <filename>wetrunner/classes.py<gh_stars>0
"""Defines the `WET` class that provides the main interface to the wetrunner
package."""
import wcxf
from wcxf.util import qcd
from wetrunner import rge, definitions
from wetrunner.parameters import p as default_parameters
from collections import OrderedDict
class WETrunner... | 2.828125 | 3 |
src/score.py | alexwarstadt/phrase-analogies-large-vae | 1 | 46089 | <filename>src/score.py
import re
from nltk.translate import bleu_score as nltkbleu
from typing import List, Optional
import nli
def exact_calc(output, pred):
try:
assert isinstance(output, str) and isinstance(pred, str)
except AssertionError:
print("Error: Trying to compare {} and {}".format(... | 2.796875 | 3 |
examples/anomaly_detection.py | KrishnanSG/pytsal | 32 | 46090 | """
Holt Winter Anomaly detection Example
In this example we will look into how to create holt winters model and build an anomaly detection model
in less than 4 steps.
"""
if __name__ == '__main__':
from pytsal import anomaly, forecasting
from pytsal.dataset import *
# 1. Load the dataset
ts_... | 3.296875 | 3 |
bili_kits/account/__init__.py | LonelySteve/Bili-Kits | 0 | 46091 | from .user import BaseUser,WebUser,ClientUser,UserNotLoginError,get_user_card_info | 1.21875 | 1 |
personalwebsite/project/views.py | Liuqian0501/personalwebsite | 0 | 46092 | from django.shortcuts import render
from django.views.decorators.csrf import csrf_exempt
from django.core.files.storage import default_storage
from django.core.files.base import ContentFile
from django.conf import settings
from .models import ContentImage
import io
import os
import json
from .src.trans_model import Tr... | 1.921875 | 2 |
appengine/findit/waterfall/try_job_util.py | eunchong/infra | 0 | 46093 | <gh_stars>0
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
from google.appengine.ext import ndb
from common import appengine_util
from common import constants
from model import analysis_s... | 2.03125 | 2 |
galaxy_dive/analyze_data/gridded_data.py | zhafen/galaxy-dive | 0 | 46094 | <filename>galaxy_dive/analyze_data/gridded_data.py
#!/usr/bin/env python
'''Subclass for analyzing particle data.
@author: <NAME>
@contact: <EMAIL>
@status: Development
'''
import h5py
import numpy as np
import galaxy_dive.utils.io as io
import galaxy_dive.analyze_data.simulation_data as simulation_data
import galax... | 2.71875 | 3 |
tests/dsdcompiler/test_compiler.py | DNA-and-Natural-Algorithms-Group/nuskell | 5 | 46095 | #
# Unittests for nuskell.dsdcompiler.compiler
#
# Written by <NAME> (<EMAIL>).
#
import unittest
from nuskell.dsdcompiler.objects import clear_memory, NuskellComplex
from nuskell.dsdcompiler.compiler import translate
class Test_Workflow(unittest.TestCase):
def setUp(self):
NuskellComplex.ID = 1
def ... | 2.375 | 2 |
pa1/solution/runtagger.py | le0tan/cs4248-pos-tagger | 0 | 46096 | <reponame>le0tan/cs4248-pos-tagger<gh_stars>0
# python3.5 runtagger.py <test_file_absolute_path> <model_file_absolute_path> <output_file_absolute_path>
import os
import math
import sys
import datetime
import re
import json
START_TAG = '<s>'
END_TAG = '</s>'
UNKNOWN_TAG = '<UNK>'
SUM_TAG = '<SUM>'
SEEN_TAG = '<SEEN>'
... | 2.09375 | 2 |
src/boiga/util.py | amarshall/boiga | 2 | 46097 | <reponame>amarshall/boiga<filename>src/boiga/util.py<gh_stars>1-10
import typing as T
_T = T.TypeVar('_T')
class _Container(T.Generic[_T]):
_value: _T
def __eq__(self, other: object) -> bool:
if isinstance(other, self.__class__):
return self._value == other._value
else:
... | 2.46875 | 2 |
homeassistant/components/aruba_instant/device_tracker.py | mww012/home-assistant | 0 | 46098 | <filename>homeassistant/components/aruba_instant/device_tracker.py
"""Aruba Instant Device Tracker"""
from datetime import timedelta
import logging
from homeassistant.components.device_tracker.config_entry import ScannerEntity
from homeassistant.components.device_tracker.const import SOURCE_TYPE_ROUTER
from homeassis... | 2.015625 | 2 |
cryptodock_suite/actions/order_rate_over_time/__init__.py | the-launch-tech/cryptodock-suite | 0 | 46099 | __all__ = [
'order_rate_over_time'
]
from .order_rate_over_time import order_rate_over_time
| 1.109375 | 1 |