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 |
|---|---|---|---|---|---|---|
genalog/text/lcs.py | jingjie181/genalog | 185 | 50300 | <filename>genalog/text/lcs.py
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# ---------------------------------------------------------
class LCS:
""" Compute the Longest Common Subsequence (LCS) of two give... | 3.328125 | 3 |
src/tlstofu.py | faelif/tls-tofu | 1 | 50301 | <filename>src/tlstofu.py
#!/usr/bin/env python3
#
#
import pathlib # to find config directory
import os # to make config directory
import datetime # for datetime.now()
import ssl # for ssl.CertificateError
import ipaddress # to test if an address is an ipaddress
import re # to match hostnames to eachother
impor... | 3.0625 | 3 |
play_athan.py | nabeel-/rpi-athan | 0 | 50302 | #!/usr/bin/env python
import os
import time
import datetime
from soco import SoCo
from threading import Thread
from SocketServer import TCPServer
from __future__ import print_function
from SimpleHTTPServer import SimpleHTTPRequestHandler
# Athan files names - mp3 files should be placed in the same folder as script
RE... | 2.734375 | 3 |
tests/annotations/test_invariants.py | QPC-database/pybryt | 1 | 50303 | <gh_stars>1-10
"""Tests for value annotation invariants"""
import numpy as np
from unittest import mock
from pybryt.annotations.invariants import *
def test_call_structure():
with mock.patch.object(invariant, "run") as mocked_run:
invariant()
mocked_run.assert_called()
assert invariant([])... | 2.703125 | 3 |
balebot/models/constants/errors.py | ehsanbarkhordar/reminder_bot | 24 | 50304 | class Error:
none_or_invalid_attribute = "main attributes should have value."
unacceptable_json = "json input has unacceptable format."
unacceptable_object_type = "object has unacceptable type"
| 1.6875 | 2 |
aula2/decorador.py | es99/curso-flask | 1 | 50305 | <filename>aula2/decorador.py
from datetime import datetime
def grava_arquivo():
data = datetime.now().strftime("%d/%/%Y - %H:%M")
with open('logs.txt', 'a') as file:
file.write("email enviado " + data)
def verifica(function):
def wrapper():
grava_arquivo()
function()
return wra... | 3.140625 | 3 |
service/renderers.py | johnpooch/diplomacy | 1 | 50306 | <reponame>johnpooch/diplomacy<gh_stars>1-10
from rest_framework import renderers
from service.utils.cases import deep_camel_case_transform
class CamelCaseRenderer(renderers.JSONRenderer):
def render(self, data, *args, **kwargs):
camelized_data = deep_camel_case_transform(data)
return super().rend... | 2.234375 | 2 |
rent/migrations/0007_rentorder_money.py | wy672515431/- | 0 | 50307 | # Generated by Django 3.0.3 on 2020-06-12 04:39
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rent', '0006_rentorder_pay'),
]
operations = [
migrations.AddField(
model_name='rentorder',
name='money',
... | 1.625 | 2 |
releaseherald/releaseherald/plugins/hookspecs.py | Morgan-Stanley/Testplan | 0 | 50308 | <gh_stars>0
from typing import List, Dict, Any
import pluggy
from git import Repo, Tag
from releaseherald.configuration import Configuration
from releaseherald.plugins import CommitInfo
from releaseherald.plugins.interface import (
MutableProxy,
VersionNews,
News,
Output,
CommandOptions,
)
hookspe... | 2.359375 | 2 |
opennmt/tests/vocab_test.py | mfomicheva/OpenNMT-tf | 4 | 50309 | <reponame>mfomicheva/OpenNMT-tf
# -*- coding: utf-8 -*-
import os
import tensorflow as tf
from opennmt.utils import Vocab
from opennmt.tests import test_util
class VocabTest(tf.test.TestCase):
def testSimpleVocab(self):
vocab = Vocab()
self.assertEqual(0, vocab.size)
vocab.add("toto")
vocab.ad... | 2.4375 | 2 |
src/parma/core.py | dougmvieira/parma | 3 | 50310 | <filename>src/parma/core.py
import numpy as np
from scipy.special import xlogy
from .utils import polynomial_powers
class PolyharmonicLagrangeInterpolator:
""" Polyharmonic Lagrange spline interpolation of the function values.
Parameters
----------
x : (n+1)-D array-like
Location of the int... | 2.71875 | 3 |
pippin/classifiers/unity.py | dessn/Pippin | 5 | 50311 | <reponame>dessn/Pippin
import os
import shutil
import subprocess
import pandas as pd
from astropy.io import fits
import numpy as np
from pippin.classifiers.classifier import Classifier
from pippin.config import chown_dir, mkdirs
from pippin.task import Task
class UnityClassifier(Classifier):
""" Classification t... | 2.171875 | 2 |
yyx_annotate_HTGTS_VDJ_pipeline.20200219.py | Yyx2626/VDJ_annotation | 0 | 50312 |
#### Usage: python3 this.py <VDJ.bed> <D.fa> <scripts_dir> <input.tlx> <output_prefix>
#### 2020-02-11, we think the default score threshold = 5 of D annotation in VDJ recombination (yyx_annotate_tlx_midD_LCS.20190116.py) may be too stringent.
#### We decide to change it to 3, and then implement another script to ... | 2.1875 | 2 |
src/searchnets/config/train.py | NickleDave/visual-search-nets | 5 | 50313 | <gh_stars>1-10
"""class to represent train section of config.ini file """
from pathlib import Path
import attr
from attr import converters, validators
from attr.validators import instance_of
from ..utils.general import projroot_path
def is_pos_int(instance, attribute, value):
if type(value) != int:
rais... | 2.671875 | 3 |
src/schema.py | vkhaydarov/vkhaydarov-planteye-vision | 0 | 50314 | <reponame>vkhaydarov/vkhaydarov-planteye-vision<gh_stars>0
from json import load
from jsonschema import validate, exceptions
def get_schema(schema_file):
"""
This function returns the json config schema
:return: Validation schema
"""
with open(schema_file, 'r') as file:
schema = load(file)... | 2.75 | 3 |
release/scripts/presets/camera/Samsung_Galaxy_S4.py | rbabari/blender | 365 | 50315 | <reponame>rbabari/blender
import bpy
bpy.context.camera.sensor_width = 4.8
bpy.context.camera.sensor_height = 3.6
bpy.context.camera.lens = 4.20
bpy.context.camera.sensor_fit = 'HORIZONTAL'
| 1.492188 | 1 |
Resene naloge/euler26.py | CadezDavid/ProjectEuler | 0 | 50316 | <reponame>CadezDavid/ProjectEuler<filename>Resene naloge/euler26.py<gh_stars>0
def decimalni_zapis(deljenec, delitelj):
memo = set()
decimalni_zapis = ''
while (deljenec, delitelj) not in memo:
if deljenec % delitelj == 0:
decimalni_zapis += str(deljenec // delitelj)
return d... | 3.34375 | 3 |
dlkit/authz_adapter/osid/sessions.py | UOC/dlkit | 2 | 50317 | <reponame>UOC/dlkit
"""AuthZ Adapter implementations of osid sessions."""
# pylint: disable=no-init
# Numerous classes don't require __init__.
# pylint: disable=too-many-public-methods
# Number of methods are defined in specification
# pylint: disable=too-many-ancestors
# Inheritance defined in specificatio... | 2.1875 | 2 |
wikipya/drivers.py | jDan735/wikipya | 2 | 50318 | <filename>wikipya/drivers.py
try:
import aiohttp
except:
pass
try:
import httpx
except:
pass
import time
import json
from .exceptions import ParseError
class JSONObject:
"""JSON => Class"""
def __init__(self, dict):
self.add(dict)
def add(self, dict):
vars(self).update(... | 2.609375 | 3 |
matrix/matrix.py | jjbits/AlgorithmicBits | 0 | 50319 | <reponame>jjbits/AlgorithmicBits
# Copyright (C) 2018 by <NAME>
#
# This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
#
# Strassen Multiplication
# M1 = (A11 + A22)(B11 + B22)
# M2 = (A21 + A22)B11
# M3 = A11(B12 - B22)
# M4 = A22(B21 - B11)
# M5 = (A11 + A12)B22
# M6 = (A21 - A11... | 3.40625 | 3 |
async_signalr_client/models/messages/cancel_invocation.py | jvillacorta/async-signalr-client | 2 | 50320 | from async_signalr_client.models.messages.base import BaseSignalRMessage
from async_signalr_client.models.messages.types import SignalRMessageType
class CancelInvocationMessage(BaseSignalRMessage):
def __init__(self, invocation_id: str):
super().__init__(SignalRMessageType.CANCEL_INVOCATION)
self.... | 1.851563 | 2 |
copilot/migrations/0002_auto_20170701_1235.py | febsn/djangocms-copilot | 0 | 50321 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
('cms', '0016_auto_20160608_1535'),
('copilot', '0001_initial'),
]
operations = [
migrat... | 1.8125 | 2 |
fts/models.py | filwaitman/django-fts | 0 | 50322 | """
Full Text Search Framework
"""
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from fts.settings import *
if FTS_BACKEND.startswith('simple://'):
class IndexWord(models.Model):
word = models.CharField(uniq... | 2.21875 | 2 |
experiencia/models.py | JVacca12/FIRST | 0 | 50323 | <filename>experiencia/models.py<gh_stars>0
from django.db import models
from users.models import User
# Create your models here.
class Experiencia(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='experiencia')
cargo = models.CharField(max_length=120)
fecha_inicio = mod... | 2.734375 | 3 |
encrypt.py | atomlong/gh-update-secret | 0 | 50324 | # Copyright 2021 METRO Digital GmbH
#
# 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 wr... | 2.8125 | 3 |
1301-1400/1344-Counter Diagonal Sort/1344-Counter Diagonal Sort.py | jiadaizhao/LintCode | 77 | 50325 | class Solution:
"""
@param grids: a maxtrix with alphabet
@return: return sorted lists
"""
def CounterDiagonalSort(self, grids):
# write your code here
m = len(grids)
n = len(grids[0])
table = []
for i in range(m):
temp = []
row = i
... | 3.40625 | 3 |
concept/generator-function.py | arijitsdrush/python | 0 | 50326 | <reponame>arijitsdrush/python<filename>concept/generator-function.py
#!/usr/bin/python3
bridgera = ['Arijit','Soumya','Gunjan','Arptia','Bishwa','Rintu','Satya','Lelin']
# Generator Function iterarates through all items of array
def gen_func(data):
for i in range(len(data)):
yield data[i]
da... | 3.5 | 4 |
Data-Structures/Arrays & LinkedLists/SinglyLinkedList.py | akhopkar01/Data-structures-and-Algorithms | 1 | 50327 | <filename>Data-Structures/Arrays & LinkedLists/SinglyLinkedList.py
class Node:
def __init__(self, value):
self.value = value
self.next = None
class LinkedList:
"""
Class to create a linked list and perform some basic operations such as:
append, display, prepend, convert, insert, remove... | 4.09375 | 4 |
Task/Gray-code/Python/gray-code-1.py | LaudateCorpus1/RosettaCodeData | 1 | 50328 | >>> def int2bin(n):
'From positive integer to list of binary bits, msb at index 0'
if n:
bits = []
while n:
n,remainder = divmod(n, 2)
bits.insert(0, remainder)
return bits
else: return [0]
>>> def bin2int(bits):
'From binary bits, msb at index 0 to integer'
i = 0
for bit in bits:
i = i * 2 + bit... | 3.796875 | 4 |
initial_filter.py | ParanoidAndroidMarvin/BattlesnakePY | 0 | 50329 | from typing import List, Dict
from constants import directions
def avoid_walls(my_head: Dict[str, int], board_width: int, board_height: int, possible_moves: List[str]) -> List[str]:
"""
my_head: Dictionary of x/y coordinates of the Battlesnake head.
e.g. {"x": 0, "y": 0}
board_width: Width of th... | 3.671875 | 4 |
websqlrunner/websqlrunner/views.py | rosslyn-sergio/sqlRunner | 0 | 50330 | import datetime
import re
from django.conf import settings
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render
from django.shortcuts import redirect
from .core.sqlRunner import *
from .core.SqlRunnerThread import *
from .forms import SqlScriptForm
from .forms import RunForm
... | 2.203125 | 2 |
mqueue/tests/test_apps.py | synw/django-mqueue | 29 | 50331 | <filename>mqueue/tests/test_apps.py
from .base import MqueueBaseTest
from django.apps import apps
class MqueueTestApps(MqueueBaseTest):
def test_apps(self):
apps.get_app_config("mqueue")
def test_apps_import_error(self):
req = (("wrong.model.path", ["c", "d", "u"]),)
with self.setting... | 2.21875 | 2 |
bluebottle/bb_donations/serializers.py | maykinmedia/bluebottle | 0 | 50332 | # coding=utf-8
from bluebottle.utils.model_dispatcher import get_donation_model
from bluebottle.utils.serializer_dispatcher import get_serializer_class
from rest_framework import serializers
DONATION_MODEL = get_donation_model()
class ManageDonationSerializer(serializers.ModelSerializer):
project = serializers.S... | 1.953125 | 2 |
src/ultru_client/utils/config.py | Ultru/ultru-client | 0 | 50333 | import json
import os
from .globals import CLI_GLOBALS
def __maybe_init_config():
if not os.path.exists(CLI_GLOBALS.ULTRU_CLI_CONFIG_DIR):
os.mkdir(CLI_GLOBALS.ULTRU_CLI_CONFIG_DIR)
if not os.path.exists(CLI_GLOBALS.CONFIG):
with open(CLI_GLOBALS.CONFIG, 'w') as config_fp:
json.dump... | 2.296875 | 2 |
samConcat2Tag.py | wlokhorst/proc10xG | 0 | 50334 | <filename>samConcat2Tag.py
#!/usr/bin/env python
'''
Copyright 2017 <NAME>
Created June 8, 2017
Revised by <NAME>, 5FEB2019
bwa mem -C option concatenates the fasta/fastq
CTACATTGTCAAGGGT:E00558:34:HGCJ3ALXX:1:1101:2108:1731 99 000000F 9225\
71 60 127M = 922961 517 ACTCGGGGAGGTGTTAGCTGCTGCC... | 2.296875 | 2 |
lang/jquery_python/read/master_python_read.py | ekzemplaro/data_base_language | 3 | 50335 | #! /usr/bin/python3
# -*- coding: utf-8 -*-
#
# master_python_read.py
#
# Jul/31/2014
import sys
import json
#
#
sys.path.append ('/var/www/data_base/common/python_common')
from text_manipulate import dict_append_proc
# ---------------------------------------------------------------------
def data_prepare_proc ():
... | 2.234375 | 2 |
dpc_Lstar_db.py | seanandrews/ARAA | 0 | 50336 | <reponame>seanandrews/ARAA<filename>dpc_Lstar_db.py<gh_stars>0
import numpy as np
import os
import sys
from astropy.io import ascii
from plx_dist import plx_dist
from post_summary import post_summary
# load database
os.system('cp -r DISKS.csv temp.csv')
db = ascii.read('temp.csv', format='csv', fast_reader=True)
ndb ... | 1.835938 | 2 |
examples/datacenters.py | doziya/hpeOneView | 107 | 50337 | # -*- coding: utf-8 -*-
###
# (C) Copyright (2012-2017) Hewlett Packard Enterprise Development LP
#
# 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 limi... | 1.554688 | 2 |
bff-2/Rom/rom.py | Alpha-Demon404/RE-14 | 39 | 50338 | <reponame>Alpha-Demon404/RE-14<gh_stars>10-100
#!usr/bin/python2.7
# coding=utf-8
import requests, json, sys, os, re, time
from multiprocessing.pool import ThreadPool as th
from datetime import datetime
class Brute:
def __init__(self):
self.setpw = False
self.ok = []
self.cp ... | 2.21875 | 2 |
cms_people/urls/people.py | python-spain/djangocms-people | 1 | 50339 | from django.conf.urls import url
from cms_people.views.people import PersonView, PeopleView, PeopleMapResultView
urlpatterns = [
url('^people_map_result$', PeopleMapResultView.as_view(), name='people_map_result'),
url('^(?P<username>.+)$', PersonView.as_view(), name='person'),
url('^$', PeopleView.as_view... | 1.695313 | 2 |
im_v2/common/db/remove_db.py | alphamatic/amp | 5 | 50340 | <gh_stars>1-10
#!/usr/bin/env python
"""
Script to remove IM database using connection.
# Remove a DB named 'test_db' using environment variables: >
remove_db.py --db_name 'test_db'
"""
import argparse
import helpers.hparser as hparser
import helpers.hsql as hsql
import im_v2.im_lib_tasks as imvimlita
def _parse()... | 2.578125 | 3 |
view_gerenciar_meta.py | lucasHashi/Organizador-Metas | 0 | 50341 | import sys
from PyQt5 import QtCore, QtGui, QtWidgets, uic
import controller
from datetime import date, datetime, timezone
qt_tela_inicial = "telas/gerenciar_meta.ui"
Ui_MainWindow, QtBaseClass = uic.loadUiType(qt_tela_inicial)
class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
switch_tela_gerenciar_meta =... | 2.421875 | 2 |
tests/lib/test_config.py | ChauffeurPrive/nestor-api | 2 | 50342 | import unittest
from unittest.mock import call, patch
from nestor_api.errors.config.aggregated_configuration_error import AggregatedConfigurationError
from nestor_api.errors.config.app_configuration_not_found_error import AppConfigurationNotFoundError
import nestor_api.lib.config as config
@patch("nestor_api.lib.con... | 2.53125 | 3 |
learned_optimization/tasks/fixed/image_mlp.py | Sohl-Dickstein/learned_optimization | 0 | 50343 | <reponame>Sohl-Dickstein/learned_optimization
# coding=utf-8
# Copyright 2021 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
#
... | 2.046875 | 2 |
epsagon/__init__.py | glikson/epsagon-python | 0 | 50344 | """
Epsagon's init.
"""
from __future__ import absolute_import
import os
from .utils import init
from .patcher import patch_all
from .constants import __version__
from .trace import tracer
def dummy_wrapper(func):
"""
A dummy wrapper for when Epsagon is disabled
:param func: The function to wrap
:ret... | 2.234375 | 2 |
scripts/main.py | Borghese-Gladiator/simple-sine-curve | 29 | 50345 | <reponame>Borghese-Gladiator/simple-sine-curve
import os
from datetime import datetime
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import ray
import ray.rllib.agents.ppo as ppo
import tensortrade.env.default as default
from gym.spaces import Discrete
from ray import tune
from ray.tune.regis... | 2.09375 | 2 |
tests/test_losses.py | yutayamazaki/Machine-Learning-Scratch | 0 | 50346 | import unittest
import numpy as np
from mlscratch.models import losses
class TestBinaryCrossEntropy(unittest.TestCase):
def setUp(self):
self.y_true = np.array([0, 1, 0.5])
self.y_pred = np.array([0, 1, 0.5])
def test_return(self):
bce = losses.binary_cross_entropy(self.y_true, sel... | 2.859375 | 3 |
ostiarius.py | Air-Light-Time-Space/ostiarius | 1 | 50347 | import argparse
import base64
import datetime
import hashlib
import os
import random
import sqlite3
import ssl
import subprocess
import sys
import tempfile
import threading
try:
import secrets
except ImportError:
import string
class secrets:
def token_urlsafe(size):
return (''.join(rand... | 2.203125 | 2 |
fiepipehoudini/shell/installs.py | leith-bartrich/fiellc | 0 | 50348 | import typing
from fiepipedesktoplib.locallymanagedtypes.shells.AbstractLocalManagedTypeCommand import LocalManagedTypeCommand
from fiepipedesktoplib.shells.AbstractShell import AbstractShell
from fiepipehoudini.data.installs import HoudiniInstall
from fiepipehoudini.routines.installs import HoudiniInstallsInteractive... | 2.03125 | 2 |
check_logstash_hot_threads.py | adolci/nagios-plugins | 0 | 50349 | #!/usr/bin/env python
# coding=utf-8
# vim:ts=4:sts=4:sw=4:et
#
# Author: <NAME>
# Date: 2017-11-26 18:55:00 +0100 (Sun, 26 Nov 2017)
#
# https://github.com/harisekhon/nagios-plugins
#
# License: see accompanying Hari Sekhon LICENSE file
#
# If you're using my code you're welcome to connect with me on LinkedIn
#... | 1.296875 | 1 |
utils/fastai_train.py | karmatarap/capstone_project | 2 | 50350 | import os
import sys
from dataclasses import asdict, dataclass
from pprint import pprint
from typing import Iterator, Optional, Tuple, List
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
# import torch
from fastai.vision.all import (
CategoryBlock,
ClassificationInterpretation,
Col... | 2.390625 | 2 |
drop.py | Dario213/My-Python-Scripts | 0 | 50351 | <gh_stars>0
from tkinter import *
from tkinter import messagebox
from PIL import ImageTk, Image
root = Tk()
root.title('Untitled')
root.iconphoto(True, PhotoImage(file = 'images/python.png'))
root.geometry("400x400")
def Show():
lbl = Label(root, text = clicked.get()).pack()
options = [
"Mo... | 3.015625 | 3 |
datascraper.py | enmerk4r/NoLA-Scraper | 0 | 50352 | <filename>datascraper.py
from selenium import webdriver
from dataframe import *
import os
import unicodedata
import re
from pprint import pprint
import urllib3
import time
import datetime
import uuid
from selenium.common.exceptions import UnexpectedAlertPresentException
class Scraper:
def __init__(self,
imgFo... | 2.734375 | 3 |
smalldistance.py | TheAnybodys/statistics-projects | 0 | 50353 | <reponame>TheAnybodys/statistics-projects
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 26 20:23:06 2022
@author: olivi
"""
import random
result = 0
for i in range(1000000):
X = random.uniform(0.0, 1.0)
Y = random.uniform(0.0, 1.0)
if abs(X - Y) <= 0.2:
result += 1
print(result / 1000000)
| 2.90625 | 3 |
faceSwap/3DDFA/utils.py | ForrestPi/3DfaceReconstruction | 17 | 50354 | import torch
import numpy as np
class ToTensorGjz(object):
def __call__(self, pic):
img = torch.from_numpy(pic.transpose((2, 0, 1)))
return img.float()
def __repr__(self):
return self.__class__.__name__ + '()'
class NormalizeGjz(object):
def __init__(self, mean, std):
self... | 2.265625 | 2 |
bsz-filmic-chroma/bsz-filmic-chroma.py | Beinsezii/bsz-gimp-plugins | 6 | 50355 | <reponame>Beinsezii/bsz-gimp-plugins<filename>bsz-filmic-chroma/bsz-filmic-chroma.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Gegl Operation references:
http://www.gegl.org/operations/
https://gitlab.gnome.org/GNOME/gegl/-/tree/master/operations
If on Linux:
$ gegl --list-all
$ gegl --info "operation-name"
... | 1.710938 | 2 |
src/config/fabric-ansible/ansible-playbooks/test/units/test_swift_fileutil.py | jnpr-pranav/contrail-controller | 37 | 50356 | import unittest
from flexmock import flexmock
import swiftclient
import swiftclient.utils
from ansible.modules.network.fabric import swift_fileutil
from test_fabric_base import TestFabricModule
from test_fabric_base import set_module_args
from ansible.module_utils import fabric_utils
class TestSwiftFileUtilModule(Tes... | 2.125 | 2 |
jpgutils.py | luislortega/AimPro | 2 | 50357 | from glob import glob
import cv2
import os
# we'll run it manually like this:
# $ python
# Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:21:23) [MSC v.1916 32 bit (Intel)] on win32
# Type "help", "copyright", "credits" or "license" for more information.
... | 3.125 | 3 |
src/classification.py | yannforget/builtup-classification-osm | 13 | 50358 | """Random Forest classification and computation of assessment metrics."""
import numpy as np
from imblearn.over_sampling import RandomOverSampler
from imblearn.under_sampling import RandomUnderSampler
from sklearn import metrics
from sklearn.ensemble import RandomForestClassifier
from raster import is_raster
def tr... | 2.84375 | 3 |
python/testbed/constant.py | LuaDist/lcms | 7 | 50359 |
#
# Sample: Constants
#
from lcms import *
print "D50=", cmsD50_XYZ()
print "D50=", cmsD50_xyY()
Lab = cmsCIELab(70, -3, 45)
print
print Lab
LCh = cmsCIELCh(0, 0, 0)
cmsLab2LCh(LCh, Lab)
print LCh
Lab2 = cmsCIELab(70, 3, 45)
print
print Lab, Lab2
print "dE (Lab) =", cmsDeltaE(Lab, Lab2)
print "dE (CIE94)=", c... | 2.203125 | 2 |
src/async/image_downloader.py | yoyonel/image_downloader_multiprocessing_python | 4 | 50360 | <reponame>yoyonel/image_downloader_multiprocessing_python<filename>src/async/image_downloader.py
# -*- coding: utf-8 -*-
import asyncio
import aiofiles
import argparse
import logging
import random
import tqdm
from aiohttp import ClientSession
from aiologger import Logger
from aiologger.formatters.base import Formatter... | 2.59375 | 3 |
recipe/settings.py | lirixiang123/recipe | 0 | 50361 | <gh_stars>0
"""
Django settings for recipe project.
Generated by 'django-admin startproject' using Django 1.11.20.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/set... | 1.632813 | 2 |
medium/images/data_for_fitting.py | yull1860outlook/Data-Analysis | 4,358 | 50362 | <reponame>yull1860outlook/Data-Analysis
def data_for_fitting(*, building_id, date):
"""
Retrieves data for fitting from the previous business day
taking into account holidays
"""
lease_start = None
while lease_start is None:
# Previous business day according to Pandas (might be a holida... | 3.09375 | 3 |
ecl/identity/v3/project.py | keiichi-hikita/eclsdk | 5 | 50363 | # 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 t... | 1.851563 | 2 |
trial.py | DylanDsouza00/ResearchInMotion-RIM.ai | 0 | 50364 |
from collections import deque
import pickle
import cv2
import numpy as np
import time
import ast
from utils import *
import tensorflow_hub as hub
import concurrent.futures
from tensorflow.keras import layers
import tensorflow as tf
# Load Yolo
net = cv2.dnn.readNet("./data/yolov4-tiny.weights", "./data/yolov4-tiny.... | 2.609375 | 3 |
bling/clients.py | Elizabeth-Warren/bling-open | 1 | 50365 | from bling.helpscout.client import HelpScoutClient
from bling.mc.client import MobileCommonsClient
from twilio.rest import Client as TwilioClient
from bling.incoming import IncomingHandler
from bling.outgoing import OutgoingHandler
from bling.config import config
from bling.transport import (
Transport,
Twil... | 2.0625 | 2 |
DAO/Connection.py | rennancockles/gigapy | 0 | 50366 | # -*- coding: utf-8 -*-
import MySQLdb
class Connection(object):
def __init__(self):
self.db = MySQLdb.connect(host="localhost", # your host, usually localhost
user="root", # your username
passwd="<PASSWORD>", # your password
... | 3.078125 | 3 |
organization-tree.py | ror-community/ror-utilities | 0 | 50367 | import requests
from anytree import Node, RenderTree
import argparse
import json
ROR_API_ENDPOINT = "https://api.ror.org/organizations/"
# construct organizational tree recursively starting at given ROR
def construct(ror, parent=None):
organization = get_data(ror)
current_node = Node(organization["name"], pa... | 2.953125 | 3 |
tests/test_phase_envelope.py | volpatto/gibbs | 28 | 50368 | import pytest
from gibbs.phase_envelope import calculate_phase_envelope_grid
| 0.898438 | 1 |
python/test.py | mohit2530/LawnSprinklerSystem | 1 | 50369 | import RPi.GPIO as GPIO
import time
channel = 21
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(channel, GPIO.OUT)
GPIO.output(channel, GPIO.HIGH)
#time.sleep(5)
#GPIO.output(channel, GPIO.LOW)
| 2.875 | 3 |
Science_News/Science_News/spiders/howstuffworks.py | Santiagonk/Science_News_Scrapy | 0 | 50370 | <reponame>Santiagonk/Science_News_Scrapy
import scrapy
from ..items import ScienceNewsItem
# Xpath
# categories links = '//a[@data-text]/@href'
# sub categories links = '//div[@data-track-gtm="Topics to Explore"]/div/div/a/@href'
# news links = '//div[@class="mb-4"]/div[@data-track-gtm !="Topics to Explore"]//a/@href'... | 2.828125 | 3 |
GenerateBGLayer.py | makeling/AGSSmartVectorTileTools | 3 | 50371 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# !/usr/bin/python
__author__ = 'ma_keling'
# Version : 1.0.0
# Start Time : 2018-12-5
# Update Time : 2018-12-13
# Change Log :
## 1.
## 2.
## 3.
import time
import arcpy
def express_arcpy_error():
severity = arcpy.GetMaxSeverity()
i... | 1.96875 | 2 |
fast_upfirdn/cupy/_upfirdn.py | mritools/fast_upfirdn | 1 | 50372 | <reponame>mritools/fast_upfirdn<filename>fast_upfirdn/cupy/_upfirdn.py
"""GPU Implementation of upfirdn.
A separate implementation "convolve1d" is also provided as a somewhat faster
alternative in the case up=down=1 (i.e. standard convolution).
"""
from math import ceil
import numpy as np
import cupy
try:
from ... | 2.28125 | 2 |
src/wi/urls/user/user.py | cc1-cloud/cc1 | 11 | 50373 | # -*- coding: utf-8 -*-
# @COPYRIGHT_begin
#
# Copyright [2010-2014] Institute of Nuclear Physics PAN, Krakow, Poland
#
# 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.apac... | 1.835938 | 2 |
core/engine/config_loader.py | M-Spencer-94/configNOW | 3 | 50374 | <filename>core/engine/config_loader.py
# ============================================================================
#
# Copyright (c) 2007-2010 Integral Technology Solutions Pty Ltd,
# All Rights Reserved.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LI... | 1.539063 | 2 |
tests/test_ahp.py | dfrankow/AHPy | 0 | 50375 | <filename>tests/test_ahp.py
import itertools
import pytest
import ahpy
# Example from Saaty, <NAME>., 'Decision making with the analytic hierarchy process,'
# Int. J. Services Sciences, 1:1, 2008, pp. 83-98.
drinks = {('coffee', 'wine'): 9, ('coffee', 'tea'): 5, ('coffee', 'beer'): 2, ('coffee', 'soda'): 1,
... | 2.59375 | 3 |
leimpy/__init__.py | mberz/leimpy | 0 | 50376 | <gh_stars>0
"""Top-level package for leimpy."""
__author__ = """<NAME>"""
__email__ = '<EMAIL>'
__version__ = '0.0.0'
| 0.816406 | 1 |
src/3_examples/Structural/adapter.py | MilovanTomasevic/Python-Design-Patterns | 2 | 50377 | <reponame>MilovanTomasevic/Python-Design-Patterns
"""
Convert the interface of a class into another interface clients expect.
Adapter lets classes work together that couldn't otherwise because of
incompatible interfaces.
"""
from abc import ABC, abstractmethod
# ----------------
# Target Interface
# ----------------
... | 3.875 | 4 |
src/Node.py | LukasTinnes/VenturePainter | 1 | 50378 | class Node:
"""
A node in a graph
"""
def __init__(self, identifier):
"""
:param identifier: Identifier is hash of given Shape Object
"""
self.identifier = identifier
self.outgoing_pointers = []
self.incoming_pointers = []
def get_identifier(self):
... | 3.578125 | 4 |
app/test/pickle-dump.py | sappachok/django-anaconda | 0 | 50379 | <filename>app/test/pickle-dump.py
import pickle
import pickleout
example_dict = {1:"6",2:"2",3:"f", 4:"goo"}
pickle_out = open("dict.pickle","wb")
pickle.dump(globals(), pickle_out, protocol=pickle.HIGHEST_PROTOCOL)
#pickle.dump(example_dict, pickle_out)
#allvar = locals()
#pickle.dump(allvar, pickle_out)
pickle_... | 3.125 | 3 |
Chapter 01/Chap01_Example1.157.py | Anancha/Programming-Techniques-using-Python | 0 | 50380 | #implicit type conversion
num1 = 12
num2= 13.5
num3 = num1 + num2
print(type(num1))
print(type(num2))
print(num3)
print(type(num3))
| 4 | 4 |
onlinecourse/views.py | antecume547/final-cloud-app-with-database | 0 | 50381 | <filename>onlinecourse/views.py<gh_stars>0
from django.shortcuts import render
from django.http import HttpResponseRedirect
# <HINT> Import any new Models here
from .models import Course, Enrollment, Enrollment, Question, Choice, Submission
from django.contrib.auth.models import User
from django.shortcuts import get_ob... | 2.515625 | 3 |
experiment_scripts/train_fmnist.py | chawins/princeton_thesis | 0 | 50382 | """
Train Fashion MNIST CNN
Code borrowed from http://danialk.github.io/blog/2017/09/29/range-of-
convolutional-neural-networks-on-fashion-mnist-dataset/
"""
# Specify visible cuda device
import os
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "7"
import numpy as np
from keras.pre... | 3.0625 | 3 |
few_shots_clf/fm_classifier/fm_classifier.py | delmalih/few-shots-classification | 0 | 50383 | <reponame>delmalih/few-shots-classification
# pylint: disable=attribute-defined-outside-init, no-member, no-self-use
##########################
# Imports
##########################
import os
from typing import Dict
from typing import List
import pickle
import numpy as np
from annoy import AnnoyIndex
from easydict i... | 2.25 | 2 |
fastNLP/modules/aggregation/self_attention.py | h00Jiang/fastNLP | 0 | 50384 | <reponame>h00Jiang/fastNLP
import torch
import torch.nn as nn
from torch.autograd import Variable
class SelfAttention(nn.Module):
"""
Self Attention Module.
Args:
input_size: int, the size for the input vector
dim: int, the width of weight matrix.
num_vec: int, the number of encoded vectors
... | 2.796875 | 3 |
auth_api/custom_auth.py | ripoul/gpx-storage | 0 | 50385 | <gh_stars>0
from rest_framework.authentication import TokenAuthentication
class CustomTokenAuthentication(TokenAuthentication):
keyword = "Bearer"
| 1.578125 | 2 |
supernovasearch/__init__.py | mmiguel6288code/super-nova-search | 0 | 50386 | from . import TelCam_TSX, ImgProc | 0.988281 | 1 |
SIGNUS/modules/crawler/etc/driver_agent.py | 837477/SIGNUS | 0 | 50387 | <filename>SIGNUS/modules/crawler/etc/driver_agent.py<gh_stars>0
from selenium import webdriver
from platform import platform
import os
# def chromedriver():
# options = webdriver.ChromeOptions()
# options.add_argument('headless')
# options.add_argument('window-size=1920x1080')
# options.add_argument("disable-gpu")
... | 2.6875 | 3 |
src/messenger.py | justin-e-zhou/Overqueue | 0 | 50388 | <reponame>justin-e-zhou/Overqueue
from twilio.rest import Client
def notify(code):
# Dictionary of name/phone number pairs (redacted for obvious reasons)
phone_numbers = {"NAME" : "NUMBER"}
# Account SID, authentication token, and Twilio phone number (also redacted)
account_sid = ""
auth_token = ... | 2.78125 | 3 |
lib/python/data/waves.py | HELIO-HFC/RABAT3 | 0 | 50389 | #! /usr/bin/env python
# -*- coding: latin-1 -*-
"""
Python library to get and read Wind/Waves data.
@author: X.Bonnin (LESIA)
"""
__author__="<NAME>"
__date__="08-MAY-2013"
__version__ = "1.0.1"
import os, sys
import re, urllib2
from urlparse import urlparse
import time, subprocess
import numpy as np
from copy impor... | 2.890625 | 3 |
989 - Su Doku/main.py | Shree-Gillorkar/uva-onlinejudge-solutions | 24 | 50390 | <filename>989 - Su Doku/main.py
import sys
from copy import deepcopy
from math import sqrt
def read_num():
return list(map(int, sys.stdin.readline().split()))
def read_sudoku():
try:
n = read_num()
if not n:
n = read_num()
n = n[0]
return [read_num() for _ in range... | 3.78125 | 4 |
coturn/signals.py | Core4ce/avalon-django-coturn | 3 | 50391 | import hmac
import hashlib
from django.conf import settings
from django.contrib.auth.models import User
from .models import TurnusersLt
def sync_new_user_to_coturn(sender, instance, **kwargs):
##
# NOTE: Do not use this for REST API. You do not need to sync users if you are using the REST API.
#
#
... | 2.40625 | 2 |
day/day_02/solution.py | moki/aoc2015 | 0 | 50392 | <reponame>moki/aoc2015
from functools import reduce
def part_1(input):
lines = input.split("\n")
paper = 0
for line in lines:
if len(line) == 0:
continue
ds = list(map(lambda d: int(d), line.split("x")))
sides = [ds[0] * ds[1], ds[1] * ds[2], ds[0] * ds[2]]
... | 3.046875 | 3 |
steambird/util/import_from_ut_people.py | rhbvkleef/SteamBird | 0 | 50393 | <reponame>rhbvkleef/SteamBird
from typing import Union
from urllib.parse import quote
import requests
import vobject
from vobject.base import Component
def read_vcard(vcard_url) -> Union[Component, None]:
try:
vcard = requests.get(vcard_url).text
return vobject.readOne(vcard)
# pylint: disabl... | 2.578125 | 3 |
src/unix_accounts/bin/auth_tokens.py | 1nfiniteloop/unix-accounts | 0 | 50394 | import secrets
from typing import FrozenSet
class AuthorizationTokens:
def __init__(self, filename: str):
self._filename = filename
def get_tokens(self) -> FrozenSet[str]:
return self._read_tokens()
def generate_token(self) -> str:
token = secrets.token_urlsafe(32)
self.... | 2.8125 | 3 |
Heat_Transfer/4.3_Pipe_with_&_out_cover.py | Daz-Riza-Seriog/Transport_Phenomena | 4 | 50395 | # Code made for <NAME>
# 12 Abril 2021
# License MIT
# Transport Phenomena: Python Program-Assessment 4.3
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
from scipy.optimize import minimize
sns.set()
# Solve for Temperature of Steam at given Pressure
class enviroment_convective:
def tem... | 3 | 3 |
LC/653.py | szhu3210/LeetCode_Solutions | 2 | 50396 | # Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def findTarget(self, root, k):
"""
:type root: TreeNode
:type k: int
:rtype: bool
... | 3.828125 | 4 |
kameris/subcommands/run_job.py | stephensolis/modmap-pipeline | 13 | 50397 | from __future__ import (
absolute_import, division, print_function, unicode_literals)
import collections
import copy
import functools
import itertools
import json
import jsonschema
import logging
import os
import random
from ruamel.yaml import YAML
import six
from six import iteritems
from six.moves import range
... | 1.921875 | 2 |
tools/rules/cu.bzl | vuanvin/pytorch | 5 | 50398 | <reponame>vuanvin/pytorch<gh_stars>1-10
load("@rules_cuda//cuda:defs.bzl", "cuda_library")
NVCC_COPTS = ["--expt-relaxed-constexpr", "--expt-extended-lambda"]
def cu_library(name, srcs, copts = [], **kwargs):
cuda_library(name, srcs = srcs, copts = NVCC_COPTS + copts, **kwargs)
| 1.609375 | 2 |
tools/bricks/infererce.py | zhiqi-li/Panoptic-SegFormer | 97 | 50399 | from mmcv.runner import checkpoint
from mmdet.apis.inference import init_detector,LoadImage, inference_detector
import easymd
config = 'config.py'
#checkpoints = './checkpoints/pseg_r101_r50_latest.pth'
checkpoints = "path/to/pth"
img = '000000322864.jpg'
results = {
'img': './datasets/coco/val2017/'+i... | 1.921875 | 2 |