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 |
|---|---|---|---|---|---|---|
grocery/products/migrations/0006_auto_20210426_1320.py | DeepakDk04/bigbasketClone | 0 | 12786851 | <reponame>DeepakDk04/bigbasketClone<filename>grocery/products/migrations/0006_auto_20210426_1320.py
# Generated by Django 3.1.7 on 2021-04-26 07:50
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('products', '0005_auto_20210426_1318'),
]
operati... | 1.65625 | 2 |
main.py | Praveendwivedi/Recento | 0 | 12786852 | import discord
import os
import requests,json
import tweepy
consumer_key=os.getenv('C_K')
consumer_secret=os.getenv('C_S')
access_token=os.getenv('A_T')
access_token_secret=os.getenv('A_S')
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy... | 2.796875 | 3 |
back-end/RawFishSheep/app_warehouse/migrations/0002_auto_20190508_2022.py | Coldarra/RawFishSheep | 0 | 12786853 | # Generated by Django 2.0.7 on 2019-05-08 12:22
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('app_warehouse', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='cargoin',
... | 1.609375 | 2 |
dock/cccp/__init__.py | Plane-walker/Okeanos | 6 | 12786854 | from .cccp import *
| 1.09375 | 1 |
_pkg_KuFunc/mod_ViewerShortcuts.py | tianlunjiang/_NukeStudio_v2 | 6 | 12786855 | <reponame>tianlunjiang/_NukeStudio_v2
'''
Based on QuckCreate by <NAME>
'''
#------------------------------------------------------------------------------
#-Module Import
#------------------------------------------------------------------------------
import platform
import os
from Qt import QtWidgets, QtGui, ... | 1.59375 | 2 |
amp/broker/exchange.py | rgozi/amp | 0 | 12786856 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2021-10-21
# @Author : iamwm
from amp.broker.store import Store
class Exchange:
"""
exchange of broker
"""
def __init__(self, name: str) -> None:
self.name = name
self.topic_manager = Store(Topic)
def bind_topic(self, t... | 2.359375 | 2 |
ImageCaptioning/model.py | darkmatter18/Caption-AI | 1 | 12786857 | # Copyright 2020 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | 2.15625 | 2 |
tests/__init__.py | grikbi/coreapi-async-worker | 0 | 12786858 | """The unit test code for f8a-server-backbone."""
| 0.910156 | 1 |
PU_Bayesian_classifiers/PSTAN.py | chengning-zhang/Bayesian-Classifers-for-PU_learning | 4 | 12786859 | class PSTAN(Bayes_net_PU):
name = "PSTAN"
def __init__(self, alpha = 1,starting_node = 0):
self.starting_node = starting_node
self.alpha = alpha
def Findparent(self, M):
M = M.copy() # to avoid change global M
np.fill_diagonal(M,0)
p = int(M.shape[0])
V = range(p) # s... | 2.65625 | 3 |
learn/tests/tests_services/tests_signal.py | Aigrefin/py3learn | 0 | 12786860 | <gh_stars>0
import smtplib
from unittest.mock import call, Mock, MagicMock, patch
from django.contrib.auth.models import User
from django.test import TestCase
from learn.models import Translation, Dictionary
from learn.services import signals
class SignalsTests(TestCase):
def test_shouldSendMailContaining_Dicti... | 2.515625 | 3 |
Greedy/045. Jump Game II.py | beckswu/Leetcode | 138 | 12786861 |
class Solution:
def jump(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
n = len(nums)
if n<2: return 0
step, reach, next = 0, 0, 0
for i, v in enumerate(nums):
if i == reach:
reach = max(next, i+v)
... | 3.390625 | 3 |
tests/sampling/test_sampler.py | leopoldavezac/BayesianMMM | 18 | 12786862 | from _pytest.mark import param
import pytest
import numpy as np
from bayesian_mmm.sampling.stan_model_generator import StanModelGenerator
from bayesian_mmm.sampling.sampler import Sampler
from bayesian_mmm.sampling.stan_model_wrapper import StanModelWrapper
MAX_LAG = 4
SPENDS = np.array([[10, 20], [0, 8], [1, 30], [5... | 1.953125 | 2 |
examples/eventTester.py | tgolsson/appJar | 666 | 12786863 | <filename>examples/eventTester.py
import sys
sys.path.append("../")
from appJar import gui
def press(btn):
print("default:", btn)
if btn == "writing":
app.setTextArea("t1", "some writing")
elif btn == "writing2":
app.setTextArea("t2", "some writing")
elif btn == "get":
print(app... | 2.71875 | 3 |
doxieautomator/doxie.py | ninapavlich/doxie-automator | 4 | 12786864 | import os
import sys
import time
import json
import cStringIO
import logging
import requests
from requests.auth import HTTPBasicAuth
from PIL import Image
from base import SingleInstance
import settings
class DoxieAutomator(SingleInstance):
scanner_online = False
DELETE_ON_CORRUPTED = True #If true, delet... | 2.46875 | 2 |
isi_mip/core/migrations/0009_auto_20180221_1017.py | ISI-MIP/isimip | 4 | 12786865 | <filename>isi_mip/core/migrations/0009_auto_20180221_1017.py
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2018-02-21 09:17
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0008_auto_20180215_1138... | 1.625 | 2 |
src/model/pretrained_wordvec.py | Sakchhi/yelp_analysis | 2 | 12786866 | <filename>src/model/pretrained_wordvec.py<gh_stars>1-10
import config, run_config
import os
import pickle
import csv
import numpy as np
from sklearn.model_selection import train_test_split
import pandas as pd
import spacy
from sklearn import metrics
from sklearn.linear_model import LogisticRegression
nlp = spacy.load... | 2.625 | 3 |
third_party/NW Script Tools/Miscellaneous Tools/NW Go To Frame.py | n1ckfg/C4DToolbox | 9 | 12786867 | <filename>third_party/NW Script Tools/Miscellaneous Tools/NW Go To Frame.py
import c4d # reference Cinema4D's existing library of code, called a "module"
def main(): # Define the main function of the script
# - - - - - - COPY THE FOLLOWING INTO YOUR SCRIPT, ABOVE THE MAIN FUNCTION - - - - - - -
def ... | 3.28125 | 3 |
bmsapp/__init__.py | alanmitchell/bmon | 11 | 12786868 | <reponame>alanmitchell/bmon
from . import logging_setup # causes logging setup code to run.
| 0.984375 | 1 |
sqlint/parser/__init__.py | moriaki3193/sqlint | 1 | 12786869 | <filename>sqlint/parser/__init__.py
# -*- coding: utf-8 -*-
from sqlint.parser import config
from sqlint.parser import parser
from sqlint.parser import pattern
from sqlint.parser import token
__all__ = [
'config',
'parser',
'pattern',
'token'
]
| 1.742188 | 2 |
mdcorpus/examples/parse_character.py | sosuke-k/cornel-movie-dialogs-corpus-storm | 1 | 12786870 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from storm.locals import *
from mdcorpus.orm import *
from mdcorpus.parser import *
parser = Parser()
f = open("sample_movie_characters_metadata.txt")
line = f.readline()
while line:
print "=== parse this line ==="
print line
list = parser.movie_characters_m... | 2.859375 | 3 |
one_fm/patches/v1_0/change_title_in_grd.py | askmetoo/One-FM | 16 | 12786871 | from __future__ import unicode_literals
import frappe
from frappe.desk.doctype.notification_log.notification_log import enqueue_create_notification,\
get_title, get_title_html
def execute():
set_title_wp_as_civil_id()
set_title_mi_as_civil_id()
set_title_moi_as_civil_id()
set_title_fp_as_civil_id()
d... | 1.890625 | 2 |
personal/Ervin/tf_collaborative_user.py | edervishaj/spotify-recsys-challenge | 3 | 12786872 | <reponame>edervishaj/spotify-recsys-challenge<filename>personal/Ervin/tf_collaborative_user.py
"""
@author <NAME>
@email <EMAIL>
"""
from recommenders.recommender import Recommender
from recommenders.similarity.s_plus import *
from utils.datareader import Datareader
from utils.evaluator import Evaluator
from utils.pos... | 2.421875 | 2 |
tenable_light.py | andrewspearson/tenable_light | 1 | 12786873 | <reponame>andrewspearson/tenable_light<filename>tenable_light.py<gh_stars>1-10
import configparser
import urllib.request
from urllib.error import HTTPError
import ssl
import json
config = configparser.ConfigParser()
config.read('tenable.ini')
def request(method, host, endpoint, url=None, headers=None, data=None, pro... | 2.625 | 3 |
app/db/models/bigintkey.py | sp0x/orion | 0 | 12786874 | <filename>app/db/models/bigintkey.py
import peewee as pw
class BigIntPrimaryKey(pw.PrimaryKeyField):
field_type = 'BIGAUTO'
| 1.851563 | 2 |
experiments.py | kafluette/ffnnet | 4 | 12786875 | <reponame>kafluette/ffnnet<gh_stars>1-10
import theano
import theano.tensor as T
k = T.iscalar("k")
A = T.vector("A")
y = T.ivector("y")
# Symbolic description of the result
result, updates = theano.scan(fn=lambda n: (1-y[n]) * T.log(T.nnet.sigmoid(1)),sequences=[T.arange(10)])
# We only care about A**k, but scan ha... | 2.375 | 2 |
Matlab/PLNet/python_tensorflow/plnet_tf_demo.py | disc5/DyraLib | 0 | 12786876 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
PLNet for fixed sized input rankings.
Version: M fixed but generic
Idea: Working with M networks in parallel that permanently remain in memory.
Testbed - label ranking / housing dataset
@author: dirk
"""
from __future__ import absolute_import
from __future__ i... | 2.46875 | 2 |
etreebrowser/sparql.py | CameronJRAllan/eTree-Browser | 1 | 12786877 | <gh_stars>1-10
from SPARQLWrapper import SPARQLWrapper, JSON, POSTDIRECTLY
import datetime
import urllib
from PyQt5 import QtWidgets
import calma
import graph
class SPARQL():
def __init__(self):
"""
Initializes an instance of the SPARQL class.
The SPARQL class is used for all interfacing wit... | 2.609375 | 3 |
pymagnitude/third_party/allennlp/tests/data/token_indexers/dep_label_indexer_test.py | tpeng/magnitude | 1,520 | 12786878 | <gh_stars>1000+
# pylint: disable=no-self-use,invalid-name
from __future__ import absolute_import
from collections import defaultdict
from allennlp.common.testing import AllenNlpTestCase
from allennlp.data import Token, Vocabulary
from allennlp.data.token_indexers import DepLabelIndexer
from allennlp.data.tokenizers.... | 2.453125 | 2 |
dragonhacks2019/config.py | jcarrete5/dragonhacks2019 | 0 | 12786879 | import json
class Config:
def __init__(self, file=None):
with open(file) as cfg_file:
self._cfg = json.load(cfg_file)
self._scopes = [scope for scope in self._cfg['scopes']]
self._scope_index = 0
self._current_scope: dict = self._scopes[0]
def next_scope(self) -> b... | 3.21875 | 3 |
solutions/234.palindrome-linked-list/palindrome-linked-list.py | wangsongiam/leetcode | 3 | 12786880 | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def isPalindrome(self, head):
"""
:type head: ListNode
:rtype: bool
1 2 3 4 5
1 2 3 4
| |
"""
slo... | 3.71875 | 4 |
request_examples/get_request.py | ParthSareen/Intro-to-APIs | 0 | 12786881 | import requests
import pprint
pp = pprint.PrettyPrinter(indent=4)
# Example for making a GET requests
link = 'http://localhost:5000/example-get-static'
response = requests.get(link)
responseDict = response.json()
pp.pprint(responseDict)
# access the dict
print(responseDict['num-example'])
# your name goes here
na... | 3.203125 | 3 |
app/views.py | verowangari/pitch-post | 0 | 12786882 | from re import U
from flask import Blueprint, render_template,request,flash,redirect,url_for
from flask_login import login_required, current_user
from .models import Pitch,User,Comment,Like
from . import db
views = Blueprint("views", __name__)
@views.route("/")
@views.route("/home")
@login_required
def home():
p... | 2.5 | 2 |
torchlatent/semiring.py | speedcell4/torchlatent | 7 | 12786883 | <reponame>speedcell4/torchlatent<gh_stars>1-10
import torch
from torch import Tensor
from torch.types import Device
from torchrua.scatter import scatter_add, scatter_max, scatter_mul, scatter_logsumexp
from torchrua.tree_reduction import tree_reduce_sequence, TreeReduceIndices
from torchlatent.functional import logsum... | 1.984375 | 2 |
train/coders/coder.py | mukkachaitanya/parity-models | 0 | 12786884 | <reponame>mukkachaitanya/parity-models<gh_stars>0
import torch
import torch.nn as nn
class Coder(nn.Module):
"""
Base class for implementing encoders and decoders. All new encoders and
decoders should derive from this class.
"""
def __init__(self, num_in, num_out, in_dim):
"""
Par... | 2.765625 | 3 |
servizi/spese/migrations/0002_auto_20161126_1756.py | l-dfa/django-spese | 0 | 12786885 | <filename>servizi/spese/migrations/0002_auto_20161126_1756.py<gh_stars>0
# -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2016-11-26 16:56
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies =... | 1.453125 | 1 |
user_manage/views.py | FXuZ/colock-server | 0 | 12786886 | from django.shortcuts import render, render_to_response
from django import forms
from django.http import HttpResponse
from django.forms import ModelForm
from user_manage.models import User
from django.views.decorators.csrf import csrf_exempt
from django.utils import timezone
import requests
from colock.key_generator ... | 1.976563 | 2 |
accounts/i18n.py | j3ygh/ctdb | 1 | 12786887 | """
This file contains strings which need i18n but doesn't have a place in any files.
They maybe appear in DB only, so they can't be detected without being writed explicitly.
"""
from django.utils.translation import gettext_lazy as _
I18N_NEEDED = [
_('T00 member'),
_('T01 member'),
_('T02 member'),
_(... | 1.992188 | 2 |
src/predict.py | Kosuke-Yamada/yans2021hackathon_teamd | 3 | 12786888 | #-*-coding:utf-8-*-
import os
import re
import json
import time
import glob
import random
import argparse
import numpy as np
import pandas as pd
from tqdm import tqdm
import torch
from torch.utils.data import DataLoader
from transformers import AutoTokenizer, AutoModel
from shiba import Shiba, CodepointTokenizer, get... | 1.875 | 2 |
test/transform/test_base.py | marrow/schema | 3 | 12786889 | <filename>test/transform/test_base.py
from io import StringIO
from marrow.schema.exc import Concern
from marrow.schema.testing import TransformTest
from marrow.schema.transform.base import BaseTransform, Transform, IngressTransform, EgressTransform, SplitTransform
PASSTHROUGH = (None, False, True, "", "Foo", 27, 42... | 2.15625 | 2 |
Outils/IHM/TRUST_PLOT2D/src/trust_plot2d/MenuTRUSTWidget.py | cea-trust-platform/trust-code | 12 | 12786890 | <reponame>cea-trust-platform/trust-code
from pyqtside.QtCore import Qt, QTimer, QDir, Slot
from pyqtside.QtWidgets import QMainWindow,QMenu, QFileDialog, QDockWidget
from pyqtside.uic import loadUiGen
from .utils import completeResPath
from .FileManager import FileManager
import os
import curveplot
class MenuTRUSTWi... | 2.015625 | 2 |
mapclientplugins/scaffoldfiniteelementmeshfitterstep/view/scaffoldmeshfitterwidget.py | mahyar-osn/mapclientplugins.scaffoldfiniteelementmeshfitterstep | 0 | 12786891 | from PySide import QtGui, QtCore
from opencmiss.zinchandlers.scenemanipulation import SceneManipulation
from mapclientplugins.scaffoldfiniteelementmeshfitterstep.handlers.datapointadder import DataPointAdder
from mapclientplugins.scaffoldfiniteelementmeshfitterstep.handlers.datapointadder import DataPointAdder
from m... | 1.84375 | 2 |
PP4E-Examples-1.4/Examples/PP4E/Lang/summer3.py | AngelLiang/PP4E | 0 | 12786892 | sums = {}
for line in open('table4.txt'):
cols = [float(col) for col in line.split()]
for pos, val in enumerate(cols):
sums[pos] = sums.get(pos, 0.0) + val
for key in sorted(sums):
print(key, '=', sums[key])
| 2.640625 | 3 |
working/bin/forms/mainMenu.py | grinchios/college_project-commented | 0 | 12786893 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# theme and sys for linking signals
import sys
# other forms
import managerMenu as managermenu
import staffForm as staffform
import stockForm as stockform
import treatmentsForm as treatmentsform
import appointmentForm as appointmentform
import chartForm as chartform
im... | 1.984375 | 2 |
SentimentAnalysis/pickleMe.py | sazlin/reTOracle | 0 | 12786894 | import cPickle
def load_pickle(filename):
pickled = open(filename, 'rb')
data = cPickle.load(pickled)
return data
def export_pickle(filename, the_object):
pickle_file = open(filename, 'w')
cPickle.dump(the_object, pickle_file)
pickle_file.close() | 2.875 | 3 |
turbustat/tests/test_stat_moments.py | keflavich/TurbuStat | 0 | 12786895 | # Licensed under an MIT open source license - see LICENSE
'''
Test functions for Kurtosis
'''
from unittest import TestCase
import numpy as np
import numpy.testing as npt
from ..statistics import StatMoments, StatMomentsDistance
from ._testing_data import \
dataset1, dataset2, computed_data, computed_distances... | 2.8125 | 3 |
sdcclient/secure/_policy_events_v1.py | DaveCanHaz/sysdig-sdk-python | 0 | 12786896 | import datetime
import requests
from sdcclient._common import _SdcCommon
class PolicyEventsClientV1(_SdcCommon):
def __init__(self, token="", sdc_url='https://secure.sysdig.com', ssl_verify=True, custom_headers=None):
super(PolicyEventsClientV1, self).__init__(token, sdc_url, ssl_verify, custom_headers)... | 2.28125 | 2 |
logwriter/logwriter.py | mbukatov/ocs-workload | 5 | 12786897 | <gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf8 -*-
from datetime import datetime
import argparse
import hashlib
import logging
import os
import sys
import time
import uuid
def main():
ap = argparse.ArgumentParser(description="logwriter")
ap.add_argument(
"directory",
help="directory... | 2.890625 | 3 |
shepherding/util/plot_ss.py | argyili/shepherding-public | 0 | 12786898 | <gh_stars>0
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import matplotlib.animation as anim
import time
''' Recorded simulation data into csv files '''
''' Initiliaze plot line by csv '''
def init_plot_line_csv(ax, param, sheeps_color, sheeps_pos, shepherds_color, ... | 2.6875 | 3 |
serial_scripts/llgr/base.py | atsgen/tf-test | 5 | 12786899 | <filename>serial_scripts/llgr/base.py
#
# To run tests, you can do 'python -m testtools.run tests'. To run specific tests,
# You can do 'python -m testtools.run -l tests'
# Set the env variable PARAMS_FILE to point to your ini file. Else it will try to pick params.ini in PWD
#
from common.neutron.base import BaseNeutro... | 1.976563 | 2 |
sorts/bucket_sort.py | coderpower0/Python | 2 | 12786900 | <filename>sorts/bucket_sort.py<gh_stars>1-10
#!/usr/bin/env python
# Author: <NAME>
# This program will illustrate how to implement bucket sort algorithm
# Wikipedia says: Bucket sort, or bin sort, is a sorting algorithm that works by distributing the
# elements of an array into a number of buckets. Each bucket is the... | 4.5 | 4 |
python/src/heapa.py | tankersleyj/algorithms | 0 | 12786901 | # MIT (c) jtankersley 2019-06-04
from enum import Enum
"""
Array based Heap.
left_child_index = index * 2 + 1
right_child_index = index * 2 + 2
parentIndex = (index - 1) // 2
00
01 02
03 04 05 06
07 08 09 10 11 12 13 14
"""
class HeapType(Enum):
MINIMUM... | 3.8125 | 4 |
scripts/db_tools/init_db.py | Chaoyingz/paper_trading | 0 | 12786902 | import click
from motor.motor_asyncio import AsyncIOMotorClient
from pymongo.errors import CollectionInvalid
from app import settings
from scripts.utils import coro
async def create_collection(db: AsyncIOMotorClient, collection_name: str):
"""创建表."""
try:
await db[settings.MONGO_DB].create_collection... | 2.328125 | 2 |
nb4/run_policy_simulation.py | Agoric/testnet-notes | 2 | 12786903 | # -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# formats: ipynb,py:light
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.11.2
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
... | 1.9375 | 2 |
sections/contributor.py | codeine-coding/APA-References | 1 | 12786904 | <gh_stars>1-10
from tkinter import Entry, W, StringVar, Listbox, BOTH
from utils.apa_widgets import *
class ContributorSection(Section):
def __init__(self, master, **options):
Section.__init__(self, master, **options)
self.contributor_first_name = StringVar()
self.contributor_middle_name ... | 3.0625 | 3 |
track_people_py/scripts/track_sort_3d_people.py | kufusha/cabot | 0 | 12786905 | <filename>track_people_py/scripts/track_sort_3d_people.py
#!/usr/bin/env python3
# Copyright (c) 2021 IBM Corporation
#
# 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, ... | 1.390625 | 1 |
redmine_shell/shell/input.py | shlomo90/redmine_shell | 1 | 12786906 | <gh_stars>1-10
""" Input for Redmine shell. """
import sys
import os
import termios
import contextlib
from enum import Enum
from .command import Command
from redmine_shell.command.system.commands import History, HistoryMove
class State(Enum):
''' Character Key Event State. '''
CONTINUE = -1
BREAK = -2
... | 2.375 | 2 |
newBoCodeCodingChallenge.py | RobbieNesmith/Code-Challenge | 0 | 12786907 | def odometer(arr, change):
pos = len(arr) - 1
while pos >= 0 and change != 0:
sum = arr[pos] + change
if sum < 0:
change = sum
else:
change = sum // 10
arr[pos] = sum % 10
pos = pos - 1
if change == 1:
arr[0] = 1
tests = [{"input": [4,3,9,5], "output": [4,3,9,6]},... | 3.640625 | 4 |
src/118.pascals-triangle/118.pascals-triangle.py | AnestLarry/LeetCodeAnswer | 0 | 12786908 | #
# @lc app=leetcode id=118 lang=python3
#
# [118] Pascal's Triangle
#
# Given a non-negative integer numRows, generate the first numRows of Pascal's triangle.
# In Pascal's triangle, each number is the sum of the two numbers directly above it.
# Example:
# Input: 5
# Output:
# [
# [1],
# [1,1],
# [1,2,... | 3.625 | 4 |
Snake Game/snake.py | zYxDevs/Python_Scripts | 14 | 12786909 | <reponame>zYxDevs/Python_Scripts<gh_stars>10-100
from turtle import Turtle
MOVE=20
TURTLE_POS=[(0,0),(-20,0),(-40,0)]
UP=90
DOWN=270
LEFT=180
RIGHT=0
class Snake:
"""Creates snakes objects and stores them in a list"""
def __init__(self):
self.all_segment=[]
self.create_snake()
self.h... | 3.640625 | 4 |
gravity_wave/solver.py | thomasgibson/firedrake-hybridization | 0 | 12786910 | <reponame>thomasgibson/firedrake-hybridization
from firedrake import *
from firedrake.assemble import create_assembly_callable
from firedrake.parloops import par_loop, READ, INC
from firedrake.utils import cached_property
from pyop2.profiling import timed_stage, timed_region
from ksp_monitor import KSPMonitorDummy
from... | 2.171875 | 2 |
observers.py | rnowling/integrator-experiments | 0 | 12786911 | <filename>observers.py
import numpy as np
class TotalEnergyObserver(object):
def __init__(self, period):
self.period = period
self.energies = []
self.eps = 1e-5
def observe(self, state):
if state.simulated_time % self.period < self.eps:
self.energies.append(state.to... | 2.984375 | 3 |
tests/apps/pages/component_as_trigger.py | T4rk1n/dazzler | 15 | 12786912 | <reponame>T4rk1n/dazzler
"""
Page component_as_trigger of dazzler
Created 2019-06-16
"""
import json
from dazzler.components import core
from dazzler.system import Page, Trigger, BindingContext, State
page = Page(
__name__,
core.Container([
core.Container(core.Container('from children'), identity='com... | 2.0625 | 2 |
examples/layout_form.py | pzahemszky/guizero | 320 | 12786913 | from guizero import App, Text, TextBox, Combo, PushButton, Box
app = App()
Text(app, text="My form")
form = Box(app, width="fill", layout="grid")
form.border = True
Text(form, text="Title", grid=[0,0], align="right")
TextBox(form, grid=[1,0])
Text(form, text="Name", grid=[0,1], align="right")
TextBox(form, grid=[1... | 2.96875 | 3 |
Unsupervised_Clustering/Variational_Autoencoders/Vol_VAE_Utils.py | DavidBMcCoy/ZSFG-UCSF_Machine_Learning | 1 | 12786914 | <filename>Unsupervised_Clustering/Variational_Autoencoders/Vol_VAE_Utils.py
import numpy as np
def convert_to_one_hot(Y, C):
"""
make the label a 1x2 array for each image
"""
Y = np.eye(C)[Y.reshape(-1)].T
return Y
| 2.296875 | 2 |
resources/mgltools_x86_64Linux2_1.5.6/MGLToolsPckgs/Volume/VisionInterface/ContourSpectrum.py | J-E-J-S/aaRS-Pipeline | 8 | 12786915 | ## Automatically adapted for numpy.oldnumeric Jul 23, 2007 by
########################################################################
#
# Date: Mars 2006 Authors: <NAME>, <NAME>
#
# <EMAIL>
# <EMAIL>
#
# The Scripps Research Institute (TSRI)
# Molecular Graphics Lab
# La Jolla, CA 92037, USA
... | 2.25 | 2 |
resources/lib/ttml2srt.py | dhoffend/plugin.video.mediathekview | 0 | 12786916 | # -*- coding: utf-8 -*-
# Copyright 2017 <NAME>
# See https://github.com/codingcatgirl/ttml2srt
#
# MIT License
#
# Copyright (c) 2017 <NAME>
#
# 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... | 1.9375 | 2 |
gw_full_latest/loraWAN.py | cuongdodinh/LowCostLoRaGw | 0 | 12786917 | #------------------------------------------------------------
# Copyright 2016 <NAME>, University of Pau, France.
#
# <EMAIL>
#
# This file is part of the low-cost LoRa gateway developped at University of Pau
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Gene... | 2.28125 | 2 |
binding.gyp | codyrigney92/node-rpi-si4703 | 0 | 12786918 | <reponame>codyrigney92/node-rpi-si4703
{
"targets": [
{
"target_name": "node-rpi-si4703",
"cflags!": ['-fno-exceptions -std=c++11'],
"cflags_cc!": ['-fno-exceptions -std=c++11'],
"sources": ["src/node-rpi-si4703.cpp", "src/FMTuner.cpp", "src/FMTuner.h", "src/rpi-si4703/Si4703_Breakout.cpp"... | 1.109375 | 1 |
timer_decor.py | romchegue/Python | 0 | 12786919 | # file: timer_decor.py
import time
class timer:
def __init__(self, func):
self.func = func
self.alltime = 0
def __call__(self, *args, **kwargs):
start = time.time()
result = self.func(*args, **kwargs)
elapsed = time.time() - start
self.alltime += elapsed
# ... | 3.765625 | 4 |
keras_dgl/__init__.py | michael-cowan/keras-deep-graph-learning | 0 | 12786920 | from keras_dgl._version import __version__
| 1.023438 | 1 |
src/app/models.py | 510908220/heartbeats | 23 | 12786921 | <reponame>510908220/heartbeats
# -*- coding:utf-8 -*-
from django.db import models
from django.conf import settings
# Create your models here.
class Tag(models.Model):
class Meta:
db_table = "tag"
name = models.CharField(max_length=200, unique=True, blank=False, null=False)
created = models.DateT... | 2.09375 | 2 |
bkt.py | JonathanSilver/pyKT | 1 | 12786922 | <gh_stars>1-10
import torch
import torch.nn as nn
import torch.optim as optim
import numpy as np
import matplotlib.pyplot as plt
from sklearn.metrics import roc_auc_score, mean_squared_error, mean_absolute_error
from math import sqrt
import os
import json
from pprint import pprint
import argparse
... | 2.125 | 2 |
pynepsys/__init__.py | jpelzer/pynepsys | 0 | 12786923 | <reponame>jpelzer/pynepsys<filename>pynepsys/__init__.py
from pynepsys.pynepsys import Apex, Probe, Outlet
__version__ = "1.2.0"
| 1 | 1 |
backend/messages/serializers.py | HillalRoy/Studenthut | 1 | 12786924 | from .models import ClassMessage, Message
from rest_framework import serializers
from django.contrib.auth.models import User
class UserUserNameSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ['username']
class MessageSerializers(serializers.ModelSerializer):
sender... | 2.1875 | 2 |
moyu_engine/config/main.py | MoYuStudio/MYSG01 | 0 | 12786925 |
import sys
import pygame
from pygame.locals import *
import moyu_engine.config.data.constants as C
import moyu_engine.config.system.assets_system
import moyu_engine.config.system.tilemap_system
import moyu_engine.config.system.move_system
import moyu_engine.config.window.main_window
def init():
pygame.init(... | 2.34375 | 2 |
knn.py | AlparslanErol/KNN | 0 | 12786926 | <filename>knn.py
from csv import reader
from math import sqrt
import matplotlib.pyplot as plt
# Load a CSV file
def load_csv(filename):
dataset = list()
with open(filename, 'r') as file:
csv_reader = reader(file)
for row in csv_reader:
if not row:
continue
dataset.append(row)
return dataset
# Edit... | 3.734375 | 4 |
src/roughml/shared/decorators.py | billsioros/RoughML | 0 | 12786927 | import inspect
import logging
import time
from functools import wraps
logger = logging.getLogger(__name__)
def benchmark(method):
"""The following decorator aims at calculating the decorated function's
execution time and is used to benchmark our various approaches and assist
us in coming up with a compre... | 3.8125 | 4 |
icfs/cloudapi/cloud.py | bhanupratapjain/icfs | 0 | 12786928 | <gh_stars>0
from icfs.cloudapi.google import GDrive
# @class_decorator(logger)
class Cloud:
def __init__(self, gdrive_settings, tmp, creds):
self.gdrive_settings = gdrive_settings
self.clients = {}
self.creds = creds
self.tmp = tmp
def restore_gdrive(self, client_id):
... | 2.296875 | 2 |
analyze_stats.py | JPEWdev/oe-icecream-demo | 4 | 12786929 | #! /usr/bin/env python3
#
# Copyright 2019 Garmin Ltd. or its subsidiaries
#
# SPDX-License-Identifier: Apache-2.0
import os
import sys
import glob
import re
from scipy import stats
import numpy
THIS_DIR = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(THIS_DIR, 'poky', 'scripts', 'lib'))
f... | 2.078125 | 2 |
app.py | SlashNephy/chinachu-epgs-proxy | 1 | 12786930 | <filename>app.py
import os
import string
import requests
from flask import Flask, jsonify
HTTP_HOST = os.getenv("HTTP_HOST", "0.0.0.0")
HTTP_PORT = int(os.getenv("HTTP_PORT", "3000"))
EPGSTATION_HOST = os.getenv("EPGSTATION_HOST", "epgstation")
EPGSTATION_PORT = int(os.getenv("EPGSTATION_PORT", "8888"))
USE_HALF_WIDTH... | 2.859375 | 3 |
inject.py | LouisRoss/spiking-datasets | 0 | 12786931 | <reponame>LouisRoss/spiking-datasets
import sys
import json
from support.realtime_manager import RealtimeManager,BufferManager
def parse_args():
filename = ''
repeats = 250
period = 250 # microseconds
multiples = 1
step = 0
if len(sys.argv) < 2:
print(f'Usage: {sys.argv[0]} <filename> [repeats] [p... | 2.78125 | 3 |
calcloudML/tests/test_example.py | alphasentaurii/calcloud-ai | 1 | 12786932 | <gh_stars>1-10
import pytest
import os
from calcloudML.makefigs import load_data
from calcloudML.makefigs import predictor
def test_data_import():
print(os.getcwd())
assert True
# df = load_data.get_single_dataset("data/hst_data.csv")
# instruments = list(df["instr_key"].unique())
# assert len(in... | 2.234375 | 2 |
midprice_profit_label/label_by_profit/jump_label_new_algo.py | anakinanakin/neural-network-on-finance-data | 1 | 12786933 | # use python3
import pandas as pd
import matplotlib.pyplot as plt
plt.rcParams.update({'figure.max_open_warning': 0})
from matplotlib import patches
from matplotlib.pyplot import figure
from datetime import timedelta, date
def date_range(start_date, end_date):
for n in range(int((end_date - start_date).days)):... | 2.953125 | 3 |
strip_visibility.py | lingochamp/tensorflow | 0 | 12786934 | <gh_stars>0
"""This script replaces any internal visibility with //visibility:public."""
from subprocess import call
import glob
import os
import os.path
import re
def _build_files(workspace_dir):
"""Return all BUILD files under the workspace dir.
This excludes symbolic links.
"""
build_files = []
... | 2.765625 | 3 |
seisflow/scripts/xsede/xsede_perform_psf_test.py | ziyixi/seisflow | 2 | 12786935 | """
xsede_perform_psf_test.py: get the preconditioned summed kernel for doing the PSF test.
It's just the copy of xsede_perform_structure_inversion.py, but not submit the job3, and part of the job2 is contained into job1.
useless flags may be possible to exist.
"""
import sys
from os.path import join
import click
impo... | 2.046875 | 2 |
instrument/output/__init__.py | wearpants/instrument | 7 | 12786936 | import sys
def _do_print(name, count, elapsed, file):
if name is not None:
print("%s: %d items in %.2f seconds"%(name, count, elapsed), file=file)
else:
print("%d items in %.2f seconds"%(count, elapsed), file=file)
def print_metric(name, count, elapsed):
"""A metric function that prints to... | 3.609375 | 4 |
api/tests/unit/telemetry/test_unit_telemetry_serializers.py | mevinbabuc/flagsmith | 1,259 | 12786937 | <reponame>mevinbabuc/flagsmith<filename>api/tests/unit/telemetry/test_unit_telemetry_serializers.py
from unittest import mock
from django.test import override_settings
from telemetry.serializers import TelemetrySerializer
from tests.unit.telemetry.helpers import get_example_telemetry_data
@override_settings(INFLUXDB... | 2.1875 | 2 |
fetch_cord/computer/gpu/Gpu_interface.py | TabulateJarl8/FetchCord | 286 | 12786938 | # from __future__ import annotations
from abc import ABCMeta, abstractmethod
from typing import List, TypeVar, Dict
from ..Peripheral_interface import Peripherical_interface
class Gpu_interface(Peripherical_interface, metaclass=ABCMeta):
_vendor: str
_model: str
@property
def vendor(self) -> str:
... | 2.84375 | 3 |
sublime_codec.py | furikake/sublime-codec | 16 | 12786939 | # -*- coding: utf-8 -*-
import base64
import hashlib
import sublime, sublime_plugin
import sys
PYTHON = sys.version_info[0]
if 3 == PYTHON:
# Python 3 and ST3
from urllib import parse
from . import codec_base62
from . import codec_base64
from . import codec_xml
from . import codec_json
fro... | 2.546875 | 3 |
WebMirror/management/rss_parser_funcs/feed_parse_extractCgtranslationsMe.py | fake-name/ReadableWebProxy | 193 | 12786940 | <filename>WebMirror/management/rss_parser_funcs/feed_parse_extractCgtranslationsMe.py
def extractCgtranslationsMe(item):
'''
Parser for 'cgtranslations.me'
'''
if 'Manga' in item['tags']:
return None
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" i... | 2.390625 | 2 |
engine/op_math.py | ludius0/mercury_engine | 0 | 12786941 | <filename>engine/op_math.py
# libs
import math
# scripts
from .func_base import Func, setattr_value
class Add(Func):
"""
>>> Value(1).add(1)
>>> Value(2)
"""
@staticmethod
def forward(ctx, x, y):
return x + y
@staticmethod
def backward(ctx, grad_output):
return grad_out... | 2.9375 | 3 |
sesion7.py | organizacion-sesion-3-anabel-palasi/sesion7-tarea-individual | 0 | 12786942 | from __future__ import print_function
import sys
# Calcula la suma
def suma(num1, num2):
pass
# Calcula la resta
def resta(num1, num2):
pass
# Calcula la multiplicacion
def multiplicacion(num1, num2):
pass
# Calcula la raiz cuadrada
def raizcuadrada(numero):
pass
# Calcula el módulo
def modulo(num1,num2):
... | 2.40625 | 2 |
ebl/tests/fragmentarium/test_genre_route.py | BuildJet/ebl-api | 4 | 12786943 | import falcon
from ebl.fragmentarium.domain.genres import genres
def test_get_genre(client):
get_result = client.simulate_get("/genres")
assert get_result.status == falcon.HTTP_OK
assert get_result.headers["Access-Control-Allow-Origin"] == "*"
assert get_result.json == list(map(list, genres))
| 1.773438 | 2 |
probe/modules/antivirus/eset/eset_file_security.py | krisshol/bach-kmno | 248 | 12786944 | <filename>probe/modules/antivirus/eset/eset_file_security.py
#
# Copyright (c) 2013-2018 Quarkslab.
# This file is part of IRMA 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 in the to... | 2.09375 | 2 |
sovrin_client/__metadata__.py | evernym/sovrin-client | 1 | 12786945 | """
sovrin-client package metadata
"""
__version_info__ = (0, 2)
__version__ = '.'.join(map(str, __version_info__))
__author__ = "<NAME>."
__license__ = "Apache 2.0"
__all__ = ['__version_info__', '__version__', '__author__', '__license__']
# TODO: Shouldn't we update these dependencies?
__dependencies__ = {
"an... | 1.421875 | 1 |
indexers/AnnoyIndexer.py | Nashrah31/SimDB | 2 | 12786946 | from interfaces.ANNIndexer import ANNIndexer
import annoy
# Usage : indexer = AnnoyIndexer(vector_length=100, n_trees=1000)
class AnnoyIndexer(ANNIndexer):
def __init__(self, content_vectors, vector_length=100, n_trees=10):
print("initializing annoy wrapper")
self.vector_length = vector_length
self.n_tr... | 2.796875 | 3 |
examples/car_crash_analysis/crash_analysis_with_explicit_contact.py | jdlaubrie/florence | 65 | 12786947 | <filename>examples/car_crash_analysis/crash_analysis_with_explicit_contact.py
import os
import numpy as np
from Florence import *
def crash_analysis():
""" Car crash analysis in a simplified 2D car geometry with hyperelastic
explicit dynamics solver using explicit penalty contact formulation
"""
... | 2.8125 | 3 |
AIoT/Vitis-AI/VART/example/adas_detection_py/threads/yolov3_thread.py | kaka-lin/ML-Notes | 0 | 12786948 | import time
import threading
import numpy as np
from common import preprocess_one_image_fn, draw_outputs, load_classes, generate_colors
from yolo_utils import yolo_eval
from priority_queue import PriorityQueue
class YOLOv3Thread(threading.Thread):
def __init__(self, runner: "Runner", deque_input, lock_input,
... | 2.578125 | 3 |
app/module/spotify_to_youtube/__init__.py | MisakaMikoto0502/zeroday | 0 | 12786949 | <reponame>MisakaMikoto0502/zeroday
from .convert import SpotifyConverter
| 0.96875 | 1 |
application/app.py | Miseq/python_text_image_webscrapper | 1 | 12786950 | <gh_stars>1-10
from flask import Flask, make_response, jsonify
import validators
from flask import request
from flask.views import MethodView
from file_manager import FileManager
app = Flask(__name__)
downloader = FileManager()
class GettingAll(MethodView):
@staticmethod
def get():
answer = "This ... | 3.140625 | 3 |