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 |
|---|---|---|---|---|---|---|
src/node/typing.py | onurkaraman/perseus | 3 | 12771551 | import types
def getClassName(object):
return object.__class__.__name__
def isList(object):
return type(object) == types.ListType
def isPrimitive(object):
return type(object) in {types.IntType, types.StringType, types.FloatType}
def isNone(object):
return type(object) == types.NoneType
def isBoolea... | 2.703125 | 3 |
os_migrate/plugins/modules/import_workload_src_check.py | jbadiapa/os-migrate | 35 | 12771552 | #!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'
}
DOCUMENTATION = '''
---
module: import_workload_src_check
short_description: Export OpenStack in... | 1.835938 | 2 |
quota-query.py | jayhaze/quotaquery | 0 | 12771553 | # This is a query tool, not a creation tool. Could do with better usage instructions to cover what options need to be used in any query.
# Import some of the important things...must install requests, because it makes things (getting around SSL verification) sooo much easier.
import requests, json
import base64
import ... | 2.203125 | 2 |
python/easy/1380_Lucky_Numbers_in_a_Matrix.py | JackWang0107/leetcode | 1 | 12771554 | from typing import *
class Solution:
# 116 ms, faster than 96.82% of Python3 online submissions for Lucky Numbers in a Matrix.
# 14.4 MB, less than 87.29% of Python3 online submissions for Lucky Numbers in a Matrix.
def luckyNumbers (self, matrix: List[List[int]]) -> List[int]:
ans = []
for row in range(len(matr... | 3.5 | 4 |
src/litegraph/graph.py | RemyLau/litegraph | 0 | 12771555 | <gh_stars>0
class Graph:
"""A light weight (undirected and weighted) graph object."""
def __init__(self):
self.data = []
self.ids = []
self.idmap = {}
self._number_of_nodes = 0
self._number_of_edges = 0
@property
def nodes(self):
return self.ids.copy()
... | 3.234375 | 3 |
audio_lab_pynq/AudioCodec.py | cramsay/Audio-Lab-PYNQ | 3 | 12771556 | <reponame>cramsay/Audio-Lab-PYNQ
import ctypes
import pylibi2c
import time
class ADAU1761():
def __init__(self, i2c_chan = 1, i2c_base_addr = 0x3B):
self.i2c_chan = i2c_chan
self.i2c_base_addr = i2c_base_addr
self.i2c_bus = pylibi2c.I2CDevice(
'/dev/i2c-'+str(self.... | 2.484375 | 2 |
btc_address_dump/p2sh_p2wpkh_util.py | widecoin-project/btc-address-dump | 19 | 12771557 | <filename>btc_address_dump/p2sh_p2wpkh_util.py<gh_stars>10-100
import base58
import os
import sys
file_path = os.path.abspath(os.path.join(os.path.dirname(__file__)))
sys.path.insert(0, os.path.abspath(file_path))
import common_util
def hash160_to_p2sh_p2wpkh_addr(hash160: bytes, version: bytes) -> bytes:
redee... | 2.515625 | 3 |
getDigest.py | riiy/learn_python | 1 | 12771558 | <filename>getDigest.py
#!/usr/bin/env python
# encoding: utf-8
import sys
import hashlib
def getDigest(file):
# BUF_SIZE is totally arbitrary, change for your app!
BUF_SIZE = 65536 # lets read stuff in 64kb chunks!
md5 = hashlib.md5()
sha1 = hashlib.sha1()
with open(file, 'rb') as f:
whi... | 3.125 | 3 |
PhysicsTools/PatAlgos/python/famos/boostrapWithFamos_cff.py | pasmuss/cmssw | 0 | 12771559 | <reponame>pasmuss/cmssw
import FWCore.ParameterSet.Config as cms
#
# General fast simulation configuration ###
#
# Random number generator service
from FastSimulation.Configuration.RandomServiceInitialization_cff import *
# Generate ttbar events
from FastSimulation.Configuration.ttbar_cfi import *
# Famos sequences
fr... | 1.070313 | 1 |
datasets/TGS_salt/TGSDataset.py | liaopeiyuan/ml-arsenal-public | 280 | 12771560 | from dependencies import *
IMAGE_HEIGHT, IMAGE_WIDTH = 101, 101
HEIGHT, WIDTH = 128, 128
DY0, DY1, DX0, DX1 = \
compute_center_pad(IMAGE_HEIGHT, IMAGE_WIDTH, factor=32)
#----------------------------------------
def null_augment(image,label,index):
cache = Struct(image = image.copy(), mask = mask.copy())
... | 2.375 | 2 |
community/dm-scaffolder/configs.py | shan2202/deploymentmanager-samples | 930 | 12771561 | <reponame>shan2202/deploymentmanager-samples
# Copyright 2018 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... | 2.015625 | 2 |
spirit/user/migrations/0009_auto_20161114_1850.py | Ke-xueting/Spirit | 974 | 12771562 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# Generated by Django 1.9.11 on 2016-11-14 18:50
from django.db import migrations
def user_model_content_type(apps, schema_editor):
from ...core.conf import settings
if not hasattr(settings, 'AUTH_USER_MODEL'):
return
user = apps.get_model(settings.AUTH... | 1.804688 | 2 |
rainradar/unquote.py | dimitri-rebrikov/rainradar | 0 | 12771563 | <reponame>dimitri-rebrikov/rainradar<gh_stars>0
# adapted from https://raw.githubusercontent.com/lucien2k/wipy-urllib/master/urllib.py
def unquote(s):
"""Kindly rewritten by Damien from Micropython"""
"""No longer uses caching because of memory limitations"""
res = s.split('%')
for i in range(1, len(re... | 2.8125 | 3 |
Share/migrations/0004_remove_group_uid.py | Poornartha/VocabBuilder | 2 | 12771564 | # Generated by Django 3.1 on 2020-08-27 06:18
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('Share', '0003_auto_20200827_1134'),
]
operations = [
migrations.RemoveField(
model_name='group',
name='uid',
),
]
| 1.273438 | 1 |
pyxb/bundles/opengis/examples/demo.py | eLBati/pyxb | 123 | 12771565 | from __future__ import print_function
import pyxb.bundles.opengis.gml as gml
dv = gml.DegreesType(32, direction='N')
print(dv.toDOM(element_name='degrees').toxml("utf-8"))
| 2.15625 | 2 |
EvaS.py | mirayyuce/Recommender-System | 0 | 12771566 | <reponame>mirayyuce/Recommender-System
import numpy as np
import os
import sys
import json
from RecS_baseline import RecS_baseline_class
from RecS_advanced import RecS_advanced_class
import utils
import evaluation_metrics
# calculate all metrics and save them
def calculate_and_save_metrics(save_path="metrics_results.... | 2.546875 | 3 |
tests/ut/modules/test_ctera_portal_tenant.py | ctera/ctera-ansible-collection | 0 | 12771567 | <gh_stars>0
# pylint: disable=protected-access
# This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is licensed under the Apache License 2.0.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the au... | 1.71875 | 2 |
budgetbuddy/accounts/migrations/0008_auto_20190719_1620.py | michaelqknguyen/Budget-Buddy | 0 | 12771568 | <reponame>michaelqknguyen/Budget-Buddy
# Generated by Django 2.2.3 on 2019-07-19 20:20
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('accounts', '0007_auto_20190716_1909'),
]
operations = [
migrations.A... | 1.515625 | 2 |
Scripts/GeMS_WPGCMYK_RGB.py | mahunterUSGS/GeMS_Tools | 15 | 12771569 | import colortrans, sys, arcpy
from GeMS_utilityFunctions import *
gdb = sys.argv[1]
dmu = gdb+'/DescriptionOfMapUnits'
fields = ('Symbol','AreaFillRGB')
with arcpy.da.UpdateCursor(dmu, fields) as cursor:
for row in cursor:
if row[0] != None:
try:
rgb = colortrans.wpg2rgb(row[... | 1.851563 | 2 |
services/__Init__.py | kking423/digital_library | 0 | 12771570 | __all__ = ['inventory', 'library']
| 1.078125 | 1 |
src/packages/board/__init__.py | nathanctech/pipsqueak3 | 17 | 12771571 | <gh_stars>10-100
"""
__init__.py
Copyright (c) 2018 The <NAME>,
All rights reserved.
Licensed under the BSD 3-Clause License.
See LICENSE.md
"""
from .board import RatBoard
from . import board as _board
from src.config import PLUGIN_MANAGER
PLUGIN_MANAGER.register(_board, "Rat Board")
__all__ = [
"RatBoard",
... | 1.070313 | 1 |
Print/findHbonds.py | MooersLab/jupyterlabpymolpysnipsplus | 0 | 12771572 | <filename>Print/findHbonds.py
# Description: Find H-bonds around a residue.
# Source: placeHolder
"""
cmd.do('remove element h; distance hbonds, all, all, 3.2, mode=2;')
"""
cmd.do('remove element h; distance hbonds, all, all, 3.2, mode=2;')
| 2.640625 | 3 |
test_apps/python_app/example/patterns/startup.py | Origen-SDK/o2 | 0 | 12771573 | # Pattern that would startup the DUT, then do nothing else.
# Should still generate.
with Pattern() as pat:
...
| 1.328125 | 1 |
AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_GradientModifierNodes.py | aaarsene/o3de | 1 | 12771574 | <filename>AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_GradientModifierNodes.py<gh_stars>1-10
"""
Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
SPDX-License-Identifier: Apache-2.0 OR MIT
... | 1.851563 | 2 |
taggit/admin.py | theatlantic/django-taggit | 0 | 12771575 | from django.contrib import admin
from taggit.models import Tag, TaggedItem, TagTransform
class TaggedItemInline(admin.StackedInline):
model = TaggedItem
extra = 0
class TagAdmin(admin.ModelAdmin):
inlines = [
TaggedItemInline
]
ordering = ['name']
search_fields = ['name']
class TagT... | 1.820313 | 2 |
func.py | autolordz/gradient-descent-optimization | 5 | 12771576 | # -*- coding: utf-8 -*-
"""
Created on Mon Aug 12 11:39:56 2019
@author: autol
"""
#%%
import numpy as np
import time
from gfun import StepClass,ConvClass,JClass,Hessian
from gupdate import UpdateClass
#%% methodtion
#@accepts(w=np.ndarray)
def gradient_descent_f(var,
X=0,y=0,w=0,n_iters=1,n... | 2.28125 | 2 |
src/features/gazed_act_pred.py | HemuManju/ahead | 0 | 12771577 | <reponame>HemuManju/ahead<filename>src/features/gazed_act_pred.py
import os
import sys
import torch
from tqdm import tqdm
from yaml import safe_load
from src.models.gazed_action_sl import GAZED_ACTION_SL
from src.data.data_loaders import load_action_data, load_gaze_data
from src.models.cnn_gaze import CNN_GAZE
sys.path... | 1.84375 | 2 |
OCR/recon_img.py | lhfei/scrapy-in-action | 0 | 12771578 | <reponame>lhfei/scrapy-in-action<filename>OCR/recon_img.py
import easyocr
reader = easyocr.Reader(['ch_sim', 'en']) # need to run only once to load model into memory
result = reader.readtext('chinese.jpg', detail = 0, paragraph=True) | 2.40625 | 2 |
pymycobot/__init__.py | toyoshi/pymycobot | 0 | 12771579 | <gh_stars>0
from __future__ import absolute_import
name = 'pymycobot'
__version__ = '2.1.2'
__all__ = ['mycobot', 'genre']
| 0.949219 | 1 |
week11/recursion.py | sachaDPB/Data-Algo | 0 | 12771580 | from random import randint
def sumNum(x):
x -= 1
if x == 1:
return x
x1 = sumNum(x)
x = x * x1
return x
def coinFlip(n):
n -= 1
if n == 0:
return n
n = coinFlip(n)
n += randint(0,1)
return n
def main():
y = 0
#x = int(input("Numb... | 3.640625 | 4 |
rpi/network/server.py | uorocketry/can-rgx | 0 | 12771581 | import logging
import multiprocessing
import select
import socketserver
import struct
import shared.config as config
from rpi.network.messagehandler import MessageHandler
class NetworkError(Exception):
pass
class NetworkReadingTimeoutError(Exception):
pass
class NetworkWritingTimeoutError(Exception):
... | 2.828125 | 3 |
beetsplug/inlinehook.py | fortysix2ahead/beets-kergoth | 2 | 12771582 | """Run inline python code when beets events are fired."""
from __future__ import division, absolute_import, print_function
import ast
import confuse
from beets.plugins import BeetsPlugin
def _syntaxerror_offset(value, lineoffset):
"""Adjust the line number in a SyntaxError exception."""
if lineoffset:
... | 2.734375 | 3 |
Python/Exercícios_Python/001_=_deixando_tudo_pronto.py | vdonoladev/aprendendo-programacao | 0 | 12771583 | <filename>Python/Exercícios_Python/001_=_deixando_tudo_pronto.py
# -*- coding: utf-8 -*-
"""001 = Deixando tudo pronto
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1GhfZy4Dql6Q-h1khGuR5Uji39RilKx9T
"""
msg = "Olá, Mundo"
print(msg) | 1.890625 | 2 |
activation.py | saras108/backpropagation | 0 | 12771584 | <reponame>saras108/backpropagation<filename>activation.py
import numpy as np
from abc import abstractmethod
class Activations:
@abstractmethod
def forward(self):
pass
@abstractmethod
def gradient(self):
pass
class Sigmoid(Activations):
def forward(self,x):
# return super(... | 3.75 | 4 |
Pre_Processing/Skewness/src/request_processor.py | evamok/knowledge-extraction-recipes-forms | 93 | 12771585 | #!/usr/bin/python
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import logging
import common.storage_helpers as storage_helpers
import common.image_helpers as image_helpers
def correct_form(form, vision_key, vision_region):
# Get form data
form_data = image_he... | 2.25 | 2 |
titanfp/rk_sweep.py | billzorn/fpunreal | 4 | 12771586 | <reponame>billzorn/fpunreal<gh_stars>1-10
import math
import operator
from .titanic import ndarray
from .fpbench import fpcparser
from .arithmetic import mpmf, ieee754, evalctx, analysis
from .arithmetic.mpmf import Interpreter
from .sweep import search
eqn_core = '''(FPCore lorenz-3d ((xyz 3))
:precision {fn_pre... | 1.570313 | 2 |
qemu/tests/acceptance/machine_microblaze.py | hyunjoy/scripts | 44 | 12771587 | <filename>qemu/tests/acceptance/machine_microblaze.py<gh_stars>10-100
# Functional test that boots a microblaze Linux kernel and checks the console
#
# Copyright (c) 2018, 2021 Red Hat, Inc.
#
# This work is licensed under the terms of the GNU GPL, version 2 or
# later. See the COPYING file in the top-level directory.
... | 2.421875 | 2 |
tuppence_kernel/kernel.py | bostick/tuppence_kernel | 0 | 12771588 | from ipykernel.kernelapp import IPKernelApp
from ipykernel.kernelbase import Kernel
from pexpect.replwrap import REPLWrapper
from pexpect.exceptions import EOF
class TuppenceKernel(Kernel):
implementation = 'Tuppence'
implementation_version = '1.0'
language = 'tuppence'
language_version = '0.1'
lan... | 2.21875 | 2 |
gym_chip8/envs/core/vm.py | brocolab/gym-chip8 | 2 | 12771589 | <reponame>brocolab/gym-chip8
import os
import json
import time
import numpy as np
from .cpu import CPU
from .state import State
from . import constants
NO_ACTION = -1
class Frame():
def __init__(self, cycle_index, buffer, buzzer_state, delta, variables=None):
self.cycle_index = cycle_index
self.b... | 2.515625 | 3 |
ovs_dbg/ofparse/ofp_logic.py | aeko-empt/ovs-dbg | 7 | 12771590 | <reponame>aeko-empt/ovs-dbg<filename>ovs_dbg/ofparse/ofp_logic.py
import sys
import io
import re
from rich.tree import Tree
from rich.text import Text
from ovs_dbg.ofparse.process import FlowProcessor
from ovs_dbg.ofparse.console import (
ConsoleFormatter,
ConsoleBuffer,
hash_pallete,
file_header,
... | 2.421875 | 2 |
nesta/packages/wikipedia/wiktionary_ngrams.py | anniyanvr/nesta | 13 | 12771591 | import requests
from bs4 import BeautifulSoup
from datetime import datetime as dt
from gzip import GzipFile
from urllib.request import urlopen
import re
TOP_URL = "https://ftp.acc.umu.se/mirror/wikimedia.org/dumps/enwiktionary/{}"
FILENAME = "/enwiktionary-{}-all-titles-in-ns0.gz"
NON_ALPHA_PATTERN = re.compile(rb'[\W... | 3.140625 | 3 |
setup.py | JisThomas14/EyesLibraryExtended | 0 | 12771592 | #!/usr/bin/env python
from __future__ import absolute_import
import sys
# from distutils.core import setup
from setuptools import setup, find_packages
from os import path
import io
from os.path import join, dirname
sys.path.append(join(dirname(__file__), "EyesLibraryExtended"))
exec(compile(open("EyesLibraryExtende... | 1.4375 | 1 |
code/answer_3-2-2.py | KoyanagiHitoshi/AtCoder-Python-Introduction | 1 | 12771593 | N = int(input())
total = 0
for i in range(1, N+1):
if (i % 3) != 0 and (i % 5) != 0:
total = total+i
print(total)
| 3.578125 | 4 |
setup.py | xzxzlala/joint-teapot | 0 | 12771594 | import os
import re
from typing import List
from setuptools import find_packages, setup
def get_version(package: str) -> str:
"""
Return package version as listed in `__version__` in `__main__.py`.
"""
path = os.path.join(package, "__main__.py")
main_py = open(path, "r", encoding="utf8").read()
... | 2.1875 | 2 |
music21/stream/streamStatus.py | cuthbertLab/music21 | 1,449 | 12771595 | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Name: streamStatus.py
# Purpose: functionality for reporting on the notational status of streams
#
# Authors: <NAME>
#
# Copyright: Copyright © 2013 <NAME> and the music21
# Proje... | 2.515625 | 3 |
tmcm_lib/module_3110/motor.py | florian-lapp/tmcm-lib-py | 1 | 12771596 | <gh_stars>1-10
from tmcm_lib.motor import Motor as MotorGeneric
import math
import typing
class Motor(MotorGeneric) :
# Minimum frequency of the motors in units of hertz.
_FREQUENCY_MINIMUM : float # Defined later.
# Maximum frequency of the motors in units of hertz.
_FREQUENCY_MAXIMUM : fl... | 3.171875 | 3 |
dcase_util/containers/mapping.py | ankitshah009/dcase_util | 122 | 12771597 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, absolute_import
from six import iteritems
import os
import csv
from dcase_util.containers import DictContainer
from dcase_util.utils import FileFormat
class OneToOneMappingContainer(DictContainer):
"""Mapping container class for ... | 2.453125 | 2 |
scripts/npy2npz.py | sbrisard/janus | 3 | 12771598 | <reponame>sbrisard/janus<filename>scripts/npy2npz.py
"""Script to convert the reference data for validation of the discrete Green
operator. In the initial (*.npy) format, the tau and eta arrays are stacked
in one single array prior to saving.
In the new format, the tau and eta arrays are saved as 'x' and 'y' in a
*.npz... | 2.609375 | 3 |
proxSeries/sparseSVD.py | WeazelDev/ML_Project | 0 | 12771599 | <gh_stars>0
#-*-coding:Utf-8 -*
"""Computes the SVD of rating matrix R with scipy.sparse.linalg.svds, which is memory-constant."""
import numpy as np
import scipy.sparse.linalg as slinalg
from scipy.sparse import csc_matrix
import os
# Reading and importing ratings matrix
print("Reading rating matrix R...")
import da... | 2.703125 | 3 |
utils/sass_functions/svg_to_data_uri.py | bulv1ne/django_utils | 1 | 12771600 | import os
from base64 import b64encode
from urllib.parse import quote
def g_b64(data):
return b"".join([b"data:image/svg+xml;base64,", b64encode(data.encode("utf-8"))])
def g_uri(data):
return "".join(["data:image/svg+xml;charset=UTF-8,", quote(data)])
def svg_to_data(data):
d_b64 = g_b64(data)
d_... | 3 | 3 |
sample.py | rickxu0423/Bayes-Network | 0 | 12771601 | import xml.etree.ElementTree as ET, sys, random
from graph import Graph
from time import time
e = []
varS = []
N = None
bn = Graph()
if len(sys.argv) < 4:
print("Invalid argv: Less Than 2 argvs!")
sys.exit()
if len(sys.argv) > 4:
if len(sys.argv) % 2 != 0:
print("Invalid argv: Wrong Format!")
... | 2.78125 | 3 |
PaintsChainer/sketchKeras/run.py | xiaofengShi/Gans | 0 | 12771602 | '''
File: main.py
Project: sketchKeras
File Created: Sunday, 7th October 2018 5:51:22 pm
Author: xiaofeng (<EMAIL>)
-----
Last Modified: Sunday, 7th October 2018 7:09:45 pm
Modified By: xiaofeng (<EMAIL>>)
-----
Copyright 2018.06 - 2018 onion Math, onion Math
'''
from keras.models import load_model
import keras.backen... | 2.109375 | 2 |
mobot/views.py | moo-denver/mobotweb | 0 | 12771603 | <reponame>moo-denver/mobotweb<gh_stars>0
from django.shortcuts import render
from .loader import *
from django.http import HttpResponse
# Create your views here.
def index(request):
load_stock_data()
return render(request, 'index.html')
def load_ts(request):
ts = load_ohlc_stock('SCP')
context = {'d... | 2.234375 | 2 |
Script Python/EP_Script_v2.py | AlphaCodeCorp/EPScript | 2 | 12771604 | import sys, getpass, getopt, requests, random, time
from math import *
from datetime import datetime
import os
print('Number of arguments : ', len(sys.argv))
print('#########################################')
print('')
print('Script récupération d\'images sur Reddit')
print('')
print('################################... | 3.1875 | 3 |
python/testData/selectWord/literal/before.py | jnthn/intellij-community | 2 | 12771605 | <reponame>jnthn/intellij-community
x = r"hello world <caret>again" | 0.84375 | 1 |
students/K33422/laboratory_works/Moruga_Elina/lr_2/simple_django_web_projects(1)/django_project_Moruga/project_first_app/migrations/0001_initial.py | Elyavor/ITMO_ICT_WebDevelopment_2021-2022 | 0 | 12771606 | <gh_stars>0
# Generated by Django 3.2.8 on 2021-11-01 08:05
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Car',
fields=[... | 1.921875 | 2 |
xbbg/core/intervals.py | jkassies/xbbg | 0 | 12771607 | import pandas as pd
import numpy as np
from collections import namedtuple
from xbbg import const
from xbbg.io import logs, param
Session = namedtuple('Session', ['start_time', 'end_time'])
SessNA = Session(None, None)
def get_interval(ticker, session) -> Session:
"""
Get interval from defined session
... | 2.640625 | 3 |
scheduler/scheduling.py | louy2/YACS | 10 | 12771608 | <filename>scheduler/scheduling.py
from pyconstraints import Problem, is_nil
__all__ = ['compute_schedules', 'TimeRange', 'Scheduler']
class TimeRange(object):
"Represents a time range to be restricted."
def __init__(self, start, end, dow):
self.start = start
self.end = end
self.days_... | 2.90625 | 3 |
bayes_filters/utils/utils_misc.py | wenh06/bayes_filters | 0 | 12771609 | # -*- coding: utf-8 -*-
"""
docstring, to write
"""
from functools import wraps
__all__ = [
"indicator_enter_leave_func",
"trivial_jit",
]
def indicator_enter_leave_func(verbose:int=0):
"""
"""
def dec_outer(fn:callable):
@wraps(fn)
def dec_inner(*args, **kwargs):
if... | 2.828125 | 3 |
diagrams/diagram.py | feluelle/kind-data-platform | 2 | 12771610 | from custom import Airbyte, Dbt, Superset
from diagrams import Diagram
from diagrams.aws.security import SecretsManager
from diagrams.aws.storage import S3
from diagrams.onprem.database import Postgresql
from diagrams.onprem.monitoring import Grafana, Prometheus
from diagrams.onprem.workflow import Airflow
with Diagr... | 1.78125 | 2 |
work/yun/client.py | pawankaushal/crossbar-examples | 97 | 12771611 | <filename>work/yun/client.py
from autobahn.asyncio.wamp import ApplicationSession
from autobahn.asyncio.wamp import ApplicationRunner
class MyComponent(ApplicationSession):
def onJoin(self, details):
print("session ready")
runner = ApplicationRunner(url="ws://192.168.1.130:8080/ws", realm="realm1... | 1.914063 | 2 |
mat/mat/analysis/cordova.py | minkione/mat | 0 | 12771612 | #system modules
from os import path
# dynamic load modules
from os import listdir
from imp import load_source
# local modules
from mat.utils.utils import Utils, Log
from mat.utils import settings
class CordovaAnalysis(object):
LATEST_VERSION_URL = 'https://dist.apache.org/repos/dist/release/cordova/platforms/'
... | 2.078125 | 2 |
paleomix/common/utilities.py | jfy133/paleomix | 0 | 12771613 | #!/usr/bin/python
#
# Copyright (c) 2012 <NAME> <<EMAIL>>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify... | 2.15625 | 2 |
crashbin_app/models.py | The-Compiler/crashbin | 0 | 12771614 | <reponame>The-Compiler/crashbin<gh_stars>0
import re
import itertools
import typing
from django.db import models
from django.utils import timezone
from django.contrib.auth.models import User
from django.conf import settings
import colorful.fields
import django_mailbox.models
from crashbin_app import utils
class Lab... | 2.03125 | 2 |
src/utils/ReadEnv.py | d-onny/eunji-bot | 0 | 12771615 | <filename>src/utils/ReadEnv.py
import configparser
class ReadEnv:
def __init__(self, configFile:str = "bot.config"):
self.configFile = configFile
self.SECRET = ""
self.TOKEN = ""
self.grabEnv()
def grabEnv(self):
section = "bot-config"
config = configparser.Con... | 2.90625 | 3 |
core/modules/models/cls/__init__.py | FelixFu520/DAO | 0 | 12771616 | # classification
from .TIMMC import TIMMC
| 1.046875 | 1 |
src/instructions.py | Cyclip/parser-py | 0 | 12771617 | INSTRUCTIONS = {
"SUM": 0b00001,
"SUB": 0b00010,
"MULT": 0b00011,
"DIV": 0b00101,
}
def instrFor(instr):
return INSTRUCTIONS[instr] | 2.34375 | 2 |
test/filefeeder_unittest.py | JMHOO/vessel | 0 | 12771618 | import unittest
from vessel.preprocess import FileFeeder
from vessel.preprocess import DICOMFileIterator
class TestFileFeeder(unittest.TestCase):
def test_link_building(self):
feeder = FileFeeder('data')
self.assertEqual(feeder._patient_contours['SCD0000401'], 'SC-HF-I-5')
print(len(feeder)... | 2.5625 | 3 |
desktop/core/ext-py/python-ldap-2.3.13/setup.py | kokosing/hue | 5,079 | 12771619 | <reponame>kokosing/hue
"""
setup.py - Setup package with the help Python's DistUtils
See http://www.python-ldap.org/ for details.
$Id: setup.py,v 1.65 2009/10/21 17:32:11 stroeder Exp $
"""
has_setuptools = False
try:
from setuptools import setup, Extension
has_setuptools = True
except ImportError:
from distutils... | 1.554688 | 2 |
app/api/routes.py | thekiharani/FlaskPlayground | 0 | 12771620 | <filename>app/api/routes.py<gh_stars>0
from flask import Blueprint
api = Blueprint('api', __name__, url_prefix='/api')
@api.route('/')
def api_index():
return {'key': 'value'}
| 2.171875 | 2 |
webhooks.py | JacobMannix/StaffordResults | 0 | 12771621 | <filename>webhooks.py
#!/home/mannix/anaconda3/bin/python
# # <NAME> [08-31-2020]
# Webhook Function
# Import Dependencies
import requests
# Function
def webhookMessage(webhook_url, message_content):
Message = {"content": message_content}
requests.post(webhook_url, data=Message)
| 2.109375 | 2 |
sobolev_alignment/multi_krr_approx.py | saroudant/sobolev_alignment | 1 | 12771622 | <filename>sobolev_alignment/multi_krr_approx.py
import numpy as np
import torch
# Falkon import
from falkon import Falkon, kernels
from falkon.kernels import GaussianKernel, MaternKernel, LaplacianKernel
class MultiKRRApprox:
def __init__(self):
self.krr_regressors = []
def predict(
sel... | 2.0625 | 2 |
autoant/producers.py | dpgaspar/AutoAnt | 3 | 12771623 |
import logging
import os, re
from threading import Thread
from .utils import boolstr, walkfiles
from .items import FileItem
from .processors import ProcessSequence
from .providers import BaseProvider, register_producer, register_property
log = logging.getLogger(__name__)
class BaseProducer(BaseProvider, Thread):
... | 2.5625 | 3 |
spinbin/core/limits.py | swc2124/spinbin | 0 | 12771624 | <gh_stars>0
@cython.boundscheck(False)
@cython.wraparound(False)
def find_dlims(
np.ndarray[np.float64_t, ndim=1] mag_arr,
double ab_mag_limit):
"""
Find the indices of the stars in an array that are visible given a limit.
Extended description of function.
Parameters
----------
m... | 2.359375 | 2 |
pyspectator/network.py | maximilionus/pyspectator-x | 39 | 12771625 | <reponame>maximilionus/pyspectator-x<gh_stars>10-100
import socket
from datetime import timedelta, datetime
import psutil
import netifaces as nif
from pyspectator.monitoring import AbcMonitor
from pyspectator.collection import LimitedTimeTable
class NetworkInterface(AbcMonitor):
def __init__(self, monitoring_lat... | 2.234375 | 2 |
facet/serializer/__init__.py | edponce/FACET | 2 | 12771626 | from .base import BaseSerializer
from .json import JSONSerializer
from .yaml import YAMLSerializer
from .arrow import ArrowSerializer
from .pickle import (
PickleSerializer,
CloudpickleSerializer,
)
from .string import (
StringSerializer,
StringSJSerializer,
)
from .null import NullSerializer
from typin... | 2.375 | 2 |
vpos/validators.py | txiocoder/django-vpos | 3 | 12771627 | <reponame>txiocoder/django-vpos
import re
from django.core import validators
from django.utils.deconstruct import deconstructible
from django.utils.translation import gettext_lazy as _
@deconstructible
class PhoneAOValidator(validators.RegexValidator):
regex = r'^(?:(\+244|00244))?(9)(1|2|3|4|9)([\d]{7,7})$'... | 2.296875 | 2 |
mycloud/commands/shared.py | ThomasGassmann/swisscom-my-cloud-backup | 4 | 12771628 | import asyncio
import logging
from functools import update_wrapper
import inject
from click import ClickException
from mycloud.drive.filesync.progress import ProgressTracker
from mycloud.mycloudapi import MyCloudRequestExecutor
from mycloud.mycloudapi.auth import AuthMode, MyCloudAuthenticator
def authenticated(fun... | 2.3125 | 2 |
python/367_Valid_Perfect_Square.py | dvlpsh/leetcode-1 | 4,416 | 12771629 | class Solution(object):
# def isPerfectSquare(self, num):
# """
# :type num: int
# :rtype: bool
# """
# i = 1
# while num > 0:
# num -= i
# i += 2
# return num == 0
def isPerfectSquare(self, num):
low, high = 1, num
... | 3.6875 | 4 |
src/rexecutor/utilities/flow_iterator.py | paulbodean88/customizable-bdd-system | 1 | 12771630 | import xmltodict
class Flow(object):
def __init__(self, rules_file):
self.__rules_file = rules_file
file_descriptor = open(rules_file, 'r')
self._flow = xmltodict.parse(file_descriptor.read())
file_descriptor.close()
def next_rule(self):
return self._flow['Rule']['@nam... | 3.0625 | 3 |
Item50.py | aambrioso1/Effective_Python | 0 | 12771631 | """
Item 50: Annotate Class Attributes with __set_name__
"""
#!/usr/bin/env PYTHONHASHSEED=1234 python3
# Reproduce book environment
import random
random.seed(1234)
import logging
from pprint import pprint
from sys import stdout as STDOUT
# Write all output to a temporary directory
import atexit
import gc
import i... | 3.546875 | 4 |
src/extractor/postal_code_extractor.py | KristerSJakobsson/japanese-data-extractor | 0 | 12771632 | import regex
from src.extractor.constants import separators, prefixes
from src.extractor.models.ExtractedData import ExtractedList
from src.extractor.models.RegexHandler import RegexHandler
from src.utils.conversion_utils import parse_postal_code
from src.utils.io_utils import load_regex
from src.utils.number_conversi... | 2.4375 | 2 |
event_handler.py | sontung/LeaguePredictor | 0 | 12771633 | import pygame
import sys
from pygame.locals import *
import core_communication
from multiprocessing import Queue, Process
def api_call_process(queue, playerId):
communicator = core_communication.WebServerCommunication()
info = communicator.getCurrentGame(playerId)
print info
queue.put(info)
class Ev... | 2.84375 | 3 |
mnist/4_report_server.py | abdelrahmanhosny/ModelPersonalization | 0 | 12771634 | import os
import torch
from collections import defaultdict
from edgify.utils import WriterQMNIST
if __name__ == "__main__":
for writer_id in range(131):
with open(os.path.join('data', 'QMNIST', 'models-subject-out', str(writer_id), 'accuracy_before.txt'), 'r') as f:
accuracy_before = f.readli... | 2.390625 | 2 |
main.py | geektype/Programming-Challenge-2 | 0 | 12771635 | <gh_stars>0
try:
from sys import exit
from os import system
from getpass import getpass
import os.path
except ImportError as e:
print("Failed to import 1 or more libraries")
print(e)
exit()
try:
import funs
except ImportError as e:
print("I failed to import the Function File (I REALL need it!)")
prinn("Make s... | 3.390625 | 3 |
util/compare_cod.py | manthey/ballistics | 6 | 12771636 | """
This compares force from drag on a 2 inch projectile at a variety of
velocities using a variety of formulas.
"""
import math
import sys
import ballistics
Hutton = { # Hutton, 1812, Vol. III, p. 318
5: 0.006,
10: 0.026,
15: 0.058,
20: 0.103,
25: 0.163,
30: 0.237,
40: 0.427,
50: 0.... | 3.0625 | 3 |
Analytics/drop_datasource.py | kpennels/SharingCitiesDashboard | 4 | 12771637 | """
Script to delete datasource
It is a handy script to delete datasource, while creating and new importers
The script only takes one argument the name of the API that needs to be deleted
Importers can be deleted:
python manage.py remove -id <Name-of-the-importer>
Name of the importer can be found:
python manage.p... | 2.890625 | 3 |
photos/views.py | felkiriinya/Personal-Gallery | 0 | 12771638 | from django.shortcuts import render,redirect
from django.http import HttpResponse,Http404
from .models import Image,Location,Category
# Create your views here.
from django import forms
from django.http import HttpResponse
from cloudinary.forms import cl_init_js_callbacks
from .forms import PhotoForm
def upload... | 2.1875 | 2 |
In Class Code/2-16-19/in_class_190226/preparation/http_server/simple_request_handler2.py | hamie96/CS-4720-Internet-Programming | 0 | 12771639 |
import http.server
import socketserver
PORT = 8000
# Found this at
# https://stackoverflow.com/questions/39801718/how-to-run-a-http-server-which-serve-a-specific-path
#
# Change the base directory for the simple server by intercepting the constructor
# for SimpleHTTPRequestHandler
DIRECTORY = "w... | 3.1875 | 3 |
dammit/tasks/shell.py | bluegenes/dammit | 0 | 12771640 | <gh_stars>0
# Copyright (C) 2015-2018 <NAME>
# All rights reserved.
#
# This software may be modified and distributed under the terms
# of the BSD license. See the LICENSE file for details.
import os
import sys
import hashlib
import gzip
from doit.action import CmdAction
from doit.exceptions import TaskFailed
from ... | 2.1875 | 2 |
internationalflavor/vat_number/data.py | burakozdemir32/django-internationalflavor | 0 | 12771641 | VAT_NUMBER_REGEXES = {
# EU VAT number regexes have a high certainty
'AT': r'^U\d{8}$',
'BE': r'^[01]\d{9}$',
'BG': r'^\d{9,10}$',
'CY': r'^\d{8}[A-Z]$',
'CZ': r'^\d{8,10}$',
'DE': r'^\d{9}$',
'DK': r'^\d{8}$',
'EE': r'^\d{9}$',
'EL': r'^\d{9}$',
'ES': r'^([A-Z]\d{7}[A-Z0-9]|... | 1.640625 | 2 |
Assets/Scripts/MetadataGenerator.py | pedroam14/RTBIM | 0 | 12771642 | import numpy as np
import random as rd
import pandas as pd
data = pd.read_csv('Assets\MetaData\Metadata1.csv',sep = ';')
print(data)
x = data["Cost"]
print (x)
for i in range(1,17):
x = data[data.columns[i]]
for j in range (0,len(x)-1):
if(x[j] is not None):
x[j] = rd.randint(0,400)
... | 2.734375 | 3 |
homeassistant/components/roon/config_flow.py | erogleva/core | 6 | 12771643 | """Config flow for roon integration."""
import asyncio
import logging
from roon import RoonApi
import voluptuous as vol
from homeassistant import config_entries, core, exceptions
from homeassistant.const import CONF_API_KEY, CONF_HOST
from .const import ( # pylint: disable=unused-import
AUTHENTICATE_TIMEOUT,
... | 2.40625 | 2 |
archived_scripts/vsb_monte_random_forest.py | jeffreyegan/VSB_Power_Line_Fault_Detection | 6 | 12771644 | <gh_stars>1-10
import os
import time
from datetime import datetime
import pandas as pd
import numpy as np
def load_feature_data(file_name):
df = pd.read_csv(file_name)
return df
def split_data(features, labels, random_state_value):
from sklearn.model_selection import train_test_split
# Using stand... | 2.75 | 3 |
enn_zoo/enn_zoo/griddly/__init__.py | batu/incubator | 0 | 12771645 | import os
from abc import abstractmethod
from typing import Tuple, Type, Dict, Optional, Any
from enn_zoo.griddly.wrapper import GriddlyEnv
from entity_gym.environment import ActionSpace, ObsSpace, Entity, CategoricalActionSpace
from entity_gym.environment import Environment
from griddly import GymWrapper, gd
init_pa... | 2.296875 | 2 |
can_wifi/can_wifi/tactile_signal_publisher.py | wngfra/can2wifi2ros | 0 | 12771646 | # Copyright (c) 2020 wngfra
# Use of this source code is governed by the Apache-2.0 license, see LICENSE
import socket
from collections import deque
import numpy as np
import rclpy
from rclpy.node import Node
from tactile_interfaces.msg import TactileSignal
from tactile_interfaces.srv import ChangeState
STATE_LIST... | 2.265625 | 2 |
sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/_azure_reservation_api_enums.py | beltr0n/azure-sdk-for-python | 2 | 12771647 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | 2.078125 | 2 |
raspi_object_detection.py | NobuoTsukamoto/raspi_tensorflor_object_detection | 0 | 12771648 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Copyright (c) 2019 <NAME>
This software is released under the MIT License.
See the LICENSE file in the project root for more information.
"""
import numpy as np
import os
import six.moves.urllib as urllib
import sys
import tarfile
import tensorflow as tf... | 1.820313 | 2 |
upf/test/test_problem.py | aiplan4eu/upf | 14 | 12771649 | # Copyright 2021 AIPlan4EU project
#
# 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 wri... | 2.53125 | 3 |
programs/pgm06_07.py | danielsunzhongyuan/python_practice | 0 | 12771650 | #
# This file contains the Python code from Program 6.7 of
# "Data Structures and Algorithms
# with Object-Oriented Design Patterns in Python"
# by <NAME>.
#
# Copyright (c) 2003 by <NAME>, P.Eng. All rights reserved.
#
# http://www.brpreiss.com/books/opus7/programs/pgm06_07.txt
#
class StackAsLinkedList(Stack):
... | 3.203125 | 3 |