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 |
|---|---|---|---|---|---|---|
core/engine/transform.py | yuwilbur/birthday29 | 0 | 12781651 | <filename>core/engine/transform.py
from ..engine.vector import Vector
from ..engine.component import Component
class Transform(Component):
def __init__(self, game_object):
self.position = Vector()
self.rotation = Vector()
| 1.804688 | 2 |
test/prediction_variations.py | dsosnoski/irvideo-classification | 0 | 12781652 | <gh_stars>0
import copy
import numpy as np
class PredictionVariation:
def __init__(self, description, evaluatefn):
self.description = description
self.evaluatefn = evaluatefn
self.accumulated_results = []
def evaluate(self, predicts, certainties, track):
self.accumulated_res... | 2.390625 | 2 |
conftest.py | davidholiday/pyrest | 0 | 12781653 | <gh_stars>0
# pytest fixture file for pyrest
#
import os
import glob
import shutil
import time
import pytest
import json
def load_params_from_json(json_paths):
"""Takes a list of json file paths and returns an aggregated list of the
contents of all of them
Args:
json_paths(list[str]): list of p... | 2.53125 | 3 |
add-two-numbers/add-two-numbers.py | Javran/leetcode | 3 | 12781654 | <filename>add-two-numbers/add-two-numbers.py
#!/usr/bin/env python3
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
# "Add Two Numbers", recursive version
# for some reason it seems this non-tail recursive version
# works fast a... | 4.25 | 4 |
monitoring/migrations/0002_communitysetting_jobsetting.py | hyphae/apis-service_center | 0 | 12781655 | <filename>monitoring/migrations/0002_communitysetting_jobsetting.py<gh_stars>0
# Generated by Django 2.2.11 on 2020-05-25 06:58
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('monitoring', '0001_initial'),
]
operations = [
migrations.Cr... | 1.640625 | 2 |
pages/themes/beginners/loops/examples/slides/user_input_DO-WHILE_shorter_than_3.py | ProgressBG-Python-Course/ProgressBG-VC2-Python | 0 | 12781656 | <gh_stars>0
# ask user to enter a name (string), until it contains at least 3 symbols
while True:
user_name = input("Enter a name (at least 3 symbols): ")
user_name_length = len(user_name)
if user_name_length > 3:
break
print("Thank you, {}!".format(user_name)) | 4.1875 | 4 |
landslide_pipeline/planet_mosaic_loader.py | chrisleboa/landslidePipeline | 0 | 12781657 | <filename>landslide_pipeline/planet_mosaic_loader.py
import os
from shapely.geometry import shape, Polygon, box
from shapely.ops import transform
import pyproj
import requests
from datetimerange import DateTimeRange
from functools import partial
def query_planet_mosaic(location, times, api_key):
def handle_page(... | 2.4375 | 2 |
httprider/widgets/key_value_widget.py | iSWORD/http-rider | 27 | 12781658 | <filename>httprider/widgets/key_value_widget.py
from PyQt5 import QtWidgets
from ..core import DynamicStringData
from ..generated.key_value_widget import Ui_KeyValueWidget
class KeyValueWidget(QtWidgets.QWidget, Ui_KeyValueWidget):
def __init__(self, parent=None, parent_widget_item=None, on_remove_callback=None)... | 2.1875 | 2 |
examples/poll.py | bogdan-kulynych/trials | 29 | 12781659 | """Sociological poll example."""
import sys
sys.path.append('..')
from trials import Trials
if __name__ == '__main__':
test = Trials(['Poroshenko', 'Tymoshenko'])
test.update({
'Poroshenko': (48, 52),
'Tymoshenko': (12, 88)
})
estimates = test.evaluate('posterior CI')
dominance... | 3.09375 | 3 |
start_esp/fetch_service_config.py | JLXIA/esp | 0 | 12781660 | <reponame>JLXIA/esp
# Copyright (C) Extensible Service Proxy Authors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# noti... | 0.929688 | 1 |
myApp/api/urls.py | Chrisfufu/freshworksTesting | 0 | 12781661 | <filename>myApp/api/urls.py<gh_stars>0
from django.conf.urls import url
from django.contrib import admin
from django.conf.urls.static import static
from .views import *
from django.conf import settings
# the following is the controller APIs.
urlpatterns = [
# feed duck information controllers.
# it has create ... | 2.015625 | 2 |
Python3/1302.py | rakhi2001/ecom7 | 854 | 12781662 | <gh_stars>100-1000
__________________________________________________________________________________________________
sample 72 ms submission
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:... | 3.25 | 3 |
splitter.py | Kamrulhasan12345/particip-certs-gen-mail | 0 | 12781663 | import os
import sys
import PyPDF2
from io import BytesIO
from mailer import mailer
def split(pB):
print(pB)
pTS = PyPDF2.PdfFileReader(pB)
if pTS.flattenedPages is None:
pTS._flatten()
for n, pO in enumerate(pTS.flattenedPages):
sP = PyPDF2.PdfFileWriter()
sP.addPage(pO)
b = BytesIO()
... | 2.984375 | 3 |
src/mmgroup/tests/test_axes/beautify_axes.py | Martin-Seysen/mmgroup | 14 | 12781664 | <filename>src/mmgroup/tests/test_axes/beautify_axes.py
r"""Investigate certain orbits of 2A axes of the monster group
The functions in this module are used to find the orbits of 2A axes
of the subgroup :math:`G_{x0}` (of structure
:math:`2^{1+24}.\mbox{Co}_1`) of the monster group. According to
|Nor98| there are 12 s... | 2.9375 | 3 |
constants.py | alejandrobernardis/heroku-tornado | 0 | 12781665 | #!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
# Copyright (c) 2014 Asumi Kamikaze Inc.
# Licensed under the MIT License.
# Author: <NAME>
# Email: alejandro (dot) bernardis (at) asumikamikaze (dot) com
# Created: 29/Jan/2015 18:06
LOCALE = 'en_US'
DOMAIN = 'localhost'
SHORT_DOMAIN = 'short.local'
LOCAL_DOMAIN = 'l... | 1.453125 | 1 |
src/go_bot/nlg/nlg_manager.py | ai4eu/ai4eu-chatbot | 0 | 12781666 | <filename>src/go_bot/nlg/nlg_manager.py
import re
from logging import getLogger
from pathlib import Path
from typing import Union, List
from deeppavlov.core.commands.utils import expand_path
import deeppavlov.models.go_bot.nlg.templates.templates as go_bot_templates
from deeppavlov.core.common.registry import register... | 2.046875 | 2 |
aoj/ALDS1_7_C_Tree_Walk.py | negiandleek/til | 0 | 12781667 | <reponame>negiandleek/til
# coding: utf-8
# Your code here!
n = int(input().rstrip())
nodes = [None] * n
for i in range(n):
index, left, right = list(map(int, input().rstrip().split()))
nodes[index] = [left, right, -1]
for i in range(n):
left, right, _ = nodes[i]
nodes[left][2] = i
nodes[righ... | 3.546875 | 4 |
examples/visualization.py | zStupan/NiaARM | 0 | 12781668 | from matplotlib import pyplot as plt
from niaarm import Dataset, RuleList, get_rules
from niaarm.visualize import hill_slopes
dataset = Dataset('datasets/Abalone.csv')
metrics = ('support', 'confidence')
rules, _ = get_rules(dataset, 'DifferentialEvolution', metrics, max_evals=1000, seed=1234)
some_rule = rules[150]
p... | 2.671875 | 3 |
jp.atcoder/ddcc2020-qual/ddcc2020_qual_b/8576141.py | kagemeka/atcoder-submissions | 1 | 12781669 | <reponame>kagemeka/atcoder-submissions<filename>jp.atcoder/ddcc2020-qual/ddcc2020_qual_b/8576141.py<gh_stars>1-10
# 2019-11-23 21:00:35(JST)
import itertools
import sys
def main():
n, *A = map(int, sys.stdin.read().split())
S = sum(A)
l = 0
for i in range(n):
l += A[i]
if ... | 2.359375 | 2 |
jinja2_fsloader/__init__.py | althonos/jinja2-fsloader | 8 | 12781670 | # coding: utf-8
"""jinja2_fsloader - A Jinja2 template loader using PyFilesystem2.
"""
import sys
import fs
import fs.path
import fs.errors
import jinja2
import pkg_resources
__author__ = "<NAME> <<EMAIL>>"
__license__ = "MIT"
__version__ = pkg_resources.resource_string(__name__, "_version.txt").decode('utf-8').stri... | 3 | 3 |
projects/01_fyyur/starter_code/app/main/views.py | oyasr/FSND | 0 | 12781671 | import sys
from datetime import datetime
from . import main
from flask import render_template, request, redirect, url_for, flash
from ..models import db, Artist, Venue, Show
from .forms import ShowForm, VenueForm, ArtistForm, DeleteArtist, DeleteVenue
@main.route('/')
def index():
return render_template('pages/ho... | 2.328125 | 2 |
app/source/routes.py | victorlomi/News-Catchup | 0 | 12781672 | import os
from flask import render_template, flash, redirect, url_for, request
import requests
from app.source import bp
from app.models import article as at
@bp.route('/source')
def search_source():
"""Show this view when a source is pressed and show articles."""
API_KEY = os.environ.get('API_KEY')
news_... | 2.875 | 3 |
src/Week1Bonus_PalindromePermutation_test.py | ruarfff/leetcode-jan-2021 | 0 | 12781673 | import pytest
from .Week1Bonus_PalindromePermutation import Solution
s = Solution()
@pytest.mark.parametrize("test_input", ["code", "abc"])
def test_cannot_permute(test_input):
assert not s.canPermutePalindrome(test_input)
@pytest.mark.parametrize("test_input", ["aab", "carerac", "a", "aa"])
def test_can_permu... | 2.625 | 3 |
HOG-Features/scikithog.py | saneravi/ML_Stuff | 209 | 12781674 | #!/usr/bin/env python
"""Calculate HOG features for an image"""
import os
import matplotlib.pyplot as plt
from hog_features import image2pixelarray
from skimage import exposure
from skimage.feature import hog
def main(filename):
"""
Orchestrate the HOG feature calculation
Parameters
----------
... | 3.21875 | 3 |
django_mri/analysis/specifications/mrtrix3/estimate_response.py | ZviBaratz/django_mri | 1 | 12781675 | """
Input and output specification dictionaries for MRtrix's *dwi2response* script.
See Also
--------
* `nipype.interfaces.mrtrix3.preprocess.ResponseSD`_
Notes
-----
For more information, see MRtrix3's `dwi2response reference`_.
.. _dwi2response reference:
https://mrtrix.readthedocs.io/en/latest/reference/comma... | 2.203125 | 2 |
audio/views.py | cyaiox/dreamsgen | 0 | 12781676 | <gh_stars>0
from rest_framework import viewsets
from rest_framework.permissions import IsAuthenticated
from .models import Group, Audio
from .serializers import GroupSerializer, AudioSerializer
class GroupViewSet(viewsets.ModelViewSet):
"""
API endpoint that allows group to be created, viewed, edited or delet... | 2.234375 | 2 |
queryTwitter.py | jeffmaddocks/queryTwitter | 0 | 12781677 | import pandas as pd
import tweepy
import json
import configparser
import re, string, random
from nltk.stem.wordnet import WordNetLemmatizer
from nltk.corpus import twitter_samples, stopwords
from nltk.tag import pos_tag
from nltk import TweetTokenizer
from nltk import FreqDist, classify, NaiveBayesClassifier
def tra... | 2.734375 | 3 |
posts/forms.py | pennyfea/404-project | 0 | 12781678 | from django import forms
from mimetypes import guess_type
import base64
import os
from .models import Post
class PostForm(forms.ModelForm):
class Meta:
model = Post
fields = [
"content",
"image",
"privacy",
"content_type",
"accessible_... | 2.453125 | 2 |
pon3ark/list.py | Arzaroth/Pon3Ark | 1 | 12781679 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# File: list.py
# by <NAME>
# <EMAIL>
#
import os
from datetime import datetime as dt
def do_list(ark, opts):
total_size = sum(x.original_filesize for x in ark.metadatas)
len_size = max(len(str(total_size)), len('Length'))
if opts['-v']:
print("File:... | 2.53125 | 3 |
Grundgeruest/migrations/0005_auto_20171211_1421.py | valuehack/scholarium.at | 1 | 12781680 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-12-11 14:21
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Grundgeruest', '0004_auto_20171211_1418'),
]
operations = [
migrations.Alte... | 1.390625 | 1 |
getGoodsList.py | likebin16/1688 | 15 | 12781681 | # -*- coding: utf-8 -*-
import urllib2
import urllib
from bs4 import BeautifulSoup
import json
import cookielib
import sqlite3
import time
import os
import sys
import socket
socket.setdefaulttimeout(30)
reload(sys)
sys.setdefaultencoding('utf-8')
def get_search_page_url(keyWord):
res = 1
pageURL = ''
t... | 2.75 | 3 |
src/cltl_service/backend/schema.py | leolani/cltl-backend | 0 | 12781682 | <reponame>leolani/cltl-backend
from dataclasses import dataclass
from typing import List
from emissor.representation.scenario import Modality
from cltl.backend.api.storage import AudioParameters
@dataclass
class SignalEvent:
type: str
signal_id: str
timestamp: float
modality: Modality
files: Lis... | 2.296875 | 2 |
tests/test_decorators.py | adamchainz/django-GNU-Terry-Pratchett | 26 | 12781683 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.http import HttpResponse
from django.test import RequestFactory
from nose.tools import eq_
from gnu_terry_pratchett.decorators import clacks_overhead
@clacks_overhead
def view(request):
return HttpResponse("Death can't have him")
def test_view_decorat... | 2.34375 | 2 |
plugins/_Post_Process/_Utils/tsne.py | isabella232/nnc-plugin | 7 | 12781684 | # Copyright 2021 Sony Group Corporation.
#
# 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 ... | 2.15625 | 2 |
accounts/admin.py | Ashwin-Pokharel/BudgetApp1 | 0 | 12781685 | from django.contrib import admin
from .models import Category , Incomes , Expense
# Register your models here.
admin.site.register(Category)
admin.site.register(Incomes)
admin.site.register(Expense)
| 1.328125 | 1 |
reproduce_distance_measure.py | YHRen/NGFP | 5 | 12781686 | from torch.utils.data import DataLoader, Subset
from pathlib import Path
import torch
import torch.nn as nn
import itertools as its
import pandas as pd
import numpy as np
import json
from rdkit import Chem, DataStructs
from rdkit.Chem import AllChem
import matplotlib.pyplot as plt
from NeuralGraph.dataset import MolDa... | 2.265625 | 2 |
Forms/API/errors/tests.py | looking-for-a-job/django-examples | 0 | 12781687 | from django.test import TestCase
from .forms import MyForm
"""
https://docs.djangoproject.com/en/dev/ref/forms/api/#django.forms.Form.errors
"""
form = MyForm({'subject':'','sender':'invalid-email'})
print(form.errors)
print(form.errors.as_data())
# {'sender': ['Enter a valid email address.'], 'subject': ['This fiel... | 2.53125 | 3 |
src/sdk/python/OsduClient/models/legal_tag_invalid_response_list.py | mstest123/self-managed-osdu_from_Daniel | 3 | 12781688 | # coding: utf-8
"""
self-managed-osdu
Rest API Documentation for Self Managed OSDU # noqa: E501
OpenAPI spec version: 0.11.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from OsduClient.configuration import Configurati... | 1.90625 | 2 |
finalterm_Riley_Fitzgibbons/run2.py | rjfitzg/Python3030 | 1 | 12781689 | <reponame>rjfitzg/Python3030
'''
Almost completed but couldn't get the file to load as a json object in time after completing the other scripts.
'''
def get_city_image_url(city):
import requests
import json
# Normalize request and make call to api
city = city.lower()
city = city.replace(" ", "-") # turn spaces i... | 3.34375 | 3 |
monster.py | Rydra/fighting-aws | 0 | 12781690 | from melange import DriverManager
from melange.messaging.exchange_message_publisher import ExchangeMessagePublisher
DriverManager.instance().use_driver(driver_name='aws')
publisher = ExchangeMessagePublisher('dev-superbattle')
publisher.publish({
'amount': 20
}, 'DamageDealtToHero')
print('Gñeeee, die you fool!... | 1.984375 | 2 |
typed_jsonrpc/msg_types.py | thautwarm/typed-jsonrpc | 5 | 12781691 | <reponame>thautwarm/typed-jsonrpc
import typing
Json = list["Json"] | dict[str, "Json"] | int | float | str | None
CANCEL_METHOD = "$/cancelRequest"
JSONRPC_VERSION = "2.0"
class ResponseError(typing.TypedDict):
code: int
message: str
data: Json | None
class Response(typing.TypedDict):
id: str
... | 2.375 | 2 |
chief/utils/__init__.py | Manny2014/vm2docker | 11 | 12781692 | <gh_stars>10-100
__author__ = 'elubin'
| 1.085938 | 1 |
cracking_the_coding_interview/chapter_09/staircase.py | yasserglez/programming-problems | 2 | 12781693 | <reponame>yasserglez/programming-problems
# Interview Question 9.1
import sys
def count_ways(steps_left, memory=None):
if memory is None:
memory = [None] * steps_left
if steps_left == 0:
return 1
else:
ways = 0
for k in {1, 2, 3}:
if steps_left - k >= 0:
... | 3.625 | 4 |
solved_questions.py | Diego-Zulu/leetcode_answers | 0 | 12781694 | import argparse
import re
import subprocess
REGEX = r'\[\s*(\d+)\s*\]'
def solved_questions():
print('Getting list of solved questions.')
out = subprocess.check_output(
['leetcode', 'list', '-q', 'd'],
)
problems = []
for line in out.decode().split('\n'):
matches = re.search(REGEX,... | 3.234375 | 3 |
imbalanceddata.py | sgulyano/ipst_AI_lvl3 | 0 | 12781695 | <filename>imbalanceddata.py
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import plotly.graph_objects as go
import pandas as pd
import numpy as np
from sklearn import tree
from sklearn.datasets import load_breast_cancer
np.random.seed(42)... | 2.375 | 2 |
catan-services_1.0/examples/gps.py | mit-ll/CATAN | 15 | 12781696 | """
This is a simple example script showing our GPS module
(c) 2015 Massachusetts Institute of Technology
"""
# CATAN
import catan.utils as utils
from catan.gps import GPSReceiver
if __name__ == "__main__":
gps = GPSReceiver(serial_interface="/dev/ttyUSB1")
while True:
coor... | 2.546875 | 3 |
uroborosqlfmt/exceptions.py | rhyddereh/Sublime-uroboroSQL-formatter | 26 | 12781697 | # coding:utf-8
'''
Created on 2016/07/09
@author: ota
'''
import sys
import traceback
class SqlFormatterException(Exception):
'''
SqlFormatter用のExceptionクラス
'''
def __init__(self, tlist, ex, trace):
super(SqlFormatterException, self).__init__(ex.message if hasattr(ex, "message") else "")
... | 2.78125 | 3 |
src/hyp3r0pt.py | akshayc11/hyp3r0pt | 0 | 12781698 | <reponame>akshayc11/hyp3r0pt
#!/usr/bin/env python3
import argparse
import os
def _parse_args():
# type: () -> object
parser = argparse.ArgumentParser(description='''
This is the main argument parser for the hyp3r0pt toolkit
''')
return parser.parse_args()
def _main():
args = _parse_args()
... | 2.890625 | 3 |
GraphMatchingByConvexPolygon/src/all.py | Anonymous772066235/GraduationDesignProgram | 0 | 12781699 | # File :all.py
# Author :WJ
# Function :
# Time :2021/02/18
# Version :
# Amend :
import numpy as np
import ConvexPolygon as cp
import HierarchicalClustering as hc
import ConPolyProcess as cs
import LaplacianMatrice as lm
import time
from scipy.optimize import linear_sum_assignment
im... | 2.1875 | 2 |
whirlpool/__init__.py | datashaman/whirlpool | 1 | 12781700 | <gh_stars>1-10
"""
Tuplespace implementation for python.
Copyright (c) 2010, <NAME>
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright... | 1.796875 | 2 |
lib/graphite.py | sglass68/chromite | 0 | 12781701 | <reponame>sglass68/chromite<filename>lib/graphite.py
# Copyright 2015 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Entry point to stats reporting objects for cbuildbot.
These factories setup the stats collection ... | 1.851563 | 2 |
lambdata_danielmartinalarcon/coding_challenges/cipher_tests.py | DanielMartinAlarcon/lambdata | 0 | 12781702 | import unittest
from cipher import sub_cipher
class CipherTests(unittest.TestCase):
"""
Run several error tests
"""
def test_one_to_one(self):
self.assertTrue(sub_cipher('toot', 'peep'))
def test_one_to_two_correspondence(self):
self.assertFalse(sub_cipher('lambda', 'school'))
... | 3.515625 | 4 |
Recursion/palindrome_check.py | lakshyarawal/pythonPractice | 0 | 12781703 | <gh_stars>0
""" Palindrome Check: Given a string find if it is a palindrome using recursion """
"""Solution: Recursively make the string shorter until length is two or one, if two compare both and return value """
def palindrome_check(a) -> bool:
if len(a) == 1 or len(a) == 0:
return True
return a[0]... | 4.0625 | 4 |
fastface/transforms/compose.py | ethanwharris/light-face-detection | 0 | 12781704 | <reponame>ethanwharris/light-face-detection
from typing import Dict, Tuple
import numpy as np
class Compose():
"""Compose given transforms"""
def __init__(self, *transforms):
self.transforms = transforms
def __call__(self, img: np.ndarray, targets: Dict = {}) -> Tuple[np.ndarray, Dict]:
#... | 2.5625 | 3 |
tests/test_sessions.py | gdubicki/requests-extra | 0 | 12781705 | import logging
from requests_extra import get
logging.basicConfig(level=logging.DEBUG)
def test_sessions_automatically_reused_for_same_scheme_and_netloc(caplog):
# we will capture the debug logs that will print sth like "Got session from cache"
caplog.set_level(logging.DEBUG)
get("https://httpbin.org/... | 2.4375 | 2 |
src/nn1.py | cxz/avito-demand-prediction | 0 | 12781706 | <gh_stars>0
import tensorflow as tf
import os
os.environ["KERAS_BACKEND"] = "tensorflow"
import keras
from keras.layers import *
from keras.callbacks import *
from keras.models import Model
from keras.optimizers import Adam
from keras.models import Sequential
from keras.models import load_model
from sklearn.model_se... | 2.171875 | 2 |
Code/Lecture_06/bitonic_sort.py | Alexhuyi/cme213-spring-2021 | 20 | 12781707 | <filename>Code/Lecture_06/bitonic_sort.py
import numpy as np
import math as m
up = 1
down = 0
def pretty_print(a, clr):
print('[', end=' ')
for i in range(a.size):
if clr[i] == 1:
print('\033[91m', a[i], end=' ')
elif clr[i] == 2:
print('\033[92m', a[i], end=' ')
... | 4.15625 | 4 |
groups/models.py | eldarion-client/hedera | 8 | 12781708 | import uuid
from django.db import models
from django.urls import reverse
from django.utils import timezone
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from lemmatized_text.models import LemmatizedText
from vocab_list.models import VocabularyList
# class Course(models.Mo... | 2.390625 | 2 |
esi_leap/resource_objects/resource_object_factory.py | DanNiESh/esi-leap | 0 | 12781709 | <gh_stars>0
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, sof... | 1.828125 | 2 |
pyext/professor2/ml/histos.py | iamholger/professor | 2 | 12781710 | <gh_stars>1-10
# -*- python -*-
from professor2.histos import *
class MLHisto(Histo):
"Specialisation of Histo as a container of MLBins"
def __init__(self, nnbins=None, path=None):
Histo.__init__(self, nnbins, path)
def toDataHisto(self, *params):
"Convert this IpolBin to a DataBin with ... | 2.75 | 3 |
innopoints/views/activity.py | Innopoints/backend | 1 | 12781711 | """Views related to the Activity model.
Activity:
- POST /projects/{project_id}/activities
- PATCH /projects/{project_id}/activities/{activity_id}
- DELETE /projects/{project_id}/activities/{activity_id}
- PATCH /projects/{project_id}/activities/{activity_id}/publish
Competence:
- GET /competences
- POST /co... | 2.171875 | 2 |
cogs/utils/DataBase/user.py | milindmadhukar/Martin-Garrix-Bot | 2 | 12781712 | from datetime import datetime
class User(object):
def __init__(self, bot,
id: int,
guild_id: int,
messages_sent: int = 0,
total_xp: int = 0,
last_xp_added: datetime = None,
garrix_coins: int = 0):
self.bo... | 2.65625 | 3 |
modules/voteban/consts.py | Kylmakalle/assistant-bot | 4 | 12781713 | <gh_stars>1-10
from aiogram.utils.callback_data import CallbackData
import random
voter = CallbackData('voter', 'chat_id', 'user_id')
from modules.captcha_button.consts import LogEvents
class LogEvents(LogEvents):
UNMEDIA = 'unmedia'
VOTEBAN = 'voteban'
BAN = 'BAN'
TEMPBAN = 'TEMPBAN'
KICK = 'KI... | 2.421875 | 2 |
visualSHARK/migrations/0019_auto_20201227_0947.py | smartshark/visualSHARK | 1 | 12781714 | <gh_stars>1-10
# Generated by Django 2.2.13 on 2020-12-27 09:47
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('visualSH... | 1.726563 | 2 |
test_mi.py | timsainb/automi | 3 | 12781715 | from matplotlib import mlab
import matplotlib.pyplot as plt
import numpy as np
import colorednoise as cn
from automutualinformation import sequential_mutual_information as smi
from automutualinformation import fit_model
beta = 0.5 # the exponent
samples = 10000 # number of samples to generate
y = cn.powerlaw_psd_gau... | 2.203125 | 2 |
satisfiability.py | maxtuno/CNFExamples | 2 | 12781716 | <reponame>maxtuno/CNFExamples
import functools
import operator
import peqnp.cnf as cnf
n, m, instance = 10, 24, [[9, -5, 10, -6, 3],
[6, 8],
[8, 4],
[-10, 5],
[-9, 8],
[-9, -3],
... | 1.84375 | 2 |
fairy/fairy/lang/compile.py | thautwarm/lang.red | 1 | 12781717 | <filename>fairy/fairy/lang/compile.py
from Ruikowa.ErrorFamily import handle_error
from Ruikowa.ObjectRegex.ASTDef import Ast
from .parser import expression, MetaInfo
from .token import token
parser = handle_error(expression)
def generate_ast(filename: str) -> Ast:
"""
parse the codes in one file into Abstra... | 2.390625 | 2 |
env/CartPole.py | tphanson/tf-agent-labs | 0 | 12781718 | <gh_stars>0
import gym
import numpy as np
import cv2 as cv
from tf_agents.specs import array_spec
from tf_agents.environments import py_environment
from tf_agents.environments import tf_py_environment
from tf_agents.trajectories import time_step as ts
from env.display import virtual_display
class PyEnv(py_environment... | 2.328125 | 2 |
test/test_rgb_to_hsl.py | liamwb/colourise | 0 | 12781719 | import unittest
from colourise import rgb2hsl
class TestRGBtoHSL(unittest.TestCase):
def test_primary_colour_red(self):
r, g, b = 255, 0, 0
h, s, l = rgb2hsl(r, g, b)
self.assertEqual(h, 0.0)
self.assertEqual(s, 1.0)
self.assertEqual(l, 0.5)
def test_primary_colour_gre... | 2.84375 | 3 |
Project/jni/make_jni.py | LiangYue1981816/AresEngine | 3 | 12781720 | <gh_stars>1-10
def ModuleFileList(moduleName, msvcProjectFileName, androidFileName):
from xml.dom.minidom import parse;
import xml.dom.minidom;
DOMTree = xml.dom.minidom.parse(msvcProjectFileName);
collection = DOMTree.documentElement;
file = open(androidFileName, "w");
file.write("%s := \\\n" % moduleName);
... | 2.28125 | 2 |
strategies.py | HelgeS/mcap_with_rotation_diversity | 1 | 12781721 | <reponame>HelgeS/mcap_with_rotation_diversity<filename>strategies.py
import time
import numpy as np
import pymzn
from function import affinity_pressure, matrizes
class Strategy(object):
def profits(self, tasks, agents):
pass
def mode(self):
return ''
def exchange(self, agents, tasks, p... | 2.421875 | 2 |
package.py | Impactstory/jump-api | 0 | 12781722 | <filename>package.py
# coding: utf-8
from cached_property import cached_property
import numpy as np
from collections import OrderedDict
import datetime
import shortuuid
from time import time
import os
import numpy as np
import pandas as pd
from app import db
from app import get_db_cursor
from app import DEMO_PACKAGE_... | 1.960938 | 2 |
scripts/reactor/autogen_aquaItem3.py | hsienjan/SideQuest-Server | 0 | 12781723 | <reponame>hsienjan/SideQuest-Server
# ParentID: 2302006
# Character field ID when accessed: 230010400
# ObjectID: 1000016
# Object Position Y: 559
# Object Position X: -1813
| 0.863281 | 1 |
year_2021/day04/test_giant_squid.py | mjalkio/advent-of-code | 0 | 12781724 | from util import read_puzzle_input
from year_2021.day04.giant_squid import (
get_losing_board_score,
get_winning_board_score,
)
def test_get_winning_board_score():
assert get_winning_board_score(read_puzzle_input("test_input.txt")) == 4512
def test_get_losing_board_score():
assert get_losing_board_s... | 2.4375 | 2 |
src/model/__init__.py | 521xueweihan/fpage | 0 | 12781725 | <reponame>521xueweihan/fpage<filename>src/model/__init__.py<gh_stars>0
# coding:utf-8
import config
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
db = create_engine(config.DATABASE_URI)
BaseModel = declarative_base()
DBSession = s... | 1.742188 | 2 |
src/python/Algorithms/scc.py | rmallermartins/graphun | 1 | 12781726 | import sys
sys.path.append("../Structures/")
import graph
from dfs import Dfs
from collections import deque
class Scc:
def execute(self, G):
dfs = Dfs()
dfs.executeNormal(G)
G.buildTranspGraph()
dfs.executeTransp(G)
self.printScc(G, dfs.getSccList())
def printScc(self,... | 2.328125 | 2 |
pyxtal/constants.py | ubikpt/PyXtal | 1 | 12781727 | <reponame>ubikpt/PyXtal
"""
Module to store the constants
"""
import numpy as np
from pyxtal.version import __version__
# Constants
# ------------------------------
tol_m = 0.3 # seperation tolerance in Angstroms
rad = np.pi / 180.0 # converting degrees to radians
deg = 180.0 / np.pi # converting radians to degree... | 2.203125 | 2 |
recover.py | Aziz-Mo/QR-Shamir-Secret-Sharing | 2 | 12781728 | from secretsharing import PlaintextToHexSecretSharer
def main():
# Enter shares
shares = [input('Enter your share: ')]
while True:
numofSHares = input("Still have more?\tYes\tNo\n").upper()
if numofSHares == "Y":
shares.append(input('Enter your share: '))
elif numof... | 3.390625 | 3 |
src/faces-train.py | ParthSareen/HackTheNorthThreatAssess | 0 | 12781729 | <reponame>ParthSareen/HackTheNorthThreatAssess
import os
import cv2
from PIL import Image
import numpy as np
import pickle
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
image_dir = os.path.join(BASE_DIR, "images")
face_cascade = cv2.CascadeClassifier('cascades/data/haarcascade_frontalface_alt2.xml')
recogniz... | 2.46875 | 2 |
main.py | codingaudrey/HuginAutomator | 0 | 12781730 | from HuginAutomator import HuginAutomator
from flask import Flask
import time
import datetime
import os
CONTEXTS = ('run', 'compute')
def get_env():
return {'credentials': os.getenv('DROPBOX_TOKEN'),
'min_s': os.getenv('MIN_STITCH'),
'max_s': os.getenv('MAX_STITCH'),
'min_a':... | 2.515625 | 3 |
lists.py | ralymuhif/Python_Course | 0 | 12781731 | <filename>lists.py<gh_stars>0
names = ["Ralph", "Aury", "Gabin", "Miguel", "Ketia"]
print(names[-1])
#Exercice
intList = [1, 34, 22, 34, 60, 12, 26, 100, 234, 67, 99, 45]
answer = 0
for i in intList:
if (i>answer):
answer = i
print (answer) | 3.421875 | 3 |
example/setup.py | smok-serwis/cython-multibuild | 6 | 12781732 | import os
from setuptools import setup
from snakehouse import Multibuild, build, monkey_patch_parallel_compilation, find_pyx_and_c, \
find_all
from setuptools import Extension
monkey_patch_parallel_compilation()
dont_snakehouse = False
if 'DEBUG' in os.environ:
print('Debug is enabled!')
dont_snakehouse... | 1.664063 | 2 |
imageRecognition/testCode/resizeImage.py | Emilurenius/Pool-Table-RGB | 0 | 12781733 | <filename>imageRecognition/testCode/resizeImage.py
import cv2
img = cv2.imread("resources/lambo.png")
print(img.shape)
imgResize = cv2.resize(img,(300,200))
print(imgResize.shape)
imgCropped = img[0:200,200:500]
cv2.imshow("Image", img)
cv2.imshow("Image resize", imgResize)
cv2.imshow("Image cropped", imgCropped)
... | 2.9375 | 3 |
2019/15/py/run.py | Bigsby/aoc | 1 | 12781734 | #! /usr/bin/python3
import sys
import os
import time
from typing import Dict, List, Tuple
from collections import defaultdict
Position = complex
DIRECTIONS: Dict[int, Position] = {
1: -1j,
2: 1j,
3: -1,
4: 1
}
class IntCodeComputer():
def __init__(self, memory: List[int], inputs: List[int] = [... | 3.265625 | 3 |
programs/b_vdm.py | yamamon75/PmagPy | 2 | 12781735 | #!/usr/bin/env python
from __future__ import print_function
from builtins import input
import sys
import pmagpy.pmag as pmag
def spitout(line):
if '\t' in line:
dat=line.split('\t') # split the data on a space into columns
else:
dat=line.split() # split the data on a space into columns
b,la... | 3.109375 | 3 |
tdapi/person.py | borwick/tdapi | 4 | 12781736 | import copy
import random
import string
import tdapi
import tdapi.obj
class TDPersonManager(tdapi.obj.TDObjectManager):
def _copy_or_create(self, data, data_to_merge=None):
if data is None:
new_data = {}
else:
new_data = copy.deepcopy(data)
new_data.update(data_to_... | 2.4375 | 2 |
text/_elisp/buffer/_op/_text/insert.py | jedhsu/text | 0 | 12781737 | <filename>text/_elisp/buffer/_op/_text/insert.py
class BufferInsert(
BufferOperator,
):
pass
| 1.109375 | 1 |
tests/test_connection.py | matthewhampton/PyRFC | 0 | 12781738 | <reponame>matthewhampton/PyRFC
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime, pyrfc, unittest, socket, timeit
from configparser import ConfigParser
config = ConfigParser()
config.read('pyrfc.cfg')
params = config._sections['connection']
class ConnectionTest(unittest.TestCase):
@classmethod
d... | 2.34375 | 2 |
csvjson/__init__.py | gecBurton/csv-json | 0 | 12781739 | """Top-level package for csvjson."""
__author__ = """<NAME>"""
__email__ = "<EMAIL>"
__version__ = "0.1.0"
__all__ = ["load"]
from csvjson.csvjson import load
| 1.375 | 1 |
tests/glm/test_benchmark_golden_master.py | readthedocs-assistant/glum | 68 | 12781740 | <filename>tests/glm/test_benchmark_golden_master.py
import json
import warnings
import click
import numpy as np
import pytest
from git_root import git_root
from glum_benchmarks.cli_run import execute_problem_library
from glum_benchmarks.problems import Problem, get_all_problems
from glum_benchmarks.util import Benchm... | 2.046875 | 2 |
ymir/backend/src/ymir_controller/controller/label_model/label_runner.py | Zhang-SJ930104/ymir | 64 | 12781741 | <filename>ymir/backend/src/ymir_controller/controller/label_model/label_runner.py
import logging
import os
from typing import Tuple, List
from controller.invoker.invoker_task_exporting import TaskExportingInvoker
from controller.utils import utils
from proto import backend_pb2
def prepare_label_dir(working_dir: str,... | 2.1875 | 2 |
service/backup.py | ruslan-ok/ruslan | 1 | 12781742 | <reponame>ruslan-ok/ruslan
import os, zipfile, math, shutil, fnmatch, subprocess, smtplib, time
from datetime import datetime
from email.message import EmailMessage
from secret import *
YEAR_DURATION = 365
MONTH_DURATION = 30
WEEK_DURATION = 7
class BackupError(Exception):
def __init__(self, stage, info):
... | 2.15625 | 2 |
tests/PyTapDEMON_Test.py | ericchou-python/PyTapDEMON | 5 | 12781743 | #!/usr/bin/env python
#
# This test uses out of band ovs-ofctl to query the
# switches and compare to an existing state to see
# if the flows are installed correctly in the PyTapDEMon
# topology.
#
import unittest
import subprocess
def parseFlows(flows):
"""
Parse out the string representation of flows pass... | 2.578125 | 3 |
deep3dmap/core/renderer/renderer_pt3d.py | achao2013/DeepRecon | 30 | 12781744 | import torch
import numpy as np
# Util function for loading meshes
from pytorch3d.io import load_objs_as_meshes
from pytorch3d.transforms import euler_angles_to_matrix, matrix_to_euler_angles,Rotate
# Data structures and functions for rendering
from pytorch3d.structures import Pointclouds, Meshes
from pytorch3d.render... | 2.328125 | 2 |
tectosaur/constraints.py | jlmaurer/tectosaur | 17 | 12781745 | import scipy.sparse
import numpy as np
from tectosaur.util.cpp import imp
fast_constraints = imp('tectosaur.fast_constraints')
for k in dir(fast_constraints):
locals()[k] = getattr(fast_constraints, k)
def build_constraint_matrix(cs, n_total_dofs):
rows, cols, vals, rhs_rows, rhs_cols, rhs_vals, rhs_in, n_un... | 2.21875 | 2 |
examples/03-remote-system/nautobot_models.py | chadell/diffsync | 67 | 12781746 | """Extension of the Base model for the Nautobot DiffSync Adapter to manage the CRUD operations."""
import pynautobot # pylint: disable=import-error
from models import Region, Country # pylint: disable=no-name-in-module
from diffsync import DiffSync
# pylint: disable=no-member,too-few-public-methods
class Nautob... | 2.65625 | 3 |
a01_PySpark/e01_Resources/pyspark-tutorials/indep_vars/setup.py | mindis/Big_Data_Analysis | 0 | 12781747 | from distutils.core import setup
setup(name='build_indep_vars.py',
version='1.0',
url='https://github.com/UrbanInstitute/pyspark-tutorials/tree/master/indep_vars'
author='<NAME>',
autor_email='<EMAIL>',
py_modules=['build_indep_vars'])
#pip install -e git+https://github.com/UrbanInstitute... | 1.398438 | 1 |
2/lab2_2_d.py | JelteF/statistics | 0 | 12781748 | from scipy.misc import comb
def exp(p, n):
total = 0.0
for k in range(n+1):
total += comb(n, k, exact=False) * p**k * (1-p) ** (n-k)
return total
def main():
for p in [0.3, 0.75, 0.8, 1.0, 0.0, 0.5]:
for n in range(1, 20):
print('Checking n=%d, p=%f' % (n, p))
... | 2.984375 | 3 |
src/loadgenerator/locust_tasks/__init__.py | CertifiedWebMaster/cloud-ops-sandbox | 0 | 12781749 | <filename>src/loadgenerator/locust_tasks/__init__.py
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | 2.109375 | 2 |
common/xrd-ui-tests-python/tests/xroad_trust_view_details_cs_settings/view_management.py | ria-ee/XTM | 3 | 12781750 | # coding=utf-8
from selenium.webdriver.common.by import By
from view_models import certification_services, sidebar, ss_system_parameters
import re
import time
def test_ca_cs_details_view_cert(case, profile_class=None):
'''
:param case: MainController object
:param profile_class: string The fully qualifie... | 2.4375 | 2 |