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 |
|---|---|---|---|---|---|---|
Tuples.py | PiggyAwesome/Learn-Python-Full-Course-for-Beginners-Tutorial-code | 2 | 19900 | <reponame>PiggyAwesome/Learn-Python-Full-Course-for-Beginners-Tutorial-code
# Tuples
coordinates = (4, 5) # Cant be changed or modified
print(coordinates[1])
# coordinates[1] = 10
# print(coordinates[1])
| 3.515625 | 4 |
drift/tests/test_soakit.py | dgnorth/drift | 6 | 19901 | import unittest
import logging
from flask import Flask
@unittest.skip("needs refactoring")
class driftTestCase(unittest.TestCase):
def setUp(self):
self.app = Flask(__name__)
logging.basicConfig(level="ERROR")
self.app.testing = True
self.test_client = self.app.test_client()
... | 2.578125 | 3 |
dir-stats-summary.py | rbrt-weiler/dir-stats | 0 | 19902 | <filename>dir-stats-summary.py<gh_stars>0
#!/usr/bin/python
# vim: set sw=4 sts=4 ts=8 et ft=python fenc=utf8 ff=unix tw=74 :
#
# SYNOPSIS
# ========
# This script analyses an INI file created by dir-stats.py and displays
# directories containing a certain amount of data.
#
# ARGUMENTS
# =========
# Call the script wi... | 2.421875 | 2 |
command_preprocessor.py | Polyhistorian/Pyt-wh-orstBot | 0 | 19903 | <gh_stars>0
import command_processor as command
import discord
async def process(message: discord.Message, is_owner, client: discord.Client):
if message.author.id == client.user.id:
return
if not message.content.startswith('wh!'):
return
if message.channel.type != discord.ChannelType.text:... | 2.5 | 2 |
pybnn/svgd_.py | hssandriss/pybnn | 0 | 19904 | <filename>pybnn/svgd_.py
import random
import time
import numpy as np
import theano
import theano.tensor as T
from scipy.spatial.distance import pdist, squareform
from tqdm import tqdm
'''
Sample code to reproduce our results for the Bayesian neural network example.
Our settings are almost the same as Hernand... | 2.703125 | 3 |
poi_mining/api/server.py | yummydeli/machine_learning | 1 | 19905 | <reponame>yummydeli/machine_learning
#coding:utf-8
################################################################################
#
### Copyright (c) 2015 Baidu.com, Inc. All Rights Reserved
#
##################################################################################
"""
This module provide configure file man... | 2.234375 | 2 |
python/7kyu/even_numbers_in_an_array.py | Sigmanificient/codewars | 3 | 19906 | """Kata url: https://www.codewars.com/kata/5a431c0de1ce0ec33a00000c."""
from typing import List
def even_numbers(arr: List[int], n: int) -> List[int]:
odds: List[int] = [x for x in arr if not x % 2]
return odds[len(odds) - n:]
| 3.9375 | 4 |
backend/lambda_functions/arcgis_loader/arcgis_loader.py | GispoCoding/tarmo | 0 | 19907 | <gh_stars>0
import datetime
import json
from typing import Any, Dict, Optional
import requests
from shapely.geometry import (
LineString,
MultiLineString,
MultiPoint,
MultiPolygon,
Point,
Polygon,
shape,
)
from sqlalchemy.types import BOOLEAN, DATE
from .base_loader import (
LOGGER,
... | 2.078125 | 2 |
excel_handler.py | Jason2031/EMailResponder | 0 | 19908 | import os
import yaml
import xlrd
from openpyxl import load_workbook
from util_func import securely_check_dir
class ExcelHandler:
def __init__(self, config):
self.config = config
securely_check_dir('forms')
securely_check_dir('att')
securely_check_dir('config')
self.sub... | 2.6875 | 3 |
setup.py | gregory-halverson/crs | 0 | 19909 | <filename>setup.py<gh_stars>0
from os.path import join
from os.path import abspath
from os.path import dirname
from distutils.core import setup
__author__ = '<NAME>'
NAME = 'crs'
EMAIL = '<EMAIL>'
URL = 'http://github.com/gregory-halverson/crs'
with open(join(abspath(dirname(__file__)), NAME, 'version.txt')) as f:
... | 1.421875 | 1 |
src/libs/django/utils/request.py | antiline/jun2 | 0 | 19910 | from ipware.ip import get_ip
from ipware.utils import is_private_ip
def is_private_ip_from_request(request) -> bool:
return is_private_ip(get_ip(request))
| 2.15625 | 2 |
sammba/registration/tests/test_base.py | salma1601/sammba-mri | 0 | 19911 | <reponame>salma1601/sammba-mri
import os
from nose import with_setup
from nose.tools import assert_true
import nibabel
from nilearn.datasets.tests import test_utils as tst
from nilearn.image import index_img
from sammba.registration import base
from sammba import testing_data
from nilearn._utils.niimg_conversions impor... | 1.921875 | 2 |
crawling_image/get_image.py | Lee-JH-kor/Review_Project | 0 | 19912 | import urllib.request
from bs4 import BeautifulSoup
import matplotlib.pyplot as plt
from PIL import Image
import os
def image_poster(title_address):
url = f'{title_address}'
req = urllib.request.Request(url)
res = urllib.request.urlopen(url).read()
soup = BeautifulSoup(res, 'html.parser')
soup = ... | 3.234375 | 3 |
muon/__init__.py | WeilerP/muon | 0 | 19913 | """Multimodal omics analysis framework"""
from ._core.mudata import MuData
from ._core import preproc as pp
from ._core import tools as tl
from ._core import plot as pl
from ._core import utils
from ._core.io import *
from ._core.config import set_options
from . import atac
from . import prot
__version__ = "0.1.0"
_... | 0.742188 | 1 |
recipes/recipes/goma_hello_world.py | xinghun61/infra | 2 | 19914 | # Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Compiles trivial C++ program using Goma.
Intended to be used as a very simple litmus test of Goma health on LUCI staging
environment. Linux and OSX only.... | 1.648438 | 2 |
Nowruz_SemEval.py | mohammadmahdinoori/Nowruz-at-SemEval-2022-Task-7 | 2 | 19915 | # -*- coding: utf-8 -*-
"""Nowruz at SemEval 2022: Tackling Cloze Tests with Transformers and Ordinal Regression
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1RXkjBpzNJtc0WhhrKMjU-50rd5uSviX3
"""
import torch
import torch.nn as nn
from torch.functio... | 2.625 | 3 |
fbchat/utils.py | Dainius14/fb-chat-bot-old | 2 | 19916 | <reponame>Dainius14/fb-chat-bot-old<filename>fbchat/utils.py
import re
import json
from time import time
from random import random
USER_AGENTS = [
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 1... | 2.234375 | 2 |
rfhub/blueprints/api/libraries.py | Accruent/robotframework-hub | 0 | 19917 | '''
This provides the view functions for the /api/libraries endpoints
'''
import flask
from flask import current_app
class ApiEndpoint(object):
def __init__(self, blueprint):
blueprint.add_url_rule("/libraries/", view_func = self.get_libraries)
blueprint.add_url_rule("/libraries/<int:collection_i... | 2.796875 | 3 |
pair-ranking-cnn/utils.py | shinoyuki222/torch-light | 310 | 19918 | import const
def corpora2idx(sents, ind2idx):
return [[ind2idx[w] if w in ind2idx else const.UNK for w in s] for s in sents]
| 2.53125 | 3 |
applications/admin/models/menu.py | forca-inf/forca | 6 | 19919 | <reponame>forca-inf/forca
# ###########################################################
# ## generate menu
# ###########################################################
_a = request.application
_c = request.controller
_f = request.function
response.title = '%s %s' % (_f, '/'.join(request.args))
response.subtitle = 'ad... | 1.976563 | 2 |
lenstronomy/LightModel/Profiles/moffat.py | heather999/lenstronomy | 0 | 19920 | <gh_stars>0
__author__ = 'sibirrer'
# this file contains a class to make a Moffat profile
__all__ = ['Moffat']
class Moffat(object):
"""
this class contains functions to evaluate a Moffat surface brightness profile
.. math::
I(r) = I_0 * (1 + (r/\\alpha)^2)^{-\\beta}
with :math:`I_0 = amp... | 2.90625 | 3 |
pypy/module/oracle/test/test_objectvar.py | kantai/passe-pypy-taint-tracking | 2 | 19921 | from pypy.module.oracle.test.test_connect import OracleTestBase
class AppTestObjectVar(OracleTestBase):
def test_fetch_object(self):
import datetime
cur = self.cnx.cursor()
try:
cur.execute("drop table pypy_test_objtable")
except oracle.DatabaseError:
pass
... | 2.421875 | 2 |
lecture70_practice.py | adwabh/python_practice | 0 | 19922 | <gh_stars>0
tempratures = [10,-20, -289, 100]
def c_to_f(c):
if c<-273.15:
return ""
return c* 9/5 +32
def writeToFile(input):
with open("output.txt","a") as file:
file.write(input)
for temp in tempratures:
writeToFile(str(c_to_f(temp)))
| 3.40625 | 3 |
causal_da/components/ica_torch/GCL_nonlinear_ica_train.py | sharmapulkit/few-shot-domain-adaptation-by-causal-mechanism-transfer | 0 | 19923 | <reponame>sharmapulkit/few-shot-domain-adaptation-by-causal-mechanism-transfer
import numpy as np
from ignite.engine import Engine, Events
import torch
from .gcl_model import GeneralizedContrastiveICAModel
from .trainer_util import random_pick_wrong_target, binary_logistic_loss
from .logging_util import DummyRunLogger
... | 2.390625 | 2 |
tetrad_cms/cases/tasks.py | UsernameForGerman/tetraD-NK | 0 | 19924 | <reponame>UsernameForGerman/tetraD-NK<gh_stars>0
from django.conf import settings
from requests import Session
import os
from json import dumps
from core.celery import app
@app.task(queue='cms')
def send_new_contact_to_admins(contact: dict, admins: list) -> None:
s = Session()
data = {'admins': admins, 'cont... | 1.921875 | 2 |
learning/example03_for.py | bokunimowakaru/iot | 6 | 19925 | #!/usr/bin/env python3
# coding: utf-8
# Example 03 コンピュータお得意の繰り返しfor文
from sys import argv # 本プログラムの引数argvを取得する
for name in argv: # 引数を変数nameへ代入
print('Hello,', name + '!') # 変数nameの内容を、文字列Helloに続いて表示
# for文の「argv」を「argv[1:]」にするとargv[1]以降の全引数を順次nameへ代入して繰り返す
| 3.296875 | 3 |
linekey.py | alex-west-met-office/IMBS_MO | 1 | 19926 | ''' A module for defining and producing the linekey object, which is used
to determine and store information about data format in a CRREL
ice mass balance buoy.'''
class linekey:
def __init__(self,date_index = 0):
self.date_index = date_index
self.value_index = []
self.phenomena_names = [... | 3.171875 | 3 |
2020/02/07/An Introduction to Sessions in Flask/flask_session_example/app.py | kenjitagawa/youtube_video_code | 492 | 19927 | from flask import Flask, render_template, session, redirect, url_for
app = Flask(__name__)
app.config['SECRET_KEY'] = '<PASSWORD>'
@app.route('/')
def index():
return render_template('index.html')
@app.route('/set-background/<mode>')
def set_background(mode):
session['mode'] = mode
return red... | 2.125 | 2 |
python/y2019/d19/day18a.py | luke-dixon/aoc | 1 | 19928 | import random
from collections import deque
import networkx as nx
from lib import puzzle
def draw_grid(grid):
min_y, max_y = 0, 0
min_x, max_x = 0, 0
for y, x in grid:
if y < min_y:
min_y = y
if y > max_y:
max_y = y
if x < min_x:
min_x = x
... | 3.296875 | 3 |
train.py | TahjidEshan/PIXOR-1 | 0 | 19929 | <gh_stars>0
import torch
import time
from loss import CustomLoss
from datagen import get_data_loader
from model import PIXOR
from utils import get_model_name, load_config, plot_bev, plot_label_map
from postprocess import non_max_suppression
def build_model(config, device, train=True):
net = PIXOR(conf... | 2.1875 | 2 |
Data-Wrangling-With-Pandas/code.py | fakhruddin950/ga-learner-dsmp-repo | 0 | 19930 | # --------------
# Import packages
import numpy as np
import pandas as pd
from scipy.stats import mode
# code starts here
bank=pd.read_csv(path)
categorical_var=bank.select_dtypes(include='object')
print(categorical_var)
numerical_var=bank.select_dtypes(include='number')
print(numerical_var)
# code ends here... | 3 | 3 |
pygfunction/examples/custom_borehole.py | icupeiro/pygfunction | 0 | 19931 | # -*- coding: utf-8 -*-
""" Example definition of a borehole. A top-view plot of the borehole is
created and the borehole resistance is computed.
"""
from __future__ import absolute_import, division, print_function
import pygfunction as gt
from numpy import pi
def main():
# Borehole dimensions
H = 400. ... | 3.546875 | 4 |
project/models.py | nikodrum/evaluationua | 0 | 19932 | # -*- coding: UTF-8 -*-
from random import randint
import math
from project import matplt,database
from geopy.geocoders import Nominatim
from geopy import exc
import os, shutil
categ_coef = 17960
geolocator = Nominatim()
def clean_temp_folder(folder):
for the_file in os.listdir(folder):
file_path = os.p... | 2.609375 | 3 |
python/titlecase.py | edewillians10/ewsc | 0 | 19933 | #!/usr/bin/env python
import os
import re
import argparse
re_junk = re.compile(r'[._-]')
re_spaces = re.compile(r'\s\s+')
def print_rename(old_filename, new_filename):
print('{} -> {}'.format(old_filename, new_filename))
def print_and_rename(old_path, new_path):
print_rename(old_path, new_p... | 3.828125 | 4 |
broti/modules/stalking.py | pcworld/broti | 0 | 19934 | <gh_stars>0
import time
requires = ['db']
def add_joined(bot, c, e):
username, _, _ = e.source.partition('!')
cur = bot.provides['db'].cursor()
cur.execute('''INSERT INTO stalking (username, date, action, channel)
VALUES (?, ?, ?, ?)''', (username, time.time(), 'join', e.target))
bot.provides... | 2.3125 | 2 |
lib/streamlit/uploaded_file_manager.py | Sax-dot/sax-test-streamlit | 0 | 19935 | # Copyright 2018-2020 Streamlit Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | 2.546875 | 3 |
data/transforms/build.py | zyxwvu321/Classifer_SSL_Longtail | 0 | 19936 | # encoding: utf-8
"""
build transform
"""
#import torchvision.transforms as T
#from PIL import Image
#from .transforms import RandomErasing,RandomErasingCorner
from .data_preprocessing import TrainAugmentation_albu,TestAugmentation_albu,TrainAugmentation_bone,TestAugmentation_bone
import torchvision.transforms as ... | 2.234375 | 2 |
compiler_oj/testcase.py | XunGong99/compiler-offline-judge | 19 | 19937 | <reponame>XunGong99/compiler-offline-judge<filename>compiler_oj/testcase.py
import os
class TestCase:
def __init__(self, raw, filename="unknown", t=1.0):
self.__raw = raw
self.filename = filename
self.src = self.__read_source()
self.comment = self.__find_block("comment")
se... | 2.375 | 2 |
lib/python3.8/site-packages/ansible_collections/cisco/nxos/plugins/modules/nxos_l3_interfaces.py | cjsteel/python3-venv-ansible-2.10.5 | 0 | 19938 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2019 Red Hat
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#############################################
# WARNING #
#############################################
#
# This file is au... | 1.554688 | 2 |
tests/ethereumetl/job/test_extract_geth_traces_job.py | XWorldGames/bsc-etl | 0 | 19939 | # MIT License
#
# Copyright (c) 2018 <NAME>, <EMAIL>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, mer... | 1.695313 | 2 |
typed_python/compiler/type_wrappers/ref_to_wrapper.py | APrioriInvestments/typed_python | 105 | 19940 | <reponame>APrioriInvestments/typed_python
# Copyright 2017-2019 typed_python Authors
#
# 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... | 1.960938 | 2 |
securesite/payroll/admin.py | simokauranen/payroll_api_localhost | 0 | 19941 | """Module to add Employee fields to the User admin interface."""
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.contrib.auth.models import User
from .models import Employee
class EmployeeInline(admin.StackedInline):
model = Employee
can_delete =... | 2.359375 | 2 |
qamplus/voice.py | qamplus/qamplus-pythonsdk | 0 | 19942 | <gh_stars>0
class VoiceClient(object):
def __init__(self, base_obj):
self.base_obj = base_obj
self.api_resource = "/voice/v1/{}"
def create(self,
direction,
to,
caller_id,
execution_logic,
reference_logic='',
... | 2.5625 | 3 |
tests/test_mpauth.py | chuter/wechat-requests | 3 | 19943 | <reponame>chuter/wechat-requests
# -*- encoding: utf-8
import pytest
from wechat.result import build_from_response
from wechat.auth import MpOuthApi, get_mp_access_token
@pytest.mark.usefixtures('response_builder')
class TestAuth:
def test_mp_auth_params(self, mocker, mp_appid, mp_secret):
patched_req... | 2.078125 | 2 |
src/python/pants/backend/codegen/thrift/apache/rules.py | betaboon/pants | 0 | 19944 | # Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import logging
from dataclasses import dataclass
from pants.backend.codegen.thrift.apache.subsystem import ApacheThriftSubsystem
from pants.backend.code... | 1.75 | 2 |
site_asylum/apps/delirium/migrations/0001_initial.py | uruz/asylum.su | 0 | 19945 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='DeliriumUser',
fields=[
('id', models.AutoField... | 1.773438 | 2 |
test.py | quantumporium/shopping_cart_project | 0 | 19946 | <gh_stars>0
# good structure for an pytest test
from app import shopping_cart
def check_if_checkout_give_the_right_value():
'''
'''
arrange_array = [15,7, 10] # arrange
shopping_cart_array = shopping_cart.checkout(arrange_array) # act
assert shopping_cart_array == (31.99, 2.8, 34.79), "this check i... | 2.5 | 2 |
tests/unit/utils/test_win_system.py | markgras/salt | 9,425 | 19947 | import os
import salt.utils.platform
from tests.support.mock import patch
from tests.support.unit import TestCase, skipIf
try:
import salt.utils.win_system as win_system
except Exception as exc: # pylint: disable=broad-except
win_system = exc
class WinSystemImportTestCase(TestCase):
"""
Simply impo... | 2.515625 | 3 |
modules/pgu/gui/list.py | bullseyestudio/guns-game | 0 | 19948 | """
"""
from .const import *
from . import container, widget
class List(container.Container):
def __init__(self, title=None, length=None, show_empty=True, size=20, **params):
params.setdefault('cls','list')
container.Container.__init__(self, **params)
self.title = title
self.font = self.style.font
w,h =... | 3.015625 | 3 |
prog_1.py | swatakit/python-dash-quick-starter | 1 | 19949 | <gh_stars>1-10
#########################################
# The Simplest form of dash application
#
# ref: https://dash.plotly.com/introduction
import dash
import dash_html_components as html
app = dash.Dash(__name__)
# Layout compose
app.layout = html.Div([
html.H1('Hello, this is a Dash Application'),
])
if __... | 2.921875 | 3 |
ros/src/twist_controller/pid.py | redherring2141/CarND-Capstone | 0 | 19950 | <reponame>redherring2141/CarND-Capstone
import rospy
MIN_NUM = float('-inf')
MAX_NUM = float('inf')
class PID(object):
def __init__(self, kp, ki, kd, max_input=MAX_NUM, mn=MIN_NUM, mx=MAX_NUM):
self.kp = kp
self.ki = ki
self.kd = kd
self.min = mn
self.max = mx
# A... | 2.734375 | 3 |
gmocoin/__init__.py | makotookamura/GmoCoin | 0 | 19951 | <gh_stars>0
#!python3
__version__ = '0.0.12'
| 1.085938 | 1 |
climbing_ratings/tests/test_bradley_terry.py | scottwedge/climbing_ratings | 0 | 19952 | """Tests for the bradley_terry module"""
# Copyright 2019 <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 app... | 2.640625 | 3 |
python/testData/inspections/PyUnresolvedReferencesInspection3K/asyncInitMethod.py | jnthn/intellij-community | 2 | 19953 | <filename>python/testData/inspections/PyUnresolvedReferencesInspection3K/asyncInitMethod.py
class A:
<error descr="function \"__init__\" cannot be async">async</error> def __init__(self):
self.foo = '2'
self.bar = '3'
a = A()
print(a.foo) | 2.078125 | 2 |
log_analysis_tool.py | buildthatapp/udacity_fsnd_log_analysis_tool | 0 | 19954 | #!/usr/bin/env python3
"""Log Analysis Project for Full Stack Nanodegree by Udacity"""
import psycopg2
DBNAME = "news"
def three_most_popular_articles():
"""Queries and displays the top three most viewed articles."""
conn = psycopg2.connect(database=DBNAME)
cur = conn.cursor()
query = 'VIEW_top_thr... | 3.40625 | 3 |
samplePythonfiles/cc.py | fazilsha/python-automation | 0 | 19955 | <filename>samplePythonfiles/cc.py
print("File dd.py sucessfully executed") | 1.171875 | 1 |
src/models.py | thowilh/geomars | 2 | 19956 | import torch
import torch.nn as nn
import pytorch_lightning as pl
from torchvision.models import (
alexnet,
vgg16_bn,
resnet18,
resnet34,
resnet50,
densenet121,
densenet161,
)
from torch.nn import functional as F
from pytorch_lightning.metrics.functional import accuracy, precision_recall
c... | 2.265625 | 2 |
examples/challenges/shell-plugin/ctfd/CTFd/plugins/shell-plugin/shell.py | ameserole/Akeso | 19 | 19957 | import logging
import os
import re
import time
import urllib
from threading import Thread
import xmlrpclib
from Queue import Queue
from flask import current_app as app, render_template, request, redirect, abort, jsonify, json as json_mod, url_for, session, Blueprint
from itsdangerous import TimedSerializer, BadTimeSi... | 2.046875 | 2 |
386-Lexicographical-Numbers/solution.py | Tanych/CodeTracking | 0 | 19958 | class Solution(object):
def _dfs(self,num,res,n):
if num>n:
return
res.append(num)
num=num*10
if num<=n:
for i in xrange(10):
self._dfs(num+i,res,n)
def sovleOn(self,n):
res=[]
cur=1
for i in xrange(1,n+1):
... | 3.28125 | 3 |
discord-status.py | byemc/discord-rhythmbox-plugin | 1 | 19959 | import gi
import time
import os
import json
gi.require_version('Notify', '0.7')
gi.require_version('Gtk', '3.0')
from gi.repository import Notify, Gtk
from gi.repository import Gio, GLib, GObject, Peas
from gi.repository import RB
from pypresence import Presence
from status_prefs import discord_status_prefs
class dis... | 2.328125 | 2 |
arsenyinfo/src/utils.py | cortwave/camera-model-identification | 6 | 19960 | <filename>arsenyinfo/src/utils.py
import logging
import subprocess
logging.basicConfig(level=logging.INFO,
format='%(levelname)s: %(name)s: %(message)s (%(asctime)s; %(filename)s:%(lineno)d)',
datefmt="%Y-%m-%d %H:%M:%S", )
logger = logging.getLogger(__name__)
def get_img_attr... | 2.328125 | 2 |
4.logRegression/plot2D.py | zhaolongkzz/Machine-Learning | 0 | 19961 | <gh_stars>0
# -*- coding:utf-8 -*-
# !/usr/bin/python3.6
from numpy import *
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
import logRegress, regIteration
dataMat,labelMat=logRegress.loadDataSet()
dataArr = array(dataMat)
weights = regIteration.stocGradAscent0(d... | 2.453125 | 2 |
talos/distribute/distribute_run.py | abhijithneilabraham/talos | 0 | 19962 | <filename>talos/distribute/distribute_run.py
import json
import threading
from .distribute_params import run_scan_with_split_params
from .distribute_utils import return_current_machine_id, ssh_connect, ssh_file_transfer, ssh_run
from .distribute_database import update_db
def run_central_machine(self, n_splits, run_ce... | 2.328125 | 2 |
src/oci/database_management/models/sql_tuning_advisor_task_summary_finding_counts.py | ezequielramos/oci-python-sdk | 3 | 19963 | # coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | 1.976563 | 2 |
main.py | Araime/wine | 0 | 19964 | <filename>main.py<gh_stars>0
import datetime
import pandas
import collections
import argparse
from collections import OrderedDict
from jinja2 import Environment, FileSystemLoader, select_autoescape
from http.server import HTTPServer, SimpleHTTPRequestHandler
def get_age(foundation_year):
today = datetime.datetime... | 3.15625 | 3 |
src/genie/libs/parser/junos/tests/ShowOspfStatistics/cli/equal/golden_output_expected.py | balmasea/genieparser | 204 | 19965 | expected_output = {
"ospf-statistics-information": {
"ospf-statistics": {
"dbds-retransmit": "203656",
"dbds-retransmit-5seconds": "0",
"flood-queue-depth": "0",
"lsas-acknowledged": "225554974",
"lsas-acknowledged-5seconds"... | 1.007813 | 1 |
marc_5gempower/run_5gempower.py | arled-papa/marc | 1 | 19966 | <filename>marc_5gempower/run_5gempower.py
#!/usr/bin/env python3
#
# Copyright (c) 2021 <NAME>
# Author: <NAME> <<EMAIL>>
#
# 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.apa... | 2.265625 | 2 |
jina/peapods/peas/gateway/grpc/__init__.py | yk/jina | 1 | 19967 | <reponame>yk/jina<gh_stars>1-10
import asyncio
import argparse
import os
from multiprocessing.synchronize import Event
from typing import Union, Dict
import grpc
import zmq.asyncio
from .async_call import AsyncPrefetchCall
from ... import BasePea
from ....zmq import send_message_async, recv_message_async, _init_socke... | 1.875 | 2 |
Spell Compendium/scr/Spell1059 - Improvisation.py | Sagenlicht/ToEE_Mods | 1 | 19968 | from toee import *
def OnBeginSpellCast(spell):
print "Improvisation OnBeginSpellCast"
print "spell.target_list=", spell.target_list
print "spell.caster=", spell.caster, " caster.level= ", spell.caster_level
def OnSpellEffect(spell):
print "Improvisation OnSpellEffect"
spell.duration = spell.cast... | 2.390625 | 2 |
Theseus/Tests/__init__.py | amias-iohk/theseus | 4 | 19969 | __author__ = '<NAME> <<EMAIL>> for IOHK'
__doc__ = 'Daedalus Testing functions'
from .Cardano import *
from .Daedalus import *
from .Common import *
| 1.015625 | 1 |
mobula/operators/Multiply.py | wkcn/mobula | 47 | 19970 | from .Layer import *
class Multiply(Layer):
def __init__(self, models, *args, **kwargs):
self.check_inputs(models, 2)
Layer.__init__(self, models, *args, **kwargs)
def reshape(self):
self.Y = np.zeros(self.X[0].shape)
def forward(self):
self.Y = np.multiply(self.X[0], self.X... | 3.015625 | 3 |
project/settings_deploy.py | djstein/vue-django-webpack | 43 | 19971 | from project.settings import INSTALLED_APPS, ALLOWED_HOSTS, BASE_DIR
import os
INSTALLED_APPS.append( 'webpack_loader',)
INSTALLED_APPS.append( 'app',)
ALLOWED_HOSTS.append('*',)
# STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATICFILES_DIRS = [
# os.path.join(BASE_DIR, 'static',)
os.path.join(BASE_DIR, ... | 1.6875 | 2 |
dockerfiles/igv/igv.py | leipzig/gatk-sv | 76 | 19972 | <reponame>leipzig/gatk-sv
import sys
[_, varfile] = sys.argv
plotdir = "plots"
igvfile = "igv.txt"
igvsh = "igv.sh"
with open(varfile, 'r') as f:
for line in f:
dat = line.split('\t')
chr = dat[0]
start = dat[1]
end = dat[2]
data = dat[3].split(',')
| 2.1875 | 2 |
model/sample/adg.py | sdy99/PowerAI | 7 | 19973 | # coding: gbk
"""
@author: sdy
@email: <EMAIL>
Abstract distribution and generation class
"""
class ADG(object):
def __init__(self, work_path, fmt):
self.work_path = work_path
self.fmt = fmt
self.features = None
self.mode = 'all'
def distribution_assess(self):
raise N... | 2.265625 | 2 |
src/validatesigner.py | harryttd/remote-signer | 0 | 19974 | <reponame>harryttd/remote-signer<filename>src/validatesigner.py<gh_stars>0
#
# The ValidateSigner applies a ChainRatchet to the signature request
# and then passes it down to a signer. In order to do this, it must
# parse the request and to obtain the level and round to pass to the
# ratchet code.
import logging
fro... | 2.671875 | 3 |
CODE/web_server/server/audio_processing/DataLoader.py | andrewbartels1/Marine-Mammal-Acoustics | 1 | 19975 | <filename>CODE/web_server/server/audio_processing/DataLoader.py<gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 1 17:48:01 2021
@author: bartelsaa
"""
# boiler plate stuff
import re, os, io
from glob import glob
import pandas as pd
import sys
import pytz
from models import Sensor
f... | 1.851563 | 2 |
tests/lib/test_otping.py | reputage/py-didery | 0 | 19976 | <reponame>reputage/py-didery<gh_stars>0
import pytest
try:
import simplejson as json
except ImportError:
import json
from ioflo.aio.http import Valet
# import didery.routing
from diderypy.lib import generating as gen
from diderypy.lib import otping as otp
vk, sk, did = gen.keyGen()
otpData = {
"id": di... | 2.453125 | 2 |
src/DCGMM/measuring/Logging.py | anon-scientist/dcgmm | 0 | 19977 | <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, software
# d... | 2 | 2 |
demos/demo_pyqtgraph_threadsafe_static.py | Dennis-van-Gils/python-dvg-pyqtgraph-threadsafe | 0 | 19978 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import numpy as np
from PyQt5 import QtWidgets as QtWid
import pyqtgraph as pg
from dvg_pyqtgraph_threadsafe import PlotCurve
USE_OPENGL = True
if USE_OPENGL:
print("OpenGL acceleration: Enabled")
pg.setConfigOptions(useOpenGL=True)
pg.setConfigO... | 2.390625 | 2 |
froide/team/services.py | manonthemat/froide | 0 | 19979 | <reponame>manonthemat/froide<filename>froide/team/services.py
import hashlib
import hmac
from django.conf import settings
from django.template.loader import render_to_string
from django.utils.crypto import constant_time_compare
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
fr... | 2.15625 | 2 |
turtle/snowflake.py | yunzhang599/Python3_Package_Examples | 1 | 19980 |
from turtle import forward, left, right, width, color, clearscreen
clearscreen()
color("lightblue")
width(3)
for i in range(6):
forward(50)
left(60)
forward(25)
left(180)
forward(25)
left(60)
forward(25)
left(180)
forward(25)
right(120)
forward(25)
left(180)
forwar... | 2.9375 | 3 |
pyechonest/config.py | gleitz/automaticdj | 14 | 19981 | #!/usr/bin/env python
# encoding: utf-8
"""
Copyright (c) 2010 The Echo Nest. All rights reserved.
Created by <NAME> on 2010-04-25.
Global configuration variables for accessing the Echo Nest web API.
"""
__version__ = "4.2.8"
import os
if('ECHO_NEST_API_KEY' in os.environ):
ECHO_NEST_API_KEY = os.environ['ECHO... | 2.015625 | 2 |
norbert/__init__.py | AppleHolic/norbert | 142 | 19982 | import numpy as np
import itertools
from .contrib import compress_filter, smooth, residual_model
from .contrib import reduce_interferences
def expectation_maximization(y, x, iterations=2, verbose=0, eps=None):
r"""Expectation maximization algorithm, for refining source separation
estimates.
This algorith... | 3 | 3 |
postr/twitter_postr.py | dbgrigsby/Postr | 3 | 19983 | <reponame>dbgrigsby/Postr
import csv
import datetime
import json
import re
import os
import time
from typing import List
import matplotlib
import matplotlib.pyplot as plt
from tweepy import OAuthHandler
from tweepy import Stream
from tweepy.api import API
from tweepy.streaming import StreamListener
from tweepy.cursor ... | 2.953125 | 3 |
Contents/Libraries/Shared/subliminal_patch/providers/legendastv.py | Acidburn0zzz/Sub-Zero.bundle | 1 | 19984 | # coding=utf-8
import logging
from subliminal.providers.legendastv import LegendasTVSubtitle as _LegendasTVSubtitle, \
LegendasTVProvider as _LegendasTVProvider, Episode, Movie, guess_matches, guessit, sanitize
logger = logging.getLogger(__name__)
class LegendasTVSubtitle(_LegendasTVSubtitle):
def __init__(... | 2.46875 | 2 |
takeyourmeds/groups/groups_billing/plans.py | takeyourmeds/takeyourmeds-web | 11 | 19985 | """
This file must be kept up-to-date with Stripe, especially the slugs:
https://manage.stripe.com/plans
"""
PLANS = {}
class Plan(object):
def __init__(self, value, slug, display):
self.value = value
self.slug = slug
self.display = display
PLANS[slug] = self
FREE = Plan(1, 'f... | 2.59375 | 3 |
footprint/socialnetwork/views.py | hairleng/Footprint | 0 | 19986 | from django.shortcuts import render, redirect, get_object_or_404
import json
from django.http import HttpResponse, Http404
from django.urls import reverse
from django.contrib.auth.decorators import login_required
from django.utils import timezone
# Create your views here.
from socialnetwork.forms import *
from soci... | 2.078125 | 2 |
Application/datasources/datapod_backup/utils.py | GraphicalDot/datapod-backend-layer | 0 | 19987 | <gh_stars>0
from abc import ABC,abstractmethod
import os
import binascii
import subprocess
import time
import datetime
import platform
import tempfile
import requests
import json
import aiohttp
from sanic import response
from asyncinit import asyncinit
from errors_module.errors import MnemonicRequiredError
from error... | 1.992188 | 2 |
abc/abc145/abc145b.py | c-yan/atcoder | 1 | 19988 | <gh_stars>1-10
N = int(input())
S = input()
if N % 2 == 1:
print('No')
exit()
if S[:N // 2] == S[N // 2:]:
print('Yes')
else:
print('No')
| 3.078125 | 3 |
gadget/reboot.py | vaginessa/RaspberryPiZero_HID_MultiTool | 54 | 19989 | <reponame>vaginessa/RaspberryPiZero_HID_MultiTool<filename>gadget/reboot.py<gh_stars>10-100
#!/usr/bin/python
import RPi.GPIO as GPIO
import os
gpio_pin_number=21
GPIO.setmode(GPIO.BCM)
GPIO.setup(gpio_pin_number, GPIO.IN, pull_up_down=GPIO.PUD_UP)
try:
GPIO.wait_for_edge(gpio_pin_number, GPIO.FALLING)
os.syst... | 2.28125 | 2 |
code/sample_1-2-16.py | KoyanagiHitoshi/AtCoder-Python-Introduction | 1 | 19990 | <reponame>KoyanagiHitoshi/AtCoder-Python-Introduction
rows = int(input())
x = [input() for i in range(rows)]
print(x)
| 3.296875 | 3 |
barcap/main.py | Barmaley13/CaptureBarcode | 1 | 19991 | """
Run capture as a separate process
"""
import time
from barcap.barcode import BarcodeCapture
def main():
# Default camera index
camera_index = 0
# Camera selection routine
try:
from .device_list import select_camera, camera_list
# Get camera list
dev_list = camera_list()... | 3 | 3 |
gabriel_lego/lego_engine/config.py | molguin92/gabriel-lego-py3 | 0 | 19992 | <filename>gabriel_lego/lego_engine/config.py
#!/usr/bin/env python
#
# Cloudlet Infrastructure for Mobile Computing
# - Task Assistance
#
# Author: <NAME> <<EMAIL>>
#
# Copyright (C) 2011-2013 Carnegie Mellon University
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this f... | 1.90625 | 2 |
civis_jupyter_notebooks/platform_persistence.py | menglewis/civis-jupyter-notebook | 0 | 19993 | <gh_stars>0
"""
This file contains utilities that bind the Jupyter notebook to our platform.
It performs two functions:
1. On startup, pull the contents of the notebook from platform to the local disk
2. As a Jupyter post-save hook, push the contents of the notebook and a HTML preview of the same back to platfo... | 2.265625 | 2 |
dbt_cloud/command/job/run.py | jeremyyeo/dbt-cloud-cli | 33 | 19994 | import os
import requests
from typing import Optional, List
from pydantic import Field, validator
from dbt_cloud.command.command import DbtCloudAccountCommand
from dbt_cloud.field import JOB_ID_FIELD
class DbtCloudJobRunCommand(DbtCloudAccountCommand):
"""Triggers a dbt Cloud job run and returns a status JSON res... | 2.15625 | 2 |
modelzoo/migrations/0024_auto_20201014_1425.py | SuperElastix/ElastixModelZooWebsite | 1 | 19995 | # Generated by Django 3.0.3 on 2020-10-14 12:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('modelzoo', '0023_model_con_mod_dims'),
]
operations = [
migrations.RemoveField(
model_name='model',
name='author_ema... | 1.648438 | 2 |
src/misc/MBExp.py | akshatha-k/Calibrated_MOPO | 0 | 19996 | from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
import os
from time import time, localtime, strftime
import numpy as np
from scipy.io import savemat
from dotmap import DotMap
from src.modeling.trainers import BNN_trainer
from src.misc.DotmapUtils import ge... | 2.15625 | 2 |
lightnn/base/__init__.py | tongluocq/lightnn | 131 | 19997 | <gh_stars>100-1000
#!/usr/bin/env python
# coding=utf-8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from .activations import *
from .losses import *
from .initializers import *
from .optimizers import *
| 1.070313 | 1 |
tests/vvadd/Q.py | sa2257/llvm-runtime-pass | 0 | 19998 | import time
class processingElement:
def __init__(self, name, op, flex, regs, ports, bdwth, route, ctrl, branch):
self.name = name
self.op = op
self.tick = 1
self.ins = [0, 0]
self.outs = [None, None]
self.flex = flex
self.regs = regs
self.p... | 2.75 | 3 |
middleman/api/application/__init__.py | scooterman/middleman | 5 | 19999 | <reponame>scooterman/middleman<gh_stars>1-10
__author__ = 'victor'
| 1.015625 | 1 |