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 |
|---|---|---|---|---|---|---|
egg/hatch.py | TheMartianObserver/nsimd | 247 | 12781151 | <filename>egg/hatch.py
# Copyright (c) 2021 Agenium Scale
#
# 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.078125 | 2 |
aim/ql/tree/__init__.py | VkoHov/aim | 1 | 12781152 | <gh_stars>1-10
from aim.ql.tree.abstract_syntax_tree import AbstractSyntaxTree
from aim.ql.tree.binary_expression_tree import BinaryExpressionTree
| 0.933594 | 1 |
Author/api.py | CMPUT404-Fa21-Organization/CMPUT404-Project-Social-Distribution | 3 | 12781153 | from rest_framework.decorators import api_view, authentication_classes, permission_classes
import requests
from rest_framework.response import Response
from .models import Author, Followers
from rest_framework import status
from .serializers import AuthorSerializer, FollowersSerializer
from permissions import CustomAut... | 2.15625 | 2 |
dygraph/core/val.py | MRXLT/PaddleSeg | 56 | 12781154 | <filename>dygraph/core/val.py
# Copyright (c) 2020 PaddlePaddle Authors. 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.0... | 1.882813 | 2 |
oscar/lib/python2.7/site-packages/traitlets/tests/test_traitlets_enum.py | sainjusajan/django-oscar | 0 | 12781155 | # -*- coding: UTF-8 -*-
# pylint: disable=missing-docstring, too-few-public-methods
"""
Test the trait-type ``UseEnum``.
"""
import unittest
import enum
from ipython_genutils.py3compat import string_types
from traitlets import HasTraits, TraitError, UseEnum
# ---------------------------------------------... | 2.234375 | 2 |
voicefilter/utils/train.py | o74589055/voicefilter_torch_ws | 0 | 12781156 | <filename>voicefilter/utils/train.py
import os
import math
import torch
import torch.nn as nn
import traceback
from .adabound import AdaBound
from .audio import Audio
from .evaluation import validate
from model.model import VoiceFilter
from model.embedder import SpeechEmbedder
def train(args, pt_dir, chkpt_path, tra... | 2.40625 | 2 |
code/python-modules/kinectData.py | jvahala/lucid-robotics | 2 | 12781157 | <reponame>jvahala/lucid-robotics<filename>code/python-modules/kinectData.py
'''
module: kinectData.py
use: contains functions and class associated with messing with storing and manipulating kinect data
'''
import numpy as np
import timeObject
import feature_tools
import utils
class kinectData(object):
'''
Pur... | 3.0625 | 3 |
reconstruction/ostec/external/graphonomy/FaceHairMask/gcn.py | itsraina/insightface | 0 | 12781158 | <reponame>itsraina/insightface<filename>reconstruction/ostec/external/graphonomy/FaceHairMask/gcn.py
import torch
from . import graph
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
class GraphConvolution(nn.Module):
def __init__(self, in_features, out_features, bias=... | 2.25 | 2 |
important_political_entities_finder/ingest/fa_scrape.py | dberger1989/Important_Political_Entities | 0 | 12781159 | <reponame>dberger1989/Important_Political_Entities<gh_stars>0
#!/usr/bin/env python
import os
import time
import pickle
from bs4 import BeautifulSoup
import requests
from selenium.webdriver.common.keys import Keys
from selenium import webdriver
from dateutil import parser
import re
import config
class FA_scrape... | 2.9375 | 3 |
ggtnn_graph_parse.py | hexahedria/gated-graph-transformer-network | 160 | 12781160 | <filename>ggtnn_graph_parse.py<gh_stars>100-1000
import os
import sys
import re
import collections
import numpy as np
import scipy
import json
import itertools
import pickle
import gc
import gzip
import argparse
def tokenize(sent):
'''Return the tokens of a sentence including punctuation.
>>> tokenize('Bob dro... | 2.703125 | 3 |
infrastructure/gateways.py | aleksarias/ubermaton | 0 | 12781161 | from typing import List, Union, Tuple, Dict, Set
import googlemaps
import networkx as nx
from networkx.algorithms import shortest_paths
from domain.gateways import DirectionsGateway
from domain.models import Location
class NetworkXGateway(DirectionsGateway):
def __init__(self, graph: nx.Graph):
"""
... | 3.34375 | 3 |
csv/demo5.py | silianpan/seal-spider-demo | 0 | 12781162 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019-06-13 14:53
# @Author : liupan
# @Site :
# @File : demo5.py
# @Software: PyCharm
import csv
with open('data.csv', 'a') as csvfile:
fieldnames = ['id', 'name', 'age']
writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
writer.write... | 3.125 | 3 |
python/p22.py | schwanberger/projectEuler | 0 | 12781163 | <reponame>schwanberger/projectEuler<filename>python/p22.py
# -*- encoding: utf-8 -*-
# Names scores: https://projecteuler.net/problem=22
# Problem 22 Using names.txt (right click and 'Save Link/Target As...'), a 46K
# text file containing over five-thousand first names, begin by sorting it into
# alphabetical order. T... | 3.78125 | 4 |
apps/quickbooks_online/tasks.py | fylein/fyle-qbo-api | 0 | 12781164 | import logging
import json
import traceback
from typing import List
from datetime import datetime, timedelta
from django.db import transaction
from django.db.models import Q
from django_q.tasks import Chain
from django_q.models import Schedule
from qbosdk.exceptions import WrongParamsError
from fyle_accounting_mappi... | 1.820313 | 2 |
tests/test_umi.py | johannesnicolaus/celseq2 | 14 | 12781165 | <filename>tests/test_umi.py
import pytest
import pickle
from pkg_resources import resource_filename
def test_umi(instance_count_umi):
ans_umi_cnt = resource_filename(
'celseq2',
'demo/{}'.format('BC-22-GTACTC.counter.pkl'))
ans_umi_cnt = pickle.load(open(ans_umi_cnt, 'rb'))
ans_umi_set = r... | 2.265625 | 2 |
bitmovin_api_sdk/encoding/inputs/http/http_api.py | jaythecaesarean/bitmovin-api-sdk-python | 11 | 12781166 | <gh_stars>10-100
# coding: utf-8
from __future__ import absolute_import
from bitmovin_api_sdk.common import BaseApi, BitmovinApiLoggerBase
from bitmovin_api_sdk.common.poscheck import poscheck_except
from bitmovin_api_sdk.models.http_input import HttpInput
from bitmovin_api_sdk.models.response_envelope import Respons... | 2.03125 | 2 |
basics.py | younes-assou/opencv-beginner | 0 | 12781167 | import cv2 as cv
img = cv.imread("me1.jpg")
cv.imshow('me', img)
blured = cv.GaussianBlur(img, (3,3), cv.BORDER_DEFAULT)
cv.imshow('blured', blured)
canny = cv.Canny(img, 60,70)
cv.imshow('canny edges', canny)
cv.waitKey(0) | 2.84375 | 3 |
app/core/migrations/0002_auto_20201129_1325.py | bondeveloper/maischool | 0 | 12781168 | # Generated by Django 3.1.3 on 2020-11-29 13:25
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='attachment',
... | 1.46875 | 1 |
google/cloud/datacatalog/v1/datacatalog-v1-py/google/cloud/datacatalog_v1/types/datacatalog.py | googleapis/googleapis-gen | 7 | 12781169 | <reponame>googleapis/googleapis-gen
# -*- coding: utf-8 -*-
# Copyright 2020 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
#
# ... | 1.023438 | 1 |
src/rbxmx.py | GestaIt/Model-Uploader | 3 | 12781170 | <gh_stars>1-10
"""
Created by Gestalt on 10/26/21
rbxmx.py
Used for the manipulation of RBXMX objects.
Functions:
change_script_source(xml_source, new_source) -> str
get_asset_data(asset_id) -> tuple[bool, str]
"""
import xml.etree.ElementTree as ElementTree
from typing import Union
import requests
def ge... | 2.828125 | 3 |
my_lambdata/OOP_Sprint/Acme.py | misqualzarabi/lambdata_misqual_z | 0 | 12781171 | <filename>my_lambdata/OOP_Sprint/Acme.py
import random
class Product():
def __init__(self, name, price=10, weight=20,
flammability=0.5, identifier=random.randint(1000000, 9999999)):
self.name = name
self.price = price
self.weight = weight
self.flammability... | 3.453125 | 3 |
src/feature_extract.py | JiJingYu/Sensor-Specific-Hyperspectral-Image-Feature-Learning | 1 | 12781172 | import os
import sys
import stat
import h5py
import time
import shutil
import subprocess
import numpy as np
import scipy.io as sio
from data_analysis import find_caffe
# import caffe
import data_analysis.get_feature_from_model as feature
caffe_root = find_caffe.caffe_root
def mkdir_if_not_exist(the_dir):
if not ... | 2.015625 | 2 |
computo avanzado/python/kmeans.py | corahama/python | 1 | 12781173 | <reponame>corahama/python
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import random
# Function for means comparation
def are_means_equal(array1, array2):
if len(array1) == len(array2):
for i in range(len(array1)):
if np.array_equal(array1[i], array2[i]) == False:
... | 3.5 | 4 |
tutor/project_4/aggregate.py | globulion/qc-workshop | 1 | 12781174 | #!/usr/bin/python3
"""Aggregate Module.
.. moduleauthor:: <NAME> <<EMAIL>>
"""
import psi4, numpy
class Aggregate:
def __init__(self, psi4_molecule):
self.all = psi4_molecule
self.qm = psi4_molecule.extract_subsets(1)
self.nfrags = psi4_molecule.nfragments()
self.bath = [] if self.nfrags ==... | 2.265625 | 2 |
disk_set.py | warm-ice0x00/disk-set | 0 | 12781175 | <reponame>warm-ice0x00/disk-set<gh_stars>0
import hashlib
import typing
import sympy
class DiskSet:
def __init__(self, file: typing.BinaryIO, n: int, key_len: int) -> None:
self.n = n
self.m = sympy.nextprime(n << 1)
self.key_len = key_len
try:
file.truncate(self.m * s... | 2.359375 | 2 |
src/examples/plot_costs.py | zhhengcs/sunny-side-up | 581 | 12781176 | #!/usr/bin/env python
import os
import json
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import argparse
arg_parser = argparse.ArgumentParser()
arg_parser.add_argument("--start", default=25, type=int)
arg_parser.add_argument("cost_file", default="metrics_costs.json", narg... | 3 | 3 |
structural-variation/scripts-projection/variants2hapmap.py | hexin010101/NAM-genomes | 0 | 12781177 | <gh_stars>0
#!/usr/bin/python3
'''
created by <NAME>
2020-02-04
'''
import argparse as ap
# initialize argument parser (pass user input from command line to script)
parser = ap.ArgumentParser(formatter_class=ap.RawDescriptionHelpFormatter,
description='''
description: this script reads a... | 3 | 3 |
flight_ticket/apps.py | Calpax-aaS/web-app | 0 | 12781178 | <gh_stars>0
from django.apps import AppConfig
class FlightTicketConfig(AppConfig):
name = 'flight_ticket'
| 1.234375 | 1 |
tests/test_integrate.py | rtsfred3/pyntegrate | 0 | 12781179 | <gh_stars>0
import time, unittest
import pyntegrate.pyarctan as pyarctan
import pyntegrate.arctan as arctan
def makeArrMin(n, seed=25):
return arctan.makeArrMin(n)
def makeArr(n, seed=25):
return makeArrMin(n, seed), makeArrMin(n, seed)
class TestArctanMethods(unittest.TestCase):
def test_bubblesort(sel... | 2.5 | 2 |
_2015/adventCoinMiner/adventCoinMiner.py | dcsparkes/adventofcode | 0 | 12781180 | import hashlib
import itertools
class AdventCoinMiner():
def solve(self, prefix, check="00000"):
for i in itertools.count(1):
hash = hashlib.md5("{}{}".format(prefix, i).encode('utf-8')).hexdigest()
if check == hash[:len(check)]:
return i
| 3.140625 | 3 |
test.py | igelbox/blender-ogf | 5 | 12781181 | <reponame>igelbox/blender-ogf
#!/usr/bin/python
from io_scene_ogf.ogf_import import load, ImportContext
load(ImportContext('test.ogf'))
| 1.132813 | 1 |
app/app/api/domain/services/wrappers/mongo/PymongoExecutor.py | GPortas/Playgroundb | 1 | 12781182 | <filename>app/app/api/domain/services/wrappers/mongo/PymongoExecutor.py
from bson import ObjectId
class PymongoExecutor:
def __init__(self, db):
self.db = db
def execute(self, expression):
return eval(expression)
| 2.046875 | 2 |
examples/summary.py | stoeckli/msread | 1 | 12781183 | # Created by <NAME>
# import module
import msread
# init path
path = r"sample.raw"
import msread
# open file
with msread.open(path) as reader:
# show summary
reader.summary(show=True)
# read headers only
for header in reader.headers(min_rt=5*60, max_rt=10*60, ms_level=1):
print(he... | 2.515625 | 3 |
Python Programs/consogram.py | muhammad-masood-ur-rehman/Skillrack | 2 | 12781184 | Consogram
Consograms are words or sentences that has every consonant( letters other than a,e,i,o,u) of the English alphabet occurring at least once. Write an algorithm and a subsequent Python code to check whether a string is a consogram or not. Write a function to check if a given string is a consogram. For example,”... | 3.890625 | 4 |
configs/003_random_crop.py | taraspiotr/data-driven-robot-grasping | 0 | 12781185 | <gh_stars>0
from mrunner.helpers.specification_helper import create_experiments_helper
config = {
"name": "sac_kuka_diverse",
"env_num_objects": 5,
"env_camera_random": 0,
"env_use_height_hack": True,
"model_hidden_sizes": (256, 256),
"encoder_num_filters": 32,
"cuda_idx": 0,
"learning_... | 1.75 | 2 |
Oefeningen/standalone/mileage_converter.py | Seviran/Python_3 | 0 | 12781186 |
print("How many kilometres did you cycle today?")
kms = input()
miles = float(kms) / 1.60934
miles = round(miles, 2)
print(f"Your {kms}km ride is {miles}mi")
# print("You ran {}".format(miles))
# print("You ran " + miles) <> DOES NOT WORK!!
| 4.21875 | 4 |
CS-1656-Data-Science/Recitations/Recitation 9/task.py | solomonheisey/University_Projects | 1 | 12781187 | <filename>CS-1656-Data-Science/Recitations/Recitation 9/task.py
import sqlite3 as lite
import pandas as pd
from sqlalchemy import create_engine
class Task(object):
def __init__(self, db_name, students, grades, courses, majors):
self.con = lite.connect(db_name)
self.cur = self.con.cursor()
... | 3.375 | 3 |
setup.py | Ckoetael/monolog | 0 | 12781188 | """
Mongo logger package
"""
from setuptools import setup, find_packages
import monolog
DESCRIPTION = 'MongoDB logger + std_logger'
AUTHOR = '<NAME>'
AUTHOR_EMAIL = "<EMAIL>"
URL = "https://github.com/Ckoetael/monolog"
VERSION = monolog.__version__
setup(
name="monolog",
version=VERSION,
description=DES... | 1.273438 | 1 |
eilat/DatabaseLog.py | jsoffer/eilat | 0 | 12781189 | # -*- coding: utf-8 -*-
"""
Copyright (c) 2013, 2014, 2015 <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 notice, ... | 1.25 | 1 |
tests/data/source/test_generator_data_source.py | trajkova-elena/scikit-multiflow | 1 | 12781190 | <gh_stars>1-10
from skmultiflow.data.observer.event_observer import BufferDataEventObserver
from skmultiflow.data.generator.anomaly_sine_generator import AnomalySineGenerator
from skmultiflow.data.source.generator_data_source import GeneratorDataSource
import numpy as np
import time
def record_to_dictionary(record):
... | 2 | 2 |
src/doc-break.py | andreblue/doc-breaker | 4 | 12781191 | <reponame>andreblue/doc-breaker
import msoffcrypto
import sys, getopt
import os
import urllib.request
def download_PasswordList():
#Grabbed from https://github.com/danielmiessler/SecLists
url = 'https://raw.githubusercontent.com/danielmiessler/SecLists/master/Passwords/Common-Credentials/10-million-password-li... | 3 | 3 |
quera/13609/35987/dumper.py | TheMn/Quera-College-ML-Course | 1 | 12781192 | <reponame>TheMn/Quera-College-ML-Course
import zlib
import zipfile
import numpy as np
np.savez('data.npz',ethnics=ethnics,balance=balance,allow_pickle=True)
def compress(file_names):
print("File Paths:")
print(file_names)
# Select the compression mode ZIP_DEFLATED for compression
# or zipfile.ZIP_STO... | 3.4375 | 3 |
Fractals/Markus-Lyapunov Fractals/3D_Markus_Lyapunov.py | michellely98/FractalExploration | 3 | 12781193 | <filename>Fractals/Markus-Lyapunov Fractals/3D_Markus_Lyapunov.py
'''
Adapted from VisPy example volume rendering here: https://github.com/vispy/vispy/blob/master/examples/basics/scene/volume.py
NOTE: Normalization approach credited to <NAME> on Stack Overflow: https://stackoverflow.com/questions/51306488/transpare... | 2.84375 | 3 |
modu_01/02_lab.py | 94JuHo/study_for_deeplearning | 0 | 12781194 | import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' #내 맥북에서 발생되는 에러를 없애기 위한 코드
import tensorflow as tf
#trainable variable이다. 학습과정에서 변경될 수 있는 값이다.
# x_train = [1, 2, 3]
# y_train = [1, 2, 3]
#placeholder를 사용해서 출력단에서 값 입력받기
X = tf.placeholder(tf.float32)
Y = tf.placeholder(tf.float32)
#W,b를 모르기 때문에 랜덤한 값을 만든다.
W = tf.... | 2.796875 | 3 |
src/Problem0006.py | rrohrer/ProjectEuler | 0 | 12781195 | sum_of_sqares = sum(map(lambda x: x ** 2,list(range(1,101))))
sum_squared = sum(list(range(1,101))) ** 2
print sum_squared - sum_of_sqares
| 2.921875 | 3 |
arm64_tests/disassemble.py | jgouly/cranelift-1 | 0 | 12781196 | #!/usr/bin/env python3
import sys
import os
import tempfile
words = []
found_code = False
for line in sys.stdin.readlines():
if line.startswith("Machine code:"):
found_code = True
continue
if found_code:
words.append(int("0x" + line.strip(), 16))
fd, filename = tempfile.mkstemp(suffi... | 2.453125 | 2 |
tests/unit/test_cname_validator.py | cloud-gov/domain-broker | 5 | 12781197 | import openbrokerapi
import pytest
from broker.validators import CNAME
def test_one_layer_of_cnames(dns):
dns.add_cname("_acme-challenge.foo.example.gov")
# we're just making sure we don't raise an exception here
CNAME(["foo.example.gov"]).validate()
def test_two_layers_of_cnames(dns):
dns.add_cnam... | 2.171875 | 2 |
thonny/plugins/language.py | aroberge/thonny | 0 | 12781198 | <reponame>aroberge/thonny
import tkinter as tk
from tkinter import ttk
from thonny import get_workbench
from thonny.config_ui import ConfigurationPage
from thonny.languages import LANGUAGES_DICT
class GeneralConfigurationPage(ConfigurationPage):
def __init__(self, master):
ConfigurationPage.__init__(self... | 2.34375 | 2 |
services/workers/src/workers/jobs/models/__init__.py | goubertbrent/oca-backend | 0 | 12781199 | <gh_stars>0
# -*- coding: utf-8 -*-
# Copyright 2020 Green Valley Belgium NV
#
# 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 requ... | 1.976563 | 2 |
python/hackerrank/variables/variable creation/task.py | 3keepmovingforward3/ENGR1102 | 0 | 12781200 | def variables():
f = open('test.txt', 'w')
# Start your code below (tip: Make sure to indent your code)
# Setup variables here
# put variables in order respective of task commands
f.write(______+"\n")
f.write(______+"\n")
f.write(______+"\n")
f.write(______+"\n")
f.write(______... | 3.171875 | 3 |
Python-Programs/Cyclically_rotate_an_array_by_one.py | adityaverma121/Simple-Programs | 71 | 12781201 | def rotate(A, n):
temp = A[n - 1]
for i in range(len(A)):
A[n - i - 1] = A[n - i - 2]
A[0] = temp
return A
A = [1, 2, 3, 4, 5]
print(rotate(A, len(A)))
| 3.609375 | 4 |
DeepLearning/Python/Chapter 3/Ch03-06-02-mnist.py | BlueWay-KU/Study | 0 | 12781202 | import sys, os
sys.path.append(os.pardir)
import numpy as np
from dataset.mnist import load_mnist
from PIL import Image
def img_show(img):
pil_img = Image.fromarray(np.uint8(img))
pil_img.show()
(x_train, t_train), (x_test, t_test) = load_mnist(flatten=True, normalize = False)
img = x_train[0]
l... | 2.953125 | 3 |
app/users/tests/test_views.py | erischon/p10_try_1 | 0 | 12781203 | <reponame>erischon/p10_try_1<gh_stars>0
from django.test import TestCase, Client, RequestFactory
from django.urls import reverse
from django.contrib.auth.models import User
from database.models import Product, Nutriscore
class UsersTestViews(TestCase):
def setUp(self):
self.client = Client()
sel... | 2.28125 | 2 |
excel_and_pandas_lab_44.py | QPThree/python-mycode | 1 | 12781204 | #!/usr/bin/python3
"""Alta3 Research | <EMAIL>
Exploring using pandas to create dataframes, and output graphs"""
import pandas as pd
def main():
# define the name of our xls file
excel_file = 'files/movies.xls'
# create a DataFrame (DF) object. EASY!
# because we did not specify a sheet
# only... | 4.34375 | 4 |
app/config/default_config.py | vonsago/service_platform | 6 | 12781205 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2018/9/8 下午9:22
# @Author : Vassago
# @File : default_config.py
# @Software: PyCharm
import os
class DefaultConfig():
CONFIG_NAME = 'DEFAULT'
DEBUG = True
TEMPLATE_DIR = "."
STATIC_DIR = "."
class DevConfig():
CONFIG_NAME = 'PRO'
... | 1.671875 | 2 |
libs/coda/runtime/typeregistry.py | viridia/coda | 1 | 12781206 | <filename>libs/coda/runtime/typeregistry.py<gh_stars>1-10
'''Registry for extensions and subclasses.'''
class TypeRegistry:
def __init__(self):
self.__subtypes = {}
self.__extensions = {}
def addSubtype(self, subtype):
'''Register a type as being a subtype of a given base type.'''
assert subtype.g... | 2.53125 | 3 |
swap_start/tf_train/special_train/test/begin1.py | yudongqiu/gomoku | 3 | 12781207 | <filename>swap_start/tf_train/special_train/test/begin1.py
# black white black
begin_lib = [[ ( 8, 8), ( 7, 9), (11,11)]]
| 1.382813 | 1 |
EulerProblem5.py | JonathanFox1993/PythonCode | 0 | 12781208 |
# Greatest common divisor of more than 2 numbers
def gcd(x,y): return y and gcd(y, x % y) or x
#Lowest common multiple of 2 integers
def lcm(x,y): return x * y / gcd(x,y)
# loops through number 1 to 20 and puts them into the lcm fucntion to calculate the lowest common mulitple of 2 intergers
# Keeps l... | 3.984375 | 4 |
Lib/site-packages/django_core/admin.py | fochoao/cpython | 0 | 12781209 | from django.contrib import admin
from .models import TokenAuthorization
class TokenAuthorizationAdmin(admin.ModelAdmin):
"""Model admin for the TokenAuthorization model."""
list_display = ('id', 'reason', 'user', 'token', 'email_address',
'created_user', 'expires')
readonly_fields = l... | 2.109375 | 2 |
tests/functional/modules/ims_catalog/test_catalog_managed_acbs.py | thedoubl3j/ibm_zos_ims | 7 | 12781210 | # -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function)
import pytest
import re
from math import ceil
from pprint import pprint
from ibm_zos_ims.tests.functional.module_utils.ims_test_catalog_utils import CatalogInputParameters as cp # pylint: disable=import-error
from ibm_zos_ims.t... | 1.710938 | 2 |
mne/viz/utils.py | TanayGahlot/mne-python | 0 | 12781211 | <gh_stars>0
"""Utility functions for plotting M/EEG data
"""
from __future__ import print_function
# Authors: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
# License: Simplified BSD
import math
from copy import deepcopy
from functool... | 2.1875 | 2 |
xrptipbotPy/xrptipbot.py | AJ58O/xrptipbotPy | 0 | 12781212 | import requests
class xrptipbot:
def __init__(self, token):
self.token = token
self.baseUrl = "https://www.xrptipbot.com/app/api"
def login(self, platform, model):
url = self.baseUrl + "/action:login/"
headers = {"Content-Type":"application/json"}
payload = {
"token":self.token,
"platform":platform,... | 2.625 | 3 |
polygon/views.py | foreignbill/eoj3 | 0 | 12781213 | from django.http import HttpResponse
from django.shortcuts import render, redirect, get_object_or_404
from django.urls import reverse
from django.views import View
from django.views.generic import ListView
from rest_framework import status
from rest_framework.response import Response
from rest_framework.views import AP... | 2.03125 | 2 |
src/practices/practice/missing_number/script.py | rahul38888/coding_practice | 1 | 12781214 | <reponame>rahul38888/coding_practice
def missing_number(array, n):
s = 0
for val in array:
s += val
return int(n*(n+1)/2 - s)
def scan_input():
n = int(input())
nsstr = input()
a = list(map(lambda x: int(x), nsstr.split()))
return a, n
if __name__ == '__main__':
t = int(i... | 3.765625 | 4 |
analysis/baseline/s01_generate_features_alexnet.py | eduardojdiniz/Buzznauts | 2 | 12781215 | #!/usr/bin/env python
# coding=utf-8
import argparse
import os
import os.path as op
from Buzznauts.models.baseline.alexnet import load_alexnet
from Buzznauts.utils import set_seed, set_device
from Buzznauts.analysis.baseline import get_activations_and_save
from Buzznauts.analysis.baseline import do_PCA_and_save
def ... | 2.296875 | 2 |
wflow-py/WflowDeltashell/addwflowtoolbar.py | edwinkost/wflow | 0 | 12781216 | <reponame>edwinkost/wflow
from WflowDeltashell.Shortcuts import *
from WflowDeltashell.plotcsv import *
def OpenDoc(url):
import Libraries.StandardFunctions as sf
from DelftTools.Utils import Url
murl = Url(url,url)
sf.OpenView(murl)
def notimplemented():
print "Not implemented yet..."
name = "Web Documentatio... | 2.421875 | 2 |
migration/new_fields.py | jmilosze/wfrp-hammergen | 1 | 12781217 | from pymongo import MongoClient
pswd = ""
db = "test"
conn_string = f"mongodb+srv://Jacek:{<EMAIL>/test?retryWrites=true&w=majority"
client = MongoClient(conn_string, 27017)
non_char_collections = ["career", "item", "mutation", "property", "skill", "spell", "talent"]
for element in non_char_collections:
print(f... | 2.484375 | 2 |
django_personals/enums.py | sasriawesome/django_personals | 2 | 12781218 | import enum
from django.utils.translation import ugettext_lazy as _
class MaxLength(enum.Enum):
SHORT = 128
MEDIUM = 256
LONG = 512
XLONG = 1024
TEXT = 2048
RICHTEXT = 10000
class ActiveStatus(enum.Enum):
ACTIVE = 'ACT'
INACTIVE = 'INC'
CHOICES = (
(ACTIVE, _("active").t... | 2.140625 | 2 |
venv/Lib/site-packages/_TFL/Apply_All.py | nasir733/airbnb-clone | 6 | 12781219 | # -*- coding: utf-8 -*-
# Copyright (C) 2005-2013 Mag. <NAME>. All rights reserved
# Glasauergasse 32, A--1130 Wien, Austria. <EMAIL>
# ****************************************************************************
#
# This module is licensed under the terms of the BSD 3-Clause License
# <http://www.c-tanzer.at/license/b... | 2.21875 | 2 |
tests/test_prepifg_system_vs_python.py | uniomni/PyRate | 1 | 12781220 | <reponame>uniomni/PyRate
import shutil
import pytest
from pathlib import Path
import numpy as np
from pyrate.core import config as cf
from pyrate import conv2tif, prepifg
from pyrate.configuration import Configuration
from tests.common import (
assert_two_dirs_equal,
manipulate_test_conf,
TRAVIS,
PYTHON... | 1.875 | 2 |
Main_Code.py | Sax-Ted/Eye-Timer | 1 | 12781221 | <reponame>Sax-Ted/Eye-Timer
#---------import modules---------
from tkinter import *
import time
import math
import pygame
#---------init the window---------
root = Tk()
root.geometry("460x665")
root.resizable(False, False)
root.title("Computer Use Time")
root.iconbitmap('icon.ico')
#---------set the function... | 2.9375 | 3 |
application/content/routes.py | nicolaskyejo/project-fuksit | 0 | 12781222 | <reponame>nicolaskyejo/project-fuksit<filename>application/content/routes.py
import redis
from flask import Blueprint, render_template, request, make_response, session, jsonify, redirect, url_for
from flask_login import login_required
from application.landing_page.forms import Quiz
content_bp = Blueprint('content_bp'... | 2.796875 | 3 |
pipeline.py | evansgroup/JournalOfBiomedicalOptics | 0 | 12781223 | <filename>pipeline.py<gh_stars>0
import numpy as np
import matplotlib.pyplot as plt
import os
import pandas as pd
import glob
from skimage.io import imread, imsave
from skimage.transform import hough_circle, hough_circle_peaks
from skimage.feature import canny
from skimage.draw import circle_perimeter
from skimage im... | 2.453125 | 2 |
NJ_tree_analysis_manual_sobject_run.py | kcotar/Stellar_abudance_trees | 0 | 12781224 | from NJ_tree_analysis_functions import start_gui_explorer
# nov v omegaCen?
objs = [
140305003201095, 140305003201103, 140305003201185, 140307002601128, 140307002601147, 140311006101253,
140314005201008, 140608002501266, 150211004701104, 150428002601118, 150703002101192
]
# nov v NGC6774
objs = [
14070700... | 0.957031 | 1 |
examples/case1/case2_est.py | JavierArroyoBastida/forecast-gen | 1 | 12781225 | <gh_stars>1-10
"""Parameter estimation in all FMUs used in Case 1"""
import os
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import modestpy
# Paths
ms_file = os.path.join('examples', 'case1', 'measurements.csv')
fmu_dir = os.path.join('examples', 'case1', 'models')
res_dir = os.path.join('e... | 2.15625 | 2 |
mykde/main.py | warvariuc/mykde | 5 | 12781226 | <filename>mykde/main.py
__author__ = "<NAME> <<EMAIL>>"
import os
import sys
import html
from pkgutil import iter_modules
from PyQt4 import QtCore, QtGui, uic
from PyKDE4 import kdecore
import mykde
def walk_modules(path):
"""Loads a module and all its submodules from a the given module path and returns them.
... | 2.453125 | 2 |
pages/extensions/shortcodes/shortcode.py | uskay/docs | 0 | 12781227 | <gh_stars>0
# -*- coding: utf-8 -*-
import os
import uuid
from grow.templates import tags
import jinja2
import markdown
class Shortcode(object):
# The (tag)name for the shortcode
name = 'default'
# For all BBCode options see https://bbcode.readthedocs.io/en/latest/formatters.html#custom-tag-options
... | 2.59375 | 3 |
tests/test_profiles.py | nacknime-official/freelancehunt-api | 3 | 12781228 | #!usr/bin/python3
"""#TODO: Write comments."""
from freelancehunt import Profiles
class Profiles:
def __init__(self, token=None, **kwargs):
pass
#property
def my_profile(self):
pass
def get_freelancers_list(self, country_id=None, city_id=None,
skill_id=N... | 2.53125 | 3 |
apps/trails/migrations/0001_initial.py | schocco/mds-web | 0 | 12781229 | <filename>apps/trails/migrations/0001_initial.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
import django.contrib.gis.db.models.fields
class Migration(migrations.Migration):
dependencies = [
migrations.swappab... | 1.78125 | 2 |
main.py | Borgotto/magnifico-rettore | 0 | 12781230 | import os
import asyncio
import discord
from discord.ext import commands
# Try to get the bot token from file, quit if it fails
try:
with open('token') as file:
token = file.readline()
except IOError:
print("Missing token file containing the bot's token")
quit()
# Create config and cog folders if... | 2.765625 | 3 |
test/test_file_generators.py | fluxtransport/hazel2 | 0 | 12781231 | import hazel
import glob
import os
def test_file_generators():
tmp = hazel.tools.File_observation(mode='single')
tmp.set_size(n_lambda=128, n_pixel=1)
tmp.save('test')
tmp = hazel.tools.File_observation(mode='multi')
tmp.set_size(n_lambda=128, n_pixel=10)
tmp.save('test2')
tmp = hazel.to... | 2.21875 | 2 |
pyscripts/city_to_graph.py | ElvinLord12/cara_v2 | 0 | 12781232 | import osmnx as ox
import networkx as nx
ox.config(use_cache=True, log_console=False)
graph = ox.graph_from_address('953 Danby Rd, Ithaca, New York', network_type='walk')
fig, ax = ox.plot_graph(graph) | 2.40625 | 2 |
test/scripts/py/enrollment_summary_pyspark.py | joerg-schneider/airflow-bootstrap | 23 | 12781233 | import pyspark
import pyspark.sql.functions as f
from airtunnel import PySparkDataAsset, PySparkDataAssetIO
def rebuild_for_store(asset: PySparkDataAsset, airflow_context):
spark_session = pyspark.sql.SparkSession.builder.getOrCreate()
student = PySparkDataAsset(name="student_pyspark")
programme = PySpa... | 2.75 | 3 |
Coin_Detection.py | Jarvis-BITS/Coin-Detection | 2 | 12781234 | import cv2
import numpy as np
import math
# Func to cal eucledian dist b/w 2 pts:
def euc_dst(x1, y1, x2, y2):
pt_a = (x1 - x2)**2
pt_b = (y1 - y2)**2
return math.sqrt(pt_a + pt_b)
cap = cv2.VideoCapture(0)
while(True):
ret, frame = cap.read()
gray = cv2.cvtColor(frame, cv2.CO... | 2.765625 | 3 |
setup.py | kate-melnykova/authentication | 1 | 12781235 | <reponame>kate-melnykova/authentication
from setuptools import setup
from setuptools import find_packages
with open("README.md", "r+") as fh:
long_description = fh.read()
setup(
name='authentication',
version='1.1.0',
packages=find_packages(),
package_data={'authentication': ['templates/*']},
... | 1.632813 | 2 |
tests/unit/test_simple_collectible.py | Sam44323/nft-mix-opensea | 0 | 12781236 | from scripts.utils.helpful_scripts import get_account, LOCAL_BLOCKCHAIN_ENVIRONMENTS
from scripts.simple_collectible.deploy_and_create import deploy_and_create
from brownie import network
import pytest
def network_checker():
if network.show_active() not in LOCAL_BLOCKCHAIN_ENVIRONMENTS:
pytest.skip()
de... | 1.882813 | 2 |
src/clims/migrations/0012_remove_extensibletype_category.py | withrocks/commonlims | 4 | 12781237 | <reponame>withrocks/commonlims<gh_stars>1-10
# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2020-01-09 13:21
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('clims', '0011_auto_20191106_1509'),
]
operatio... | 1.367188 | 1 |
payplug/test/test_real_http_query.py | SOGEXIS/payplug-python | 0 | 12781238 | <reponame>SOGEXIS/payplug-python<gh_stars>0
# -*- coding: utf-8 -*-
import sys
import pytest
from payplug import routes
from payplug.network import HttpClient, UrllibRequest, RequestsRequest
from payplug.test import TestBase
class TestRealHttpQuery(TestBase):
@pytest.mark.parametrize("api_version", [None, '2019-0... | 2.375 | 2 |
tests/pytests/pyre/complex-facility.py | willic3/pythia | 1 | 12781239 | #!/usr/bin/env python
def simple():
from TestComponents import ComplexFacility
return ComplexFacility()
# End of file
| 1.335938 | 1 |
sds-az/Part 2 - Regression/Section 7 - Support Vector Regression (SVR)/SupportVectorRegression.py | coolmacmaniac/codeml | 0 | 12781240 | #!/usr/local/bin/python
# -*- coding: utf-8 -*-
"""
Created on : Mon Jun 4 23:17:56 2018
@author : Sourabh
"""
# %%
import numpy as np
import pandas as pd
from sklearn.preprocessing import StandardScaler
from sklearn.svm import SVR
import matplotlib.pyplot as plt
# ============================================... | 3.046875 | 3 |
337. House Robber III.py | JazzikPeng/Algorithm-in-Python | 3 | 12781241 | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def __init__(self):
self.dic = {}
def rob(self, root: TreeNode) -> int:
if root is None:
return 0
... | 3.625 | 4 |
test_script.py | stu314159/pyGAS | 0 | 12781242 | # -*- coding: utf-8 -*-
"""
Created on Thu Aug 10 17:36:05 2017
@author: stu
"""
import pyGAS as pg
helium = pg.He();
To = 273.15; # K
T1 = 800; #K
P = 101.3; # kPa
cp1 = helium.Cp(T1)
cv1 = helium.Cv(T1)
k1 = helium.k(T1)
print "Cp = %g \n"%cp1
print "Cv = %g \n"%cv1
print "k = %g \n"%k1
h0 = helium.enthalpy(To)
... | 2.546875 | 3 |
drive/cars/admin.py | yousef-alramli/rest-framwork | 0 | 12781243 | from django.contrib import admin
from .models import Car
@admin.register(Car)
class CarAdmin(admin.ModelAdmin):
list_display = ['name', 'updated', 'user']
| 1.671875 | 2 |
euctr/crawl/base/test_config.py | jeekim/euctr-tracker-code | 3 | 12781244 | <gh_stars>1-10
from pathlib import Path
from .config import *
from .config import SCRAPY_SETTINGS
CACHE_SETTINGS = {
'HTTPCACHE_POLICY': 'scrapy.extensions.httpcache.DummyPolicy',
'HTTPCACHE_ENABLED': True,
'HTTPCACHE_DIR': Path(__file__).parent.parent / 'tests/fixtures'
}
SCRAPY_SETTINGS.update(CACHE_SET... | 1.351563 | 1 |
tzcode/hook/issue.py | Lewinta/TZCode | 0 | 12781245 | <reponame>Lewinta/TZCode
import frappe
import requests
import json
from frappe import enqueue
@frappe.whitelist()
def create_issue(subject, status, customer, raised_by, remote_reference, priority=None, description="No Description"):
if not priority:
priority = "Medio"
if priority and not frappe.db... | 2.03125 | 2 |
qiling/qiling/loader/elf.py | mrTavas/owasp-fstm-auto | 2 | 12781246 | <gh_stars>1-10
#!/usr/bin/env python3
#
# Cross Platform and Multi Architecture Advanced Binary Emulation Framework
#
import os
from heapq import heappush, heappop
from elftools.elf.elffile import ELFFile
from elftools.elf.relocation import RelocationSection
from elftools.elf.sections import SymbolTableSection
from... | 1.882813 | 2 |
tests/unit/test_utils.py | shkumagai/python-ndb | 137 | 12781247 | <reponame>shkumagai/python-ndb
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | 2.03125 | 2 |
quark/network_strategy.py | Cerberus98/quark | 0 | 12781248 | <gh_stars>0
# Copyright 2013 Openstack Foundation
# 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.0
#
# ... | 1.75 | 2 |
tests/test_level_output001.py | brianpm/level_maker | 0 | 12781249 | <gh_stars>0
from pathlib import Path
import json
from level_maker import makelev
def test_example_data_exists():
assert Path("../level_maker/cam3_levels_input.json").is_file()
def test_level_output001():
with open("../level_maker/cam3_levels_input.json") as f:
data = json.load(f)
am, bm, ai, bi, ... | 2.4375 | 2 |
5-bit-manipulation/4-next-number/solution.py | andrenbrandao/cracking-the-coding-interview | 0 | 12781250 | """
Problem:
5.4 Next Number: Given a positive integer, print the next smallest and the next largest number that
have the same number of 1 bits in their binary representation.
Hints: #147, #175, #242, #312, #339, #358, #375, #390
--
Questions:
- Are we considering only non-negative numbers? Or should we also consi... | 3.53125 | 4 |