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 |
|---|---|---|---|---|---|---|
NGram/prediction_2104/user_exploration.py | mbc96325/IOHMM-for-individual-mobility-prediction | 1 | 12786251 | import math
import numpy as np
import oyster_reader as oyster
from matplotlib import pyplot as plt
import matplotlib.colors as cl
# import seaborn as sns
def plotInterTripTime(users):
count = 0
dtFreq = np.zeros(60 * 20)
for u in users:
interTripTime = u.getInterTripTime()
for dt in interTripTime:
dtFreq[dt... | 2.703125 | 3 |
src/clld_phylogeny_plugin/tree.py | clld/clld-phylogeny-plugin | 1 | 12786252 | <reponame>clld/clld-phylogeny-plugin<gh_stars>1-10
import operator
import itertools
import collections
from zope.interface import implementer
from sqlalchemy.orm import joinedload
from clldutils.misc import lazyproperty
from clld.db.meta import DBSession
from clld.db.models.common import Parameter, ValueSet
from clld.... | 2.21875 | 2 |
nari/types/event/addcombatant.py | lunarrize/nari | 9 | 12786253 | <gh_stars>1-10
"""Event representing an actor being added to the field"""
from nari.types.event.base import Event
from nari.types.event import Type
from nari.types.actor import Actor
class AddCombatant(Event):
"""Adding an actor to the field"""
__id__ = Type.addcombatant.value
def handle_params(self):
... | 2.34375 | 2 |
room.py | benjy8/Hotel-booking | 0 | 12786254 | import datetime
'''
room.py
'''
# declare constants
MONTHS = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']
DAYS_PER_MONTH = [31,28,31,30,31,30,31,31,30,31,30,31]
#class Room
class Room:
#class attributes
TYPES_OF_ROOM_AVAILABLE = ['twin','double','queen','king']
... | 3.609375 | 4 |
juno/onboarding.py | ASG09/juno-python | 7 | 12786255 | from juno.resources import handler_request
from juno.resources.routes import onboarding_routes
def account_new_onboarding_request(dictionary):
return handler_request.post(onboarding_routes.get_base_url(), dictionary) | 1.828125 | 2 |
python/tests/protocol1_0/image.py | wnetz/etch-a-sketch | 0 | 12786256 | import sys
import cv2
from matplotlib import pyplot as plt
from skimage.filters import sobel
import numpy as np
import math
from Etch import Etch
PRINT_ETCH = True
class Image:
def __init__(self):
self.points = []
self.image = cv2.imread("C:/Users/wnetz/Documents/etch-a-sketch/python/tests/protoco... | 2.828125 | 3 |
microPython/lib/microCoAPy/reading.py | renzoe/IANVS | 2 | 12786257 | <filename>microPython/lib/microCoAPy/reading.py<gh_stars>1-10
class Reading:
# Period is the index in the array
def __init__(self, attack):
self.attack = attack | 2.375 | 2 |
theano/sandbox/cuda/tests/test_abstractconv.py | aalmah/Theano | 0 | 12786258 | <filename>theano/sandbox/cuda/tests/test_abstractconv.py<gh_stars>0
import unittest
import numpy
import itertools
import theano
from theano.tests import unittest_tools as utt
import theano.tensor.nnet.abstract_conv2d as conv
from theano.sandbox.cuda import float32_shared_constructor as gpu_shared
from theano.compile i... | 2.03125 | 2 |
config.py | eranroz/4suDRB-seq | 1 | 12786259 | # place to download and get, UCSC metadata.
KNOWN_GENES = 'meta_data/clustersWithNames.tsv'
# the data itself - directory of mat files (matlab) with convention REPLICATE_CONDITION_TIME.mat
# where:
# REPLICATE is some unique value (such as 384)
# CONDITION is some short description of condition (such as control)
... | 1.796875 | 2 |
randopt/samplers.py | seba-1511/randopt | 115 | 12786260 | <gh_stars>100-1000
#!/usr/bin/env python
import random
import math
from . import RANDOPT_RNG
"""
Here we implement the sampling strategies.
"""
class Sampler(object):
"""
Base class for all samplers.
Note: This class should not be directly instanciated.
"""
def __init__(self, *args, **kwargs... | 3.65625 | 4 |
Myblog/config/migrations/0002_auto_20180418_2143.py | Family-TreeSY/MyBlog | 5 | 12786261 | <filename>Myblog/config/migrations/0002_auto_20180418_2143.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2018-04-18 13:43
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('config', '0001_initial'),
... | 1.523438 | 2 |
methods/Faster RCNN/remove_no_annotations.py | IvanNik17/Seasonal-Changes-in-Thermal-Surveillance-Imaging | 2 | 12786262 | <reponame>IvanNik17/Seasonal-Changes-in-Thermal-Surveillance-Imaging
import shutil
import os
from xml.dom.minidom import parse
labels_folder = './data/harborfront/test/Apr/outputs/'
labels = os.listdir(labels_folder)
for l in labels:
dom = parse(os.path.join(labels_folder, l))
# Get Document Element Object
... | 2.515625 | 3 |
tests/test_aaindex1.py | shoz/ProtLearn | 1 | 12786263 | import os
import sys
path = os.environ.get('TRAVIS_BUILD_DIR')
sys.path.insert(0, path+'/protlearn')
import numpy as np
from preprocessing import txt_to_df
from feature_engineering import aaindex1
def test_aaindex1():
"Test AAIndex1"
# load data
df = txt_to_df(path+'/tests/docs/test_seq.txt', 0)
... | 2.234375 | 2 |
deep_rl/updated_atari_env/updated_atari_env.py | alexcoda/DeepRL | 1 | 12786264 | <reponame>alexcoda/DeepRL
from ale_python_interface import ALEInterface
from gym import spaces
from gym import utils
from gym.envs.atari import AtariEnv
from gym.utils import seeding
import numpy as np
import os
def to_ram(ale):
ram_size = ale.getRAMSize()
ram = np.zeros((ram_size),dtype=np.uint8)
ale.getR... | 2.515625 | 3 |
grbl/connection.py | pylover/easymove | 0 | 12786265 | import serial
from .proxy import ObjectProxy
class Connection:
current_connection = None
_settings = None
_serial = None
def __init__(self, filename, baudrate=115200, **kw):
self.filename = filename
self.baudrate = baudrate
self.kw = kw
@property
def settings(self):
... | 2.578125 | 3 |
12_funciones_listas_ej.py | jrg-sln/basic_python | 0 | 12786266 | <filename>12_funciones_listas_ej.py
# -*- coding: utf-8 -*-
##############Ejercicio sobre funciones con listas#######################
'''Ahora que ya sabe manejar las funciones de las listas hacer un programa
que simule el registro de alumnos en una lista y al final la imprima en
forma descendente'''
def alta(c, a... | 4.09375 | 4 |
project/pad/forms.py | lucrae/pad | 1 | 12786267 | from django import forms
class EntryForm(forms.Form):
body = forms.CharField() | 1.6875 | 2 |
elif_bayindir/phase_1/python_basic_1/day_4/q2.py | CodedLadiesInnovateTech/-python-challenge-solutions | 6 | 12786268 | <gh_stars>1-10
# Question 2
# Count number 4 in a list
list1 = [1, 2, 10, 4, 3, 4, 4, 4, 1, 3, 5]
x = 0
for i in range(len(list1)):
if list1[i] == 4:
x += 1
print("Number of 4 in the list:", x)
| 3.53125 | 4 |
ipbes-ndr/src/ipbes_ndr_analysis/__main__.py | richpsharp/ipbes-analysis | 1 | 12786269 | import os
import sys
import logging
import ipbes_ndr_analysis
LOGGER = logging.getLogger(__name__)
if __name__ == '__main__':
if len(sys.argv) != 3:
LOGGER.error(
"usage: python %s iam_token_path workspace_dir", sys.argv[0])
sys.exit(-1)
raw_iam_token_path = sys.argv[... | 2.5625 | 3 |
pangea/core/views/__init__.py | LongTailBio/pangea-django | 0 | 12786270 | <reponame>LongTailBio/pangea-django
from .s3_views import (
S3ApiKeyCreateView,
S3ApiKeyDetailsView,
S3BucketCreateView,
S3BucketDetailsView,
)
from .user_views import (
PangeaUserListView,
PangeaUserDetailsView,
get_user_detail_by_djoser_id,
get_current_user_detail,
)
from .organization... | 1.5 | 2 |
core/train_dm.py | botfront/rasa-for-botfront-old | 1 | 12786271 | import argparse
import glob
import os
import time
import logging
from rasa_addons.domains_merger import DomainsMerger
from rasa_addons.superagent import SuperAgent
from rasa_core.policies.memoization import MemoizationPolicy, AugmentedMemoizationPolicy
from rasa_core.policies.keras_policy import KerasPolicy
from rasa_... | 2.046875 | 2 |
sdk/anomalydetector/azure-ai-anomalydetector/azure/ai/anomalydetector/models/_models.py | rsdoherty/azure-sdk-for-python | 2,728 | 12786272 | <filename>sdk/anomalydetector/azure-ai-anomalydetector/azure/ai/anomalydetector/models/_models.py
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root ... | 2.0625 | 2 |
modules/dankMemer.py | YottGG/The-all-in-one-discord-tool | 0 | 12786273 | from colored import fg, attr
import requests
import threading
import time
import random
r = fg(241) # Setup color variables
r2 = fg(255)
b = fg(31)
w = fg(15)
def start():
token = input(f"\n {r2}[{b}?{r2}] Token: ")
channel = input(f" {r2}[{b}?{r2}] Channel Id: ")
def execute_command(command = "", cooldo... | 2.609375 | 3 |
sound_stuff.py | VarunBabbar/Stroodle | 0 | 12786274 | <gh_stars>0
from nltk.stem import PorterStemmer
#from nltk.tokenize import sent_tokenize, word_tokenize
# TODO: Word2Vec
# Names
names = ["John", "Donald"]
# colours
colours = ["red", "blue", "green", "yellow", "orange", "pink", "purple"]
# key story phrases
story_phrases = ["Once upon a time", "time"]
# kinematic... | 2.875 | 3 |
get_kinase_pki.py | sirimullalab/kinasepkipred | 10 | 12786275 | from __future__ import print_function, absolute_import
# Script to predict (or test) the model using protein (kinase) sequence and SMILE pattern of a compound.
# Usage: python2 get_kinase_pki.py protein_sequence "SMILE_Pattern"
import numpy as np
from pydpi.pypro import PyPro
import pandas as pd
import json
import m... | 2.4375 | 2 |
src/plate.py | webdesign4site/License-Plate-Recognition-Using-Deep-Learning | 2 | 12786276 | from keras.models import load_model
from keras.preprocessing import image
import numpy as np
import cv2
from keras.backend import tensorflow_backend as K
import os
import glob
import time
import keras
from matplotlib import pyplot as plt
from keras.datasets import mnist
from keras.models import Sequential
from keras.la... | 2.6875 | 3 |
AzureFunctions/tcr_notification/__init__.py | tobiheim/teams-call-records-api | 2 | 12786277 | <gh_stars>1-10
"""
Description:
Web-Hook to collect Call Id's and write them to a Service Bus
Disclaimer:
This code is provided AS IS without warranty of any kind. The author disclaim all implied warranties including,
without limitation, any implied warranties of merchantability ... | 2.3125 | 2 |
tools/patch_codegen.py | joeleong/idapython | 0 | 12786278 |
import os, re
try:
from argparse import ArgumentParser
except:
print "Failed to import module 'argparse'. Upgrade to Python 2.7, copy argparse.py to this directory or try 'apt-get install python-argparse'"
raise
parser = ArgumentParser(description='Patch some code generation, so it builds')
parser.add_ar... | 2.859375 | 3 |
utils/snippets.py | NumanIbnMazid/invoice_management | 0 | 12786279 | import random
import string
import time
from django.utils.text import slugify
from urllib.parse import urlparse
from django.db import models
from django.dispatch import receiver
import uuid
# PDF imports
from io import BytesIO
from django.http import HttpResponse
from django.template.loader import get_template
from xht... | 2.46875 | 2 |
program/tools.py | techtuxbr/WatchDogs | 6 | 12786280 | import os
from . import computer
def shutdown():
if computer.os() == "Windows":
os.system("shutdown -s")
elif computer.os() == "Linux":
os.system("shutdown -h")
else:
print("Sistema operacional nao detectado, impossivel executar a operacao desejada")
def reboot():
if... | 3.34375 | 3 |
TeLoRa_v0_03/test_code/Gauge.py | OHAProject/LoRa-tracker | 0 | 12786281 | # -*- coding: utf-8 -*-
import Tkinter
import time
from random import randrange
class Mod_gauge(Tkinter.Canvas):
def __init__(self, parent, titre = "Gauge",background="#222735",foreground="#00d0c7", max = 127, min = 0):
global valeur, root, arc, text, H, W, coord1, coord2
self.titre = titre
... | 2.796875 | 3 |
exer205.py | profnssorg/valmorMantelli1 | 0 | 12786282 | ###Titulo: Reescrever função
###Função: Este programa foi reescrito para adicionar uma mariável
###Autor: <NAME>.
###Data: 24/11/20148
###Versão: 0.0.1
# Entrada dos dados
a = 5
b = 3
c = 4
#Saída de dados
print(a + b + c)
| 2.890625 | 3 |
extra/time_profiling.py | blacknred/pybook | 0 | 12786283 | import time
from decimal import Decimal, getcontext
'''
Ways to count execution time:
- time of whole program: $time python3.8 slow_program.py
- too many info: $python3.8 -m cProfile -s time slow_program.py
- direct time measure with Timing Specific Function(via decorator):
'''
def timeit_wrapper(func):
# pylint... | 3.6875 | 4 |
books/tests/inventory.py | samweru/bookkeep | 0 | 12786284 | from books.models import *
from freezegun import freeze_time
from django.test import TransactionTestCase
from django.test import TestCase
from django.db import DatabaseError, transaction
from books.controllers.customer import Order as SaleOrder
from books.controllers import accountant as acc
from books.controllers im... | 2.4375 | 2 |
whatrecord/tests/test_autosave.py | ZLLentz/whatrecord | 2 | 12786285 | <reponame>ZLLentz/whatrecord
import pathlib
import pprint
import apischema
import pytest
from ..autosave import AutosaveRestoreFile, RestoreError, RestoreValue
from ..common import LoadContext
from . import conftest
autosave_FILES = list((conftest.MODULE_PATH / "iocs").glob("**/*.sav"))
additional_files = conftest.... | 1.984375 | 2 |
rbg/generalization.py | bottlenome/rbg | 0 | 12786286 | import torch
import torch.nn as nn
import torch.nn.functional as F
from .function import onehot, onehot_cross
class random_batch_generalization_abs(torch.autograd.Function):
@staticmethod
def forward(ctx, x, y, rate, epsilon):
batch_size = x.shape[0]
ref_index = torch.randint(low=0, high=batch... | 2.09375 | 2 |
nova/virt/libvirt/volume/smbfs.py | bopopescu/nova-token | 0 | 12786287 | begin_unit
comment|'# Licensed under the Apache License, Version 2.0 (the "License"); you may'
nl|'\n'
comment|'# not use this file except in compliance with the License. You may obtain'
nl|'\n'
comment|'# a copy of the License at'
nl|'\n'
comment|'#'
nl|'\n'
comment|'# http://www.apache.org/licenses/L... | 1.257813 | 1 |
WEEKS/CD_Sata-Structures/_RESOURCES/python-prac/mini-scripts/python_negative_indexing_Access_Array_Elements.txt.py | webdevhub42/Lambda | 5 | 12786288 | <filename>WEEKS/CD_Sata-Structures/_RESOURCES/python-prac/mini-scripts/python_negative_indexing_Access_Array_Elements.txt.py
import numpy as np
arr = np.array([[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]])
print("Last element from 2nd dim: ", arr[1, -1])
| 3.390625 | 3 |
api_gateway/main.py | leckijakub/hipotap | 0 | 12786289 | import asyncio
import sys
import time
import datetime
from queue import Queue
from threading import Thread
from typing import Optional
from fastapi import FastAPI, Form, HTTPException, Request
from fastapi.middleware.cors import CORSMiddleware
from sse_starlette.sse import EventSourceResponse
from google.protobuf imp... | 1.804688 | 2 |
datapypes/model.py | msmathers/datapypes | 1 | 12786290 | <filename>datapypes/model.py
from attribute import Attribute, InvalidAttributeValue
from source import Source
from store import Store
class InvalidAttribute(Exception): pass
class AttributeDoesNotExist(Exception): pass
class InvalidSource(Exception): pass
class InvalidStore(Exception): pass
class PypeDoesNotExist(Exce... | 2.625 | 3 |
solentware_grid/tests/__init__.py | RogerMarsh/solentware-grid | 0 | 12786291 | """Unittests for solentware_grid package.
"PACKAGE CONTENTS" is incomplete because all the unittests are stubs.
"""
| 0.988281 | 1 |
prompt_toolkit/filters/types.py | gigforks/python-prompt-toolkit | 1 | 12786292 | from __future__ import unicode_literals
from inspect import ArgSpec
from six import with_metaclass
__all__ = (
'CLIFilter',
'SimpleFilter',
'check_signatures_are_equal',
)
class _FilterTypeMeta(type):
def __instancecheck__(cls, instance):
if not hasattr(instance, 'getargspec'):
ret... | 2.28125 | 2 |
setup.py | alena-lark/PrintNumAtom | 0 | 12786293 | <filename>setup.py
from setuptools import setup, find_packages
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name="printnum",
version="0.1.9",
author="alena-lark",
author_email="<EMAIL>",
description="Printing a number of atoms in a molecule",
long_description=long... | 1.601563 | 2 |
gtfs_rt_validator_api.py | cal-itp/gtfs-rt-api | 0 | 12786294 | __version__ = "0.0.1"
import os
import json
import subprocess
import shutil
import pandas as pd
import argh
from tempfile import TemporaryDirectory, NamedTemporaryFile
from pathlib import Path
from collections import defaultdict
RT_BUCKET_FOLDER="gs://gtfs-data/rt"
RT_BUCKET_PROCESSED_FOLDER="gs://gtfs-data/rt-proce... | 2.484375 | 2 |
src/wrappers/python/pygroupsig/blindsig_build.py | jmakr0/libgroupsig | 17 | 12786295 | # file "blindsig_build.py"
from pygroupsig.common_build import ffibuilder
ffibuilder.cdef("""
typedef struct {
uint8_t scheme;
void *sig;
} groupsig_blindsig_t;
""")
ffibuilder.cdef("""
typedef groupsig_blindsig_t* (*groupsig_blindsig_init_f)(void);
""")
ffibuilder.cdef("""
typedef int (*groupsig_blindsig_free_f)(g... | 1.984375 | 2 |
pcloudapi/pcloudjson.py | tochev/python3-pcloudapi | 6 | 12786296 | <gh_stars>1-10
#!/usr/bin/env python3
import requests
from .connection import AbstractPCloudConnection
PCLOUD_SERVER = "api.pcloud.com"
PCLOUD_PORT = 80
PCLOUD_SSL_PORT = 443
class PCloudJSONConnection(AbstractPCloudConnection):
"""Connection to pcloud.com based on their json protocol.
NOTE: loads the who... | 3.5 | 4 |
foreignLangOCR/lib/detect.py | ravip18596/foreignLangOCR | 1 | 12786297 | <gh_stars>1-10
from tesserocr import PyTessBaseAPI, PSM, RIL, iterate_level
import pytesseract
from PIL import Image
class Const:
lang = 'hin'
psm = 3
def detect_hindi(img: Image):
ocr_api = PyTessBaseAPI(psm=PSM.SPARSE_TEXT, lang=Const.lang)
meta, response = [], []
img_width, img_height = img.... | 2.828125 | 3 |
manage.py | johannes-gehrs/centos_packages | 9 | 12786298 | from __future__ import absolute_import, division, unicode_literals
import argparse
import sys
import time
import config
import packages
import index
def _stopwatch(start_time):
return "Done. Time elapsed in seconds: " + unicode(time.time() - start_time)
def _download():
start_time = time.time()
print "S... | 2.578125 | 3 |
test/test_processor.py | miguelaferreira/transmission-postprocess | 0 | 12786299 | import unittest
from os import listdir
from os.path import basename, dirname, realpath
from shutil import copy2
from tempfile import NamedTemporaryFile, mkdtemp
from trdone.actions import NoAction, CopyAction, UnrarAction
from trdone.processor import Processor
class TestProcessor(unittest.TestCase):
def test_pro... | 2.765625 | 3 |
aoc_2018/day_3/python/test_day3_puzzle1.py | girip11/advent_of_code | 0 | 12786300 | import os
from pathlib import Path
from typing import List
from aoc_2018.day_3.python.day3_puzzle1 import (
Claim,
find_square_inches_with_overlapping_claims,
parse_claim,
)
def get_input(input_file_name: str) -> List[Claim]:
input_file_path: str = os.path.join(Path(os.path.dirname(__file__)).parent,... | 3.28125 | 3 |
p3/test.py | aryan-gupta/MATH1165 | 0 | 12786301 |
import os
for i in range(28):
print("Test case: ", i)
os.system(f"echo {i} | ./a.out | grep \"Enter\"") | 2.40625 | 2 |
src/synamic/core/default_data/__init__.py | SabujXi/SynamicX | 7 | 12786302 | from synamic.core.default_data._manager import DefaultDataManager
| 1.125 | 1 |
odmltables/xls_style.py | fabianschlebusch/python-odmltables | 6 | 12786303 | <filename>odmltables/xls_style.py
# -*- coding: utf-8 -*-
"""
"""
class XlsStyle():
"""
class to create a stylestring to use in xlwt.easyxf
:param backcolor: color of the background of the cell
:param fontcolor: color of the text inside the cell
:param fontstyle: style of the text inside the ce... | 3.421875 | 3 |
edmunds/foundation/testing/testcase.py | LowieHuyghe/edmunds-python | 4 | 12786304 | <gh_stars>1-10
import os
import sys
import threading
import time
import unittest
from edmunds.globals import abc, ABC
import edmunds.support.helpers as helpers
import tempfile
import shutil
class TestCase(unittest.TestCase, ABC):
"""
A UnitTest Test Case
"""
def set_up(self):
"""
Set... | 2.59375 | 3 |
homeassistant/components/thermostat/proliphix.py | davidedmundson/home-assistant | 0 | 12786305 | <reponame>davidedmundson/home-assistant<gh_stars>0
"""
homeassistant.components.thermostat.proliphix
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The Proliphix NT10e Thermostat is an ethernet connected thermostat.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/com... | 2.484375 | 2 |
modules/social_security/reduction_info/code/reduction_add_views.py | xuhuiliang-maybe/ace_office | 1 | 12786306 | # coding=utf-8
import traceback
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.contrib.auth.decorators import permission_required
from django.contrib.messages.views import SuccessMessageMixin
from django.core.urlresolvers import reverse
from django.views.gener... | 1.835938 | 2 |
ltr/dataset/lumbar3d.py | DeepBrainsMe/PyDoctor_Final | 1 | 12786307 | import json
import os
import SimpleITK as sitk
import numpy
import pydicom
import numpy as np
from ltr.admin.environment import env_settings
from ltr.data.processing_utils import str_analyse
from ltr.dataset.base_dataset import BaseDataset
from pydoctor.evaluation import Study
from pydoctor.evaluation.data import Stud... | 2.34375 | 2 |
qaforum/utils.py | UREDDY616/IIITVforum | 117 | 12786308 | <gh_stars>100-1000
import pytz
from datetime import datetime
from django.utils import timezone
from math import log
# uses a version of reddit score algorithm
# https://medium.com/hacking-and-gonzo/how-reddit-ranking-algorithms-work-ef111e33d0d9#.aef67efq1
def question_score(question):
creation_date = question.p... | 2.65625 | 3 |
Hashing/sha2.py | Prakash-sa/Crypto | 0 | 12786309 | import hashlib
# initialize a string
str = "Crypto"
# encode the string
encoded_str = str.encode()
# create sha-2 hash objects initialized with the encoded string
hash_obj_sha224 = hashlib.sha224(encoded_str) # SHA224
hash_obj_sha256 = hashlib.sha256(encoded_str) # SHA256
hash_obj_sha384 = hashlib.sha384(e... | 3.328125 | 3 |
plot_meta.py | BFYFlorence/RAF | 0 | 12786310 | <gh_stars>0
import matplotlib.pyplot as plt
import numpy as np
target_file = "/Users/erik/Desktop/metadynamics/learn/"
def hills(target_file,dictator=None):
y = []
with open(target_file) as f:
for i in f.readlines():
record = i.strip().split()
print(record)
if recor... | 2.703125 | 3 |
layoutx/widgets/textarea.py | 8or5q/LayoutX | 61 | 12786311 | from .widget import Widget
import tkinter as tk
from tkinter import Frame, Text, Scrollbar, Pack, Grid, Place, INSERT, END, Toplevel, Listbox
from tkinter.constants import RIGHT, LEFT, Y, BOTH
from tkinter.font import Font, BOLD, nametofont
from .scroll_frame ... | 2.484375 | 2 |
lambdas/create_event/main.py | Kruril/LunaV2 | 0 | 12786312 | import json
from datetime import datetime, timedelta
import requests
import os.path
import boto3
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
from google.oauth2.credentials import Credentials
# If modifying these ... | 2.71875 | 3 |
utils/data_utils.py | kdmarshall/Two_Sigma_Financial_Modeling_Challenge | 3 | 12786313 | __doc__ = """
Various data utilities.
"""
####################################################################
# Packages
####################################################################
import os
import h5py
import numpy as np
import pandas as pd
#########################################################... | 2 | 2 |
chaosmonkey/planners/planner.py | BBVA/chaos-monkey-engine | 52 | 12786314 | <filename>chaosmonkey/planners/planner.py
"""
Base class for planners
Every planner must extend Planner class
"""
from chaosmonkey.engine.cme_manager import manager
class Planner:
"""
Planner interface
Planners are responsible for scheduling jobs that executes attacks
:param name: plan name
"... | 3.09375 | 3 |
tests/test_runs.py | rbrown-kayak/mlflow | 0 | 12786315 | from click.testing import CliRunner
from unittest import mock
import numpy as np
import os
import pandas as pd
import shutil
import tempfile
import textwrap
from mlflow import experiments
from mlflow.runs import list_run
import mlflow
def test_list_run():
with mlflow.start_run(run_name="apple"):
pass
... | 2.4375 | 2 |
logfilter/logfilter.py | iamFIREcracker/logfilter | 0 | 12786316 | <reponame>iamFIREcracker/logfilter
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import absolute_import
import os
import re
import time
import subprocess
import threading
from argparse import ArgumentParser
from collections import deque
from itertools import cycle... | 2.140625 | 2 |
tests/unit/stream_alert_rule_processor/test_threat_intel.py | ashmere/streamalert | 1 | 12786317 | <filename>tests/unit/stream_alert_rule_processor/test_threat_intel.py
"""
Copyright 2017-present, Airbnb 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/LICEN... | 2.25 | 2 |
social_regexp/processing.py | TezRomacH/social-regexp | 0 | 12786318 | <gh_stars>0
from typing import Pattern
import re
import string
from social_regexp.constants import (
HASH_TOKEN,
MENTION_TOKEN,
NON_RUSSIAN_CYRILLIC_LETTERS,
PHONE_TOKEN,
URL_TOKEN,
_blank_spaces,
_hashtags,
_mentions,
_phones,
_single_letter_word,
_spaces_before_punctuatio... | 3.25 | 3 |
app/ztp/mongo/models/template.py | cmlccie/rapid-ztp | 7 | 12786319 | <filename>app/ztp/mongo/models/template.py
"""Template MongoDB data model.
Copyright (c) 2019 Cisco and/or its affiliates.
This software is licensed to you under the terms of the Cisco Sample
Code License, Version 1.1 (the "License"). You may obtain a copy of the
License at
https://developer.cisco.com... | 2.078125 | 2 |
intensity_normalization/normalize/nyul.py | AlaSummer/intensity-normalization | 0 | 12786320 | <reponame>AlaSummer/intensity-normalization<filename>intensity_normalization/normalize/nyul.py
"""Nyul & Udupa piecewise linear histogram matching normalization
Author: <NAME> <<EMAIL>>
Created on: 02 Jun 2021
"""
from __future__ import annotations
__all__ = ["NyulNormalize"]
import argparse
import builtins
import c... | 2.28125 | 2 |
pset (HangMan)/hangman.py | Hammad-001/MIT-6.0001-psets-Solutions | 2 | 12786321 | <filename>pset (HangMan)/hangman.py<gh_stars>1-10
# Problem Set 2, hangman.py
# Name: <NAME>
# Collaborators: None
# Hangman Game
# -----------------------------------
import random
import string
WORDLIST_FILENAME = "words.txt"
def load_words():
"""
Returns a list of valid words. Words are strings of lowerc... | 3.9375 | 4 |
examples/graph_prediction/general_gnn.py | JonaBecher/spektral | 2,145 | 12786322 | """
This example implements the model from the paper
> [Design Space for Graph Neural Networks](https://arxiv.org/abs/2011.08843)<br>
> <NAME>, <NAME>, <NAME>
using the PROTEINS dataset.
The configuration at the top of the file is the best one identified in the
paper, and should work well for many different ... | 2.640625 | 3 |
problems/044.py | JoshKarpel/Euler | 1 | 12786323 | <filename>problems/044.py
from math import sqrt
import collections
from problems import utils
@utils.memoize
def pentagon(n):
return int(n * ((3 * n) - 1) / 2)
def solve():
upper_bound = 3000
pentagons = set((pentagon(n) for n in range(1, upper_bound)))
for n in range(1, upper_bound):
p_n =... | 3.75 | 4 |
kfp_fashion_mnist.py | JavaDerek/FashionMnistKF | 3 | 12786324 | import kfp.dsl as dsl
class ObjectDict(dict):
def __getattr__(self, name):
if name in self:
return self[name]
else:
raise AttributeError("No such attribute: " + name)
@dsl.pipeline(
name='fashion mnist',
description='Train and Deploy Fashion MNIST'
)
def train_and_deploy(
download_and_pre... | 2.765625 | 3 |
fastapi_crud_orm_connector/api/auth.py | christinoleo/fastapi_crud_orm_connector | 0 | 12786325 | <reponame>christinoleo/fastapi_crud_orm_connector<filename>fastapi_crud_orm_connector/api/auth.py
from fastapi import Depends, HTTPException, status
from jose import jwt, JWTError
from fastapi_crud_orm_connector import schemas
from fastapi_crud_orm_connector.api import security
from fastapi_crud_orm_connector.utils.da... | 2.28125 | 2 |
orchestra/management/commands/upgradeorchestra.py | udm88/django-orchestra | 68 | 12786326 | <gh_stars>10-100
import functools
import os
import random
import string
from distutils.sysconfig import get_python_lib
from optparse import make_option
from django.core.management import call_command
from django.core.management.base import BaseCommand, CommandError
from orchestra import get_version
from orchestra.uti... | 2.0625 | 2 |
src/uwds3_human_description/human_visual_model.py | uwds3/uwds3_human_description | 0 | 12786327 | <filename>src/uwds3_human_description/human_visual_model.py<gh_stars>0
import numpy as np
from sensor_msgs import CameraInfo
class HumanVisualModel(object):
FOV = 60.0 # human field of view
WIDTH = 90 # image width resolution for rendering
HEIGHT = 68 # image height resolution for rendering
CLIPNEAR ... | 2.390625 | 2 |
src/app/data/mongopython.py | vaiskuma/Angular-first-App | 0 | 12786328 | import pymongo
from pymongo import MongoClient
connection = MongoClient ()
#client = MongoClient('localhost', 27017)
#The client object is thread-safe and has connection-pooling built in. If an operation fails because of a network error, ConnectionFailure is raised and the client reconnects in the background. Applica... | 2.9375 | 3 |
Chapter01/19_iterator_example.py | add54/ADMIN_SYS_PYTHON | 116 | 12786329 | <filename>Chapter01/19_iterator_example.py<gh_stars>100-1000
numbers = [10, 20, 30, 40]
numbers_iter = iter(numbers)
print(next(numbers_iter))
print(next(numbers_iter))
print(numbers_iter.__next__())
print(numbers_iter.__next__())
next(numbers_iter)
| 3.375 | 3 |
tasks/task0018.py | jtprogru/interview-task | 3 | 12786330 | <reponame>jtprogru/interview-task
"""
Write a function that reverses a string. The input string is given as an array of characters s.
You must do this by modifying the input array in-place with O(1) extra memory.
Example 1:
Input: s = ["h","e","l","l","o"]
Output: ["o","l","l","e","h"]
Example 2:
Input: s ... | 3.984375 | 4 |
chemaxon.py | weishuzhao/group-contribution | 8 | 12786331 | <gh_stars>1-10
from subprocess import Popen, PIPE
import openbabel
import logging
import numpy as np
import StringIO
import re, csv
from rdkit import Chem
from rdkit.ML.Descriptors.MoleculeDescriptors import MolecularDescriptorCalculator
#from rdkit.Chem import Descriptors, GraphDescriptors, rdMolDescriptors #the list ... | 2.328125 | 2 |
Z_ALL_FILE/Py1/omt.py | omikabir/omEngin | 0 | 12786332 | from telethon.sync import TelegramClient
from telethon.sessions import StringSession
from pprint import pprint
import os
api_id = 628127
api_hash = 'db7fa09d585d6eedddd0df5973f3239b'
phone = '+8801817184338'
client = TelegramClient(phone, api_id, api_hash)
client.connect()
if not client.is_user_authorized():
clien... | 2.5 | 2 |
ddos_no_proxy.py | ph-fox/dos | 0 | 12786333 | #!/usr/bin/python3
import requests, threading, os, readline, optparse
from colorama import Fore
read = optparse.OptionParser()
read.add_option('-u', '--url',help="Enter Website url", dest='url')
(value, key) = read.parse_args()
url = value.url
if url is None:
print("Coded by: <NAME>")
print("github: https://github.c... | 2.8125 | 3 |
esk/controller/models/secretbindings.py | esk8s/esk | 1 | 12786334 | <reponame>esk8s/esk
import kubernetes
class SecretBinding:
def __init__(self, name, namespace, service_account, secrets, target = None, template = None):
self.__name = name
self.__namespace = namespace
self.__service_account = service_account
self.__secrets = secrets
self.__target = target if ta... | 2.265625 | 2 |
ED_remoto/auth.py | fabriciocgf/Remote_Lab_FPGA | 0 | 12786335 | <reponame>fabriciocgf/Remote_Lab_FPGA
"""Routes for user authentication."""
from flask import redirect, render_template, flash, Blueprint, request, url_for
from .forms import LoginForm, SignupForm
from .models import db, User
# Blueprint Configuration
auth_bp = Blueprint('auth_bp', __name__,
templ... | 2.453125 | 2 |
Dublin_Bikes/weather_scraper/weatherScraper.py | TeamCGS/Dublin_Bikes | 0 | 12786336 | import json
import requests
from sqlalchemy import Column, Integer, String, Float, Boolean
from pprint import pprint
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
from base_file import Base
import time
import datetime
class Weather(Base):
"""
Create a Weather tabl... | 2.859375 | 3 |
tsadm/ansible/inventory/__init__.py | jctincan/tsadm-webapp | 0 | 12786337 |
from . import groupvars
from . import hostvars
wapp = None
def __init():
groupvars.wapp = wapp
hostvars.wapp = wapp
def getinv():
__init()
master_server = wapp.conf.get('MASTER_SERVER')
slave_all = wapp.db.slave_all()
hosts_all = [h['fqdn'] for h in slave_all]
hosts_all.append(master_s... | 2.46875 | 2 |
src/pycsd/test/test_csd_integers.py | luk036/ellpy | 7 | 12786338 | #! /usr/bin/env python3
"""
Unittests for the CSD module
"""
import unittest
import pycsd.csd as csd
good_values_dict = {
32: '+00000',
-32: '-00000',
0: '0',
7: '+00-',
15: '+000-'
}
class tests__integers(unittest.TestCase):
def test__01_to_integer(self):
""" Check conversion from... | 3.5625 | 4 |
5_asyncio/future_threadpool_deadlock.py | Nataliyi/async | 5 | 12786339 | <filename>5_asyncio/future_threadpool_deadlock.py
from concurrent.futures import ThreadPoolExecutor
import time
a_future = None
b_future = None
def wait_on_b():
time.sleep(2) # blocking events
print(b_future.result()) # b_future will never complete because it is waiting on a_future.
return 5
def wait... | 3.515625 | 4 |
src/idms/functions.py | ProvZH/opentext | 1 | 12786340 | <reponame>ProvZH/opentext<filename>src/idms/functions.py
# from mimetype_description import get_mime_type_description
def mimetype2FileType(mimetype: str) -> str:
"""
Lookup table for mime type to file type.
"""
convertDict = {
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"... | 2.296875 | 2 |
msl/equipment/config.py | SwiftyMorgan/msl-equipment | 0 | 12786341 | """
Load an XML :ref:`configuration_file`.
"""
import os
import logging
from xml.etree import cElementTree as ET
from .database import Database
logger = logging.getLogger(__name__)
class Config(object):
PyVISA_LIBRARY = '@ni'
""":class:`str`: The PyVISA backend_ library to use.
.. _backend: https:... | 3.03125 | 3 |
gromacs_wrapper/genrestr.py | bioexcel/virtualscreening | 3 | 12786342 | #!/usr/bin/env python
"""Python wrapper module for the GROMACS genrestr module
"""
import sys
import re
import json
import os
import configuration.settings as settings
from command_wrapper import cmd_wrapper
from tools import file_utils as fu
class Genrestr(object):
"""Wrapper class for the GROMACS genrestr modu... | 2.34375 | 2 |
euler/e7.py | volkerha/DT211-3-Cloud | 0 | 12786343 | primeCount = 0
prime = 2
loopCount = 2
#check if numer is prime
def isPrime(p):
for i in range(2, p):
if p % i == 0:
return 0
return 1
#loop until the 10001st prime number
while primeCount < 10001:
#prime? increse primecount
if isPrime(loopCount) == 1:
primeCount += 1
prime = loopCount
loo... | 3.984375 | 4 |
dataloaders/__init__.py | kopetri/MIDAS_pytorch | 2 | 12786344 | # -*- coding: utf-8 -*-
# @Time : 2018/10/21 20:43
# @Author : <NAME>
# @Email : <EMAIL> | 0.917969 | 1 |
public_admin/urls.py | smegurus/smegurus-django | 1 | 12786345 | <gh_stars>1-10
from django.conf.urls import include, url
from public_admin.views import dashboard_view, organization_view
urlpatterns = (
url(r'^janitor/organization/create/(.*)/2/$', organization_view.organization_create_2_page, name='public_admin_organization_create_2'),
url(r'^janitor/organization/create/(... | 1.789063 | 2 |
problems/test_0059_one_loop.py | chrisxue815/leetcode_python | 1 | 12786346 | <filename>problems/test_0059_one_loop.py
import unittest
from typing import List
import utils
# O(n) time. O(1) space. Matrix, one loop.
class Solution:
def generateMatrix(self, n: int) -> List[List[int]]:
m = [[0] * n for _ in range(n)]
r, c, dr, dc = 0, 0, 0, 1
for i in range(1, n * n ... | 3.421875 | 3 |
backend/backend/routing.py | Trevor-Mansfield/WalmartReceiptSplitter | 0 | 12786347 | from channels.auth import AuthMiddlewareStack
from channels.routing import ProtocolTypeRouter, URLRouter, ChannelNameRouter
import cost_claimer.routing
import cost_claimer.consumers
application = ProtocolTypeRouter({
'websocket': AuthMiddlewareStack(
URLRouter(
cost_claimer.routing.websocket_u... | 1.859375 | 2 |
URI/1010.py | leilaapsilva/BabySteps | 37 | 12786348 | <reponame>leilaapsilva/BabySteps
peca1 = input().split()
peca2 = input().split()
quantidadePeca1 = int(peca1[1])
quantidadePeca2 = int(peca2[1])
valorPeca1 = float(peca1[2])
valorPeca2 = float(peca2[2])
total = (quantidadePeca1 * valorPeca1) + (quantidadePeca2 * valorPeca2)
print("VALOR A PAGAR: R$ {:.2f}".format(to... | 3.578125 | 4 |
process/4_score.py | omarmaddouri/GCNCC_1 | 4 | 12786349 | <filename>process/4_score.py<gh_stars>1-10
from __future__ import division
from __future__ import print_function
from pathlib import Path
import sys
project_path = Path(__file__).resolve().parents[1]
sys.path.append(str(project_path))
import tensorflow as tf
import os
import numpy as np
from collections im... | 2.078125 | 2 |
people_filterNetwork.py | dpastoresc/NarrativeDynamics | 1 | 12786350 | # -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import pandas as pd
import numpy as np
import seaborn as sns
import mysql.connector
from sqlalchemy import create_engine
import nltk
import re
from nltk.corpus import stopwords
import string
from bs4 import BeautifulSoup
import matplotl... | 2.390625 | 2 |