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 |
|---|---|---|---|---|---|---|
midnight_news/models.py | webadmin87/midnight | 1 | 40900 | <filename>midnight_news/models.py
from django.core.urlresolvers import reverse
from django.db import models
from midnight_main.models import BaseTree, Base, BreadCrumbsMixin, BaseComment
from ckeditor.fields import RichTextField
from django.utils.translation import ugettext_lazy as _
from sorl.thumbnail import ImageFie... | 2.359375 | 2 |
Src/Morse.py | DragonixAlpha/Kal | 0 | 40901 | MORSE_CODE_DICT = { 'A':'.-', 'B':'-...',
'C':'-.-.', 'D':'-..', 'E':'.',
'F':'..-.', 'G':'--.', 'H':'....',
'I':'..', 'J':'.---', 'K':'-.-',
'L':'.-..', 'M':'--', 'N':'-.',
'O':'---', 'P':'.--.', 'Q':'--.-',
... | 3.40625 | 3 |
Monke/__init__.py | Duck-sri/Monke | 0 | 40902 | <reponame>Duck-sri/Monke
from .block import Block
from .transaction import Transaction
from .account import Account | 1.0625 | 1 |
Test_Files/test_velosity_controller.py | Jesse-Redford/SolidWorks_Pybullet_Integration | 5 | 40903 | <reponame>Jesse-Redford/SolidWorks_Pybullet_Integration
import pybullet
import pybullet_data
pybullet.connect(pybullet.GUI)
pybullet.resetSimulation()
pybullet.setAdditionalSearchPath(pybullet_data.getDataPath())
def get_joint_info(robot):
print('The system has', pybullet.getNumJoints(robot), 'joints')
... | 2.78125 | 3 |
tpstorch/ml/optim.py | muhammadhasyim/tps-torch | 3 | 40904 | import torch
from torch.optim import Optimizer
from torch.optim.optimizer import required
#Depending on PyTorch version, the name of the functional module
#May either have an underscore or not!
oldversion = False
try:
import torch.optim._functional as F
except:
import torch.optim.functional as F
oldversion... | 2.328125 | 2 |
Analise de Dados/Arquivo Inicial - Aula 2.py | EduardoMdR/Aprendendo-Python | 0 | 40905 | <gh_stars>0
#!/usr/bin/env python
# coding: utf-8
# # Análise de Dados com Python
#
# ### Desafio:
#
# Você trabalha em uma empresa de telecom e tem clientes de vários serviços diferentes, entre os principais: internet e telefone.
#
# O problema é que, analisando o histórico dos clientes dos últimos anos, você perc... | 2.765625 | 3 |
research/cv/ntsnet/data_prepare.py | leelige/mindspore | 77 | 40906 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# 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.1875 | 2 |
gui/helpers/native_saver.py | intdata-bsc/idact-gui | 3 | 40907 | <gh_stars>1-10
""" One of the helpers for the gui application.
Similar modules: class:`.DataProvider`, :class:`.ParameterSaver`,
:class:`.UiLoader`, :class:`.Worker`, :class:`.ConfigurationProvider`
"""
import json
import os
class NativeArgsSaver:
""" Manages the native arguments.
"""
def __init... | 2.515625 | 3 |
aoc_2021/src/day1.py | akohen/AdventOfCode | 0 | 40908 | from pathlib import Path
def phase1(values):
total, prev = 0, values[0]
for curr in values:
if curr > prev:
total = total +1
prev = curr
return total
def phase2(values):
return phase1([values[i] + values[i+1] + values[i+2] for i in range(0,len(values)-2)])
if __name__ == "... | 3.390625 | 3 |
src/human_lambdas/hl_cli.py | Human-Lambdas/human-lambdas | 25 | 40909 | <filename>src/human_lambdas/hl_cli.py<gh_stars>10-100
import os
import shutil
import subprocess
import sys
from pathlib import Path
from subprocess import PIPE
import click
@click.group()
def cli():
if "POSTGRES_DB" in os.environ:
click.echo(
click.style(
"POSTGRES_DB is set, ... | 2.328125 | 2 |
Testing/03_use_type_hint/type_hint_classes.py | t2y/python-study | 18 | 40910 | <filename>Testing/03_use_type_hint/type_hint_classes.py
# -*- coding: utf-8 -*-
class MyClass:
# The __init__ method doesn't return anything, so it gets return
# type None just like any other method that doesn't return anything.
def __init__(self) -> None:
...
# For instance methods, omit `self`.
... | 3.5 | 4 |
setup/settings/third_party/django_storages.py | asim3/django-template | 0 | 40911 | <reponame>asim3/django-template
import os
AWS_S3_FILE_OVERWRITE = False
DEFAULT_FILE_STORAGE = 'backends.storages.PrivateMediaStorage'
# DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
STATICFILES_STORAGE = 'storages.backends.s3boto3.S3StaticStorage'
AWS_ACCESS_KEY_ID = os.environ.get('AWS_ACCESS... | 1.59375 | 2 |
cinder/tests/unit/volume/drivers/datacore/test_datacore_fc.py | alexisries/openstack-cinder | 2 | 40912 | # Copyright (c) 2017 DataCore Software Corp. 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
#
# Unless... | 1.765625 | 2 |
tests/test_DepthEstimator.py | melkimble/OpticalRS | 17 | 40913 | <gh_stars>10-100
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_DepthEstimator
-------------------
pytest Tests for `OpticalRS.DepthEstimator` module. To run these tests, install
pytest and run `py.test` in this test directory.
"""
from OpticalRS.RasterDS import RasterDS
from OpticalRS.DepthEstimator import ... | 2.375 | 2 |
generator/generator.py | luigig44/KryptoCards | 0 | 40914 | <filename>generator/generator.py
from fractions import Fraction as frac
from solver import solve
from solver_cant import solve_cant
from difficulty import diff
from random import randint
import json
import webbrowser
import base64
def gen_kryptos(cant):
l = []
while(1):
a = randint(1,5)
b = randint(1,10)
c = r... | 2.984375 | 3 |
test/test_say.py | andrewvaughan/ansible-message | 8 | 40915 | <filename>test/test_say.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2017 <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 with... | 1.976563 | 2 |
opendata/tasks.py | OpenData-NC/open-data-nc | 5 | 40916 | from celery import task
from django.core.mail import send_mail
@task
def send_email(subject, message, from_email, recipient_list):
"""Send email async using a celery worker
args: Take sames args as django send_mail function.
"""
send_mail(subject, message, from_email, recipient_list)
@task
def u... | 2.484375 | 2 |
array/fourSum.py | ZeddShi/alg-py | 0 | 40917 | <filename>array/fourSum.py
# 四数之和
def fourSum(nums, target):
pass | 0.730469 | 1 |
tests/test_observatory.py | Physarah/huntsman-pocs | 3 | 40918 | <filename>tests/test_observatory.py<gh_stars>1-10
import os
import pytest
from astropy import units as u
from panoptes.utils.time import current_time
from panoptes.pocs.utils.location import create_location_from_config
from panoptes.pocs.scheduler import create_scheduler_from_config
from panoptes.pocs.mount import c... | 2.109375 | 2 |
AutoDonationDownload.py | tsheez/scaretocare2017 | 0 | 40919 | <reponame>tsheez/scaretocare2017
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
from datetime import datetime
import glob, os
if __name__ == '__main__':
updateFrequency = 15 #seconds
driver = webdriver.Chrome(executable_path="C:\\Users\\KastreamAbdulJabbar\\Desktop... | 2.546875 | 3 |
store/adminshop/views/__init__.py | vallemrv/my_store_test | 0 | 40920 | <reponame>vallemrv/my_store_test<gh_stars>0
# -*- coding: utf-8 -*-
# @Author: <NAME> <valle>
# @Date: 28-Sep-2017
# @Email: <EMAIL>
# @Last modified by: valle
# @Last modified time: 31-Jan-2018
# @License: Apache license vesion 2.0
from django.shortcuts import render, redirect
from django.contrib.auth.decorato... | 1.945313 | 2 |
dmriprep/workflows/dwi/conversions/nii_to_mif/edges.py | GalBenZvi/dmriprep | 0 | 40921 | INPUT_TO_DWI_CONVERSION_EDGES = [("dwi_file", "in_file")]
INPUT_TO_FMAP_CONVERSION_EDGES = [("fmap_file", "in_file")]
LOCATE_ASSOCIATED_TO_COVERSION_EDGES = [
("json_file", "json_import"),
("bvec_file", "in_bvec"),
("bval_file", "in_bval"),
]
DWI_CONVERSION_TO_OUTPUT_EDGES = [("out_file", "dwi_file")]
FMAP... | 1.359375 | 1 |
src/utils.py | sdat2/rotunno87 | 0 | 40922 | """General project util functions"""
from typing import Callable
import inspect
import time
from functools import wraps
from sys import getsizeof
def timeit(method: Callable) -> Callable:
"""timeit is a wrapper for performance analysis which should
return the time taken for a function to run. Alters `log_time... | 3.90625 | 4 |
src/classifier_evaluator/visualisations/roc_plot.py | yitistica/classifier_evaluator | 1 | 40923 | <gh_stars>1-10
import matplotlib.pyplot as plt
from matplotlib import cm
import numpy as np
from classifier_evaluator.metrics import roc, roc_auc
from classifier_evaluator.pre_process import data_type_converter
# setting standard plot size:
_DEFAULT_FIGURE_SIZE = (10, 10)
_DEFAULT_COLOR_PALETTE = "jet"
def plot_roc(... | 2.640625 | 3 |
ppgan/datasets/lapstyle_dataset.py | JackMcCoy/PaddleGAN | 0 | 40924 | <filename>ppgan/datasets/lapstyle_dataset.py
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve.
#
# 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/licen... | 2.171875 | 2 |
config/almacen_api_config.py | xyla-io/almacen_api | 0 | 40925 | almacen_api_config = {
'debug': {
'name': 'almacen_api',
'database': 'stage_01',
'debug': True,
'app': {
'DEBUG': True,
'UPLOAD_FOLDER': '/tmp',
},
'run': {
# 'ssl_context': ('ssl/cert.pem', 'ssl/key.pem'),
'port': 8000,
},
'app_tokens': {
'TOKEN': {
... | 1.273438 | 1 |
python-fundamentals/day-9-modules/example-1.py | laminsawo/python-365-days | 0 | 40926 | <gh_stars>0
# Import and use a module
# There are 3 ways to import modules
# Example 1: Import the entire module
import random
# To use this module, we can...
rand_number = random.randrange(1,10)
print(rand_number)
# Note: 'random' is the module and 'randrange' is the function
# This example randomly sele... | 4.15625 | 4 |
modelconfig.py | divyanshrm/Polyth-Net-Classification-of-Polythene-Bags-Using-Deep-Dearning | 0 | 40927 | <filename>modelconfig.py
from tensorflow.keras.applications.xception import Xception
import tensorflow.keras as k
def modelconfig(dropout_rate):
model=k.models.Sequential()
model_efficient=Xception(include_top=False,input_shape=(224,224,3),weights=None)
model.add(k.layers.InputLayer((224,224,3)))
model.ad... | 2.5625 | 3 |
scripts/tags/generate_mapstyle.py | rinigus/geocoder-nlp | 16 | 40928 | #!/usr/bin/env python3
import sqlite3
db = sqlite3.connect('taginfo-db.db')
c = db.cursor()
mapost = ""
whitelist = ""
keyvals = []
for r in c.execute("select key,value from tags where key='shop' order by count_all desc limit 50"):
key, value = r
# no need for these
if value in ['yes', 'no']:
c... | 3.3125 | 3 |
day6-4[twitter&W2V].py | cutz-j/Python-for-data-analysis | 0 | 40929 | <filename>day6-4[twitter&W2V].py
import codecs
from bs4 import BeautifulSoup
from konlpy.tag import Twitter
from gensim.models import word2vec
# W2V
fp=codecs.open("D:/DataAnalysis/BEXX0003.txt", "r", encoding='utf-16')
soup=BeautifulSoup(fp, 'html.parser')
#print(soup)
# html > text
body=soup.select_one("body > tex... | 2.96875 | 3 |
python_code_tips/functions_example/functions-before.py | VLTSankalpa/python_networking | 0 | 40930 | <filename>python_code_tips/functions_example/functions-before.py
#! /usr/bin/env python
import requests
import json
import argparse
# Diable InsecureRequestWarning
requests.packages.urllib3.disable_warnings(
requests.packages.urllib3.exceptions.InsecureRequestWarning
)
# DevNet Always-On Sandbox DNA C... | 2.625 | 3 |
examples/data/gen_olf_input.py | neurokernel/sensory_int | 0 | 40931 | #!/usr/bin/env python
"""
Generate sample olfactory model stimulus.
"""
import numpy as np
import h5py
osn_num = 1375
dt = 1e-4 # time step
Ot = 2000 # number of data point during reset period
Rt = 1000 # number of data point during odor delivery period
#Nt = 4*Ot + 3*Rt # number of data points in time
#Nt = 10000... | 2.125 | 2 |
08-def-type-hints/comparable/mymax.py | eumiro/example-code-2e | 0 | 40932 | # tag::MYMAX_TYPES[]
from typing import Protocol, Any, TypeVar, overload, Callable, Iterable, Union
class _Comparable(Protocol):
def __lt__(self, other: Any) -> bool: ...
_T = TypeVar('_T')
_CT = TypeVar('_CT', bound=_Comparable)
_DT = TypeVar('_DT')
MISSING = object()
EMPTY_MSG = 'max() arg is an empty sequence... | 2.4375 | 2 |
airnow/api.py | briandconnelly/airnow-py | 1 | 40933 | <reponame>briandconnelly/airnow-py
# -*- coding: utf-8 -*-
import requests
def get_airnow_data(endpoint: str, **kwargs) -> dict:
"""Query the AirNow API and return the contents
:param str endpoint: AirNow API endpoint (e.g., "/aq/observation/zipCode/current")
Additional named arguments are passed on as... | 3.09375 | 3 |
Auths/models.py | cool199966/AccountManager | 1 | 40934 | from django.db import models
import datetime
from django.contrib.auth.models import (
BaseUserManager, AbstractBaseUser, Group, PermissionsMixin
)
class MyUserManager(BaseUserManager):
def create_user(self, username, password = None):
user = self.model(
username = username,
)
user.set_password(password)
... | 2.53125 | 3 |
ctapipe/calib/camera/tests/test_r1.py | mpecimotika/ctapipe | 0 | 40935 | import pytest
from numpy.testing import assert_almost_equal, assert_array_equal, \
assert_array_almost_equal
from ctapipe.calib.camera.r1 import (
CameraR1CalibratorFactory,
HESSIOR1Calibrator,
TargetIOR1Calibrator,
NullR1Calibrator
)
from ctapipe.io.eventsource import EventSource
from ctapipe.io.s... | 2.203125 | 2 |
mini_imagenet.py | dingmyu/prototypical-network-pytorch | 0 | 40936 | <filename>mini_imagenet.py
import os
import os.path as osp
from PIL import Image
from torch.utils.data import Dataset
from torchvision import transforms
class MiniImageNet(Dataset):
def __init__(self, root='', dataset='', mode='train'):
data = []
label = []
self.root = root
sel... | 2.71875 | 3 |
CursoEmVideo-Python3-Mundo1/desafio035.py | martinsnathalia/Python | 0 | 40937 | <reponame>martinsnathalia/Python<gh_stars>0
# Desenvolva um programa que leia o comprimento de três retas e diga ao usuário se elas podem ou não formar um triângulo.
print('Suas retas formam um triângulo?')
r1 = float(input('Digite a primeira reta: '))
r2 = float(input('Digite a segunda reta: '))
r3 = float(input('Dig... | 4.125 | 4 |
Vamei/function/function2.py | YangPhy/learnPython | 5 | 40938 | <filename>Vamei/function/function2.py
a=1
def change_integer(a):
a = a+1
return a
print (change_integer(a))
print (a)
b=[1,2,3]
def change_list(b):
b[0]=b[0]+1
return b
print (change_list(b))
print (b)
| 3.171875 | 3 |
Problems/Minimum and maximum/task.py | gabrielizalo/jetbrains-academy-python-coffee-machine | 0 | 40939 | number_1 = int(input())
number_2 = int(input())
if number_1 >= number_2:
print(number_1)
print(number_2)
else:
print(number_2)
print(number_1)
| 3.828125 | 4 |
app/backend/models/room.py | kz3ko/smart-home-heating-simulation | 1 | 40940 | from __future__ import annotations
from copy import deepcopy
from dataclasses import dataclass, field
from typing import Optional
from models.backyard import Backyard
from models.heater import Heater
@dataclass
class Room:
id: int
name: str
title: str
coldThreshold: list[float]
optimalThreshold:... | 2.703125 | 3 |
coding patterns/k-way merge/k_smallest_number_in_sorted_matrix.py | mkoryor/Python | 0 | 40941 |
"""
[H] Given an N * NN∗N matrix where each row and column is sorted in ascending order,
find the Kth smallest element in the matrix.
Example 1:
Input: Matrix=[
[2, 6, 8],
[3, 7, 10],
[5, 8, 11]
],
K=5
Output: 7
Explanation: The 5th smallest number in the matrix is 7.
"""
from heapq import ... | 3.875 | 4 |
earthvision/datasets/drone_deploy.py | otivedani/earth-vision | 0 | 40942 | <reponame>otivedani/earth-vision
"""Class for Drone Deploy - Semantic Segmentation."""
from PIL import Image
import sys
import os
import numpy as np
import random
import cv2
from typing import Any, Callable, Optional, Tuple
from .vision import VisionDataset
from earthvision.constants.DroneDeploy.config import (
tr... | 2.90625 | 3 |
IT77A _assistant.py | JasinAlAmin/Owl-Chatbot | 0 | 40943 | import speech_recognition as sr
import pyttsx3
import pywhatkit
import datatime
import wikipedia
import pyjokes
from googlesearch import search
listener = sr.Recognizer()
engine = pyttsx3.init()
voices = engine.getProperty('voices')
engine.setPropert('voice',voices[1].id)
def talk(text)
engine.say(text)
engine... | 3.203125 | 3 |
experiment-3/make_design_files_for_power_analyses.py | NBCLab/power-replication | 1 | 40944 | """
"""
import os.path as op
from glob import glob
from os import mkdir
from shutil import copyfile
def make_image_file():
design_file = "design.fsf"
# Each file
gp_mem = "# Group membership for input {0}\nset fmri(groupmem.{0}) 1\n"
hi_thing = "# Higher-level EV value for EV 1 and input {0}\nset fmr... | 2.578125 | 3 |
chapter07/address_book_import.py | gothedistance/python-book | 17 | 40945 | <filename>chapter07/address_book_import.py
class AddressBook:
person_list = []
def add(self, person):
self.person_list.append(person)
def show_all(self):
for person in self.person_list:
print(person.lastname + " " + person.firstname)
def search(self,keyword):
for ... | 3.75 | 4 |
app/__init__.py | mkorcha/CoyoteLab | 2 | 40946 | <reponame>mkorcha/CoyoteLab<filename>app/__init__.py
import os
from flask import Flask
from flask_kvsession import KVSessionExtension
from flask_mail import Mail
from flask_migrate import Migrate
from flask_sqlalchemy import SQLAlchemy
from flask_wtf.csrf import CsrfProtect
db = SQLAlchemy()
migrate = Migrate()
csrf... | 2.015625 | 2 |
data/get_cfmid_candidates.py | aalto-ics-kepaco/lcms2struct_exp | 0 | 40947 | ####
#
# The MIT License (MIT)
#
# Copyright 2021 <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, cop... | 1.695313 | 2 |
View/old/MainWindow.py | logisticAKB/course-paper1 | 1 | 40948 | <reponame>logisticAKB/course-paper1<filename>View/old/MainWindow.py
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'MainWindow.ui'
#
# Created by: PyQt5 UI code generator 5.13.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class U... | 1.71875 | 2 |
scripts/extract_frequencies.py | hjortnaes/congra_parser | 0 | 40949 | from collections import Counter, namedtuple
def print_freqs(freqs):
"""
Prints an easy to read format of the frequencies extracted from the corpus
to the file frequencies.txt
:return: None
"""
with open('frequencies.txt', 'w') as f:
for t, c in freqs.items():
print(str(t), ... | 3.734375 | 4 |
back.py | ikenichaa/thai_soundex | 0 | 40950 | <reponame>ikenichaa/thai_soundex<filename>back.py
def main(input):
myDict = {}
myDict['ก']='k'
for key in ['ข','ค', 'ฆ']:
myDict[key] = 'k'
myDict['ง']='ng'
myDict['จ']='t'
for key in ['ฉ','ฌ', 'ช']:
myDict[key] = 't'
for key in ['ซ','ศ', 'ษ','ส']:
myDict[key] = 't'
... | 3.15625 | 3 |
tests/cli/test_api_consumer.py | chib0/asd-winter2019 | 0 | 40951 | <filename>tests/cli/test_api_consumer.py<gh_stars>0
import pytest
import werkzeug
import cortex.cli.api_consumer as api_consumer
@pytest.fixture()
def consumer(httpserver):
return api_consumer.Consumer(httpserver.host, httpserver.port)
def test_consumer_base_request_requests_joined_url(consumer, httpserver):
... | 2.140625 | 2 |
scptoweb-climockup.py | 519seven/python_snippets | 0 | 40952 | <reponame>519seven/python_snippets<filename>scptoweb-climockup.py
#!/usr/bin/env python3
# ==========================================================
# Copyright 2020 519Seven
# ==========================================================
''' Designed for cron - scp files to web server
Set up SSH key for password-less ... | 2.046875 | 2 |
google_gas_station.py | loghmanb/daily-coding-problem | 0 | 40953 | <reponame>loghmanb/daily-coding-problem<filename>google_gas_station.py
'''
Gas Station
Asked in: Bloomberg, Google, DE Shaw, Amazon, Flipkart
Given two integer arrays A and B of size N.
There are N gas stations along a circular route, where the amount of gas at station i is A[i].
You have a car with an unlimited gas ... | 4.125 | 4 |
api/tests/integration/tests/todo/load_utf8.py | epam/Indigo | 204 | 40954 | <reponame>epam/Indigo
# coding=utf-8
import sys
sys.path.append('../../common')
from env_indigo import *
indigo = Indigo()
indigo.setOption("molfile-saving-skip-date", "1")
print("****** Load molfile with UTF-8 characters in Data S-group ********")
m = indigo.loadMoleculeFromFile(joinPathPy("molecules/sgroups_utf8.mo... | 2.1875 | 2 |
secondtest/2013/1gaussjacobi.py | JoaoCostaIFG/MNUM | 1 | 40955 | #!/usr/bin/env python3
# CHECKED
A = [[4.5, -1, -1, 1], [-1, 4.5, 1, -1], [-1, 2, 4.5, -1], [2, -1, -1, 4.5]]
b = [1, -1, -1, 0]
x = [0.25, 0.25, 0.25, 0.25]
x_new = [0, 0, 0, 0]
for k in range(2):
for i in range(4):
x_new[i] = b[i]
for j in range(4):
if j != i:
x_new[... | 2.953125 | 3 |
exercises/house_price_prediction.py | ranitoukhy/IML.HUJI | 0 | 40956 | <filename>exercises/house_price_prediction.py<gh_stars>0
import numpy
from sklearn.model_selection import ParameterGrid
import IMLearn.utils
from IMLearn.utils import split_train_test
from IMLearn.learners.regressors import LinearRegression
from typing import NoReturn
import numpy as np
import pandas as pd
import plo... | 3.140625 | 3 |
mykit/core/kmesh.py | minyez/mykit | 4 | 40957 | # -*- coding: utf-8 -*-
'''Module that defines classes and functions for Brillouin zone sampling
'''
import os
import re
from copy import deepcopy
import numpy as np
from mykit.core._control import (build_tag_map_obj, extract_from_tagdict,
parse_to_tagdict, prog_mapper, tags_mapping)
... | 2.421875 | 2 |
deepcompton/datasets.py | vuillaut/DeepIntegralCompton | 1 | 40958 | from pathlib import Path
from tqdm.auto import tqdm
import numpy as np
import pickle
import os
from astropy.table import Table
import pickle as pkl
from multiprocessing import Pool, Manager
from threading import Lock
from .cones import make_cone_density
from .utils import load_data
from .cones import make_cone
from .c... | 2.296875 | 2 |
src/models/Classifier.py | ChristianCKKoch/Repo_1 | 0 | 40959 | from sklearn.model_selection import GridSearchCV
from sklearn.neighbors import KNeighborsClassifier
from sklearn.tree import DecisionTreeClassifier
from sklearn.ensemble import RandomForestClassifier
from sklearn.neural_network import MLPClassifier
from sklearn.svm import SVC
import numpy as np
import pandas as pd
impo... | 2.84375 | 3 |
app/dashapp3/layout.py | credwood/bitplayers | 1 | 40960 | <reponame>credwood/bitplayers
import dash_core_components as dcc
import dash_html_components as html
import dash_table
import plotly
import plotly.graph_objs as go
layout = html.Div([
html.H2('Top Locations of Search Terms'),
html.P('Term searches may take several seconds. Please be patient.''),
html.P('Tw... | 2.265625 | 2 |
signalwire/relay/calling/components/fax_send.py | ramarketing/signalwire-python | 23 | 40961 | <reponame>ramarketing/signalwire-python<gh_stars>10-100
from .base_fax import BaseFax
from ..constants import Method
class FaxSend(BaseFax):
def __init__(self, call, document, identity=None, header=None):
super().__init__(call)
self._document = document
self._identity = identity
self._header = heade... | 2.546875 | 3 |
Prog4comp-SL-HPL-Extra/src/brute_force_root_finder_function.py | computational-medicine/BMED360-2021 | 2 | 40962 | def brute_force_root_finder(f, a, b, n):
from numpy import linspace
x = linspace(a, b, n)
y = f(x)
roots = []
for i in range(n-1):
if y[i]*y[i+1] < 0:
root = x[i] - (x[i+1] - x[i])/(y[i+1] - y[i])*y[i]
roots.append(root)
elif y[i] == 0:
... | 3.5 | 4 |
lintcode/Medium/052_Next_Permutation.py | Rhadow/leetcode | 3 | 40963 | <reponame>Rhadow/leetcode
class Solution:
# @param num : a list of integer
# @return : a list of integer
def nextPermutation(self, num):
# write your code here
# Version 1
bp = -1
for i in range(len(num) - 1):
if (num[i] < num[i + 1]):
bp = i
... | 3.203125 | 3 |
abc_097_b.py | YukiShinonome/AtCoder | 0 | 40964 | <filename>abc_097_b.py
X = int(input())
a_list = []
for s in range(1, 32):
for i in range(2, 10):
a = s ** i
if a > 1000:
break
a_list.append(a)
a2 = sorted(list(set(a_list)), reverse=True)
for n in a2:
if n <= X:
print(n)
break | 2.984375 | 3 |
Modulo_2/semana4/tarea/presentacion/presentacion.py | rubens233/cocid_python | 0 | 40965 |
def presentacion_inicial():
print("*"*20)
print("Que accion desea realizar : ")
print("1) Insertar Persona : ")
print("2) Insertar Empleado : ")
print("3) Consultar las personas : ")
print("4) Consultar por empleados : ")
return int(input("Opcion necesitas : "))
| 3.359375 | 3 |
django_web_app/telegram/apps.py | alexzanderr/django_web_app | 0 | 40966 | from django.apps import AppConfig
class TelegramConfig(AppConfig):
name = 'telegram'
| 1.15625 | 1 |
Sorting/sort list strings with numbers.py | DazEB2/SimplePyScripts | 117 | 40967 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
# Генерация списка
items = ['KMS1.kmch.pos.out_dE_%s.mx' % i for i in range(20)]
# Перемешивание элементов списка
import random
random.shuffle(items)
print(items)
# Обычная сортировка не работает
print(sorted(items))
print()
def get_number_1... | 3.109375 | 3 |
djangocms_charts/migrations/0002_add_chart_position.py | l1f7/djangocms-charts | 5 | 40968 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('djangocms_charts', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='chartjsbarmodel',
name='chart_position',
field=models.CharField(... | 1.648438 | 2 |
release/stubs.min/System/Runtime/InteropServices/__init___parts/SEHException.py | tranconbv/ironpython-stubs | 0 | 40969 | class SEHException(ExternalException):
"""
Represents structured exception handling (SEH) errors.
SEHException()
SEHException(message: str)
SEHException(message: str,inner: Exception)
"""
def ZZZ(self):
"""hardcoded/mock instance of the class"""
return SEHException()
instance=ZZZ()
"""har... | 2.921875 | 3 |
heightmaptilemaker/heightmap/heightmap.py | ulrichji/HeightmapTileMaker | 0 | 40970 | import geo.geo_utils
import geo.raster_lookup
from progress.null_callback import NullCallback
from progress.progress import Progress
import glob
import numpy as np
class Heightmap:
def __init__(self):
self.pixels = []
self.heightmap = None
self.nodata_fillin = 0
self.out_of_bounds... | 2.5625 | 3 |
python_tutorials/sets.py | bionikspoon/HackerRank | 0 | 40971 | def get_stdin():
raw_input()
list_1 = raw_input().split()
raw_input()
list_2 = raw_input().split()
return list_1, list_2
if __name__ == '__main__':
set_m, set_n = get_stdin()
set_m = set(set_m)
set_n = set(set_n)
result = []
result.extend(set_m.difference(set_n))
result.ext... | 3.1875 | 3 |
release/stubs.min/Revit/References.py | YKato521/ironpython-stubs | 0 | 40972 | <filename>release/stubs.min/Revit/References.py
# encoding: utf-8
# module Revit.References calls itself References
# from RevitNodes,Version=1.2.1.3083,Culture=neutral,PublicKeyToken=null
# by generator 1.145
# no doc
# no imports
# no functions
# classes
class RayBounce(object):
# no doc
@stat... | 1.875 | 2 |
wukong/master/dbserver.py | fakewen/Monitoring-branch | 0 | 40973 | <reponame>fakewen/Monitoring-branch
#!/usr/bin/python
# vim: ts=2 sw=2 expandtab
# author: <NAME>
import dateutil.parser
from gevent import monkey; monkey.patch_all()
import gevent
import serial
import platform
import os, sys, zipfile, re, time
import tornado.ioloop, tornado.web
import tornado.template as template
im... | 1.9375 | 2 |
cata/utils/train_mnist_classifier.py | seblee97/student_teacher_catastrophic | 2 | 40974 | <reponame>seblee97/student_teacher_catastrophic
from collections import deque
from typing import Dict
import numpy as np
import torch
import torch.nn as nn
from components.data_modules import MNISTDigitsData
from models.networks.base_network import Model
from utils import Parameters
class ClassificationTeacher(Mode... | 2.515625 | 3 |
bazel/docker/initialize.bzl | mlab-lattice/lattice | 1 | 40975 | <reponame>mlab-lattice/lattice
load("@io_bazel_rules_docker//go:image.bzl", go_image_repositories="repositories")
load("@io_bazel_rules_docker//container:container.bzl", container_repositories = "repositories")
def initialize_rules_docker():
container_repositories()
go_image_repositories()
load("@distroless//packa... | 1.3125 | 1 |
postal_code.py | shinyaohtani/postalnumber | 0 | 40976 | #!/usr/bin/env python
# coding: utf_8
import os
import csv, sqlite3
import unicodedata
import pdb
# 0 全国地方公共団体コード
# 1 旧郵便番号
# 2 郵便番号
# 3 都道府県名
# 4 市区町村名
# 5 町域名
# 6 都道府県名
# 7 市区町村名
# 8 町域名
# 9 一町域が二以上の郵便番号で表される場合の表示 (注3) (「1」は該当、「0」は該当せず)
# 10 小字毎に番地が起番されている町域の表示 (注4) (「1」は該当、「0」は該当せず)
# 11 丁目を有する町域の場合の表示 (「1」は該当、「0」は... | 2.984375 | 3 |
SimCalorimetry/EcalSelectiveReadoutProducers/python/ecalDigis_cff.py | ckamtsikis/cmssw | 852 | 40977 | <reponame>ckamtsikis/cmssw<filename>SimCalorimetry/EcalSelectiveReadoutProducers/python/ecalDigis_cff.py
import FWCore.ParameterSet.Config as cms
# Define EcalSelectiveReadoutProducer module as "simEcalDigis" with default settings
from SimCalorimetry.EcalSelectiveReadoutProducers.ecalDigis_cfi import *
| 0.941406 | 1 |
pythran/tests/cython/setup_tax.py | davidbrochart/pythran | 1,647 | 40978 | from distutils.core import setup
from Cython.Build import cythonize
setup(
name = "tax",
ext_modules = cythonize('tax.pyx'),
script_name = 'setup.py',
script_args = ['build_ext', '--inplace']
)
import tax
import numpy as np
print(tax.tax(np.ones(10)))
| 1.484375 | 1 |
i3pystatus/weather/wunderground.py | eBrnd/i3pystatus | 0 | 40979 | from i3pystatus import IntervalModule
from i3pystatus.core.util import internet, require
from datetime import datetime
from urllib.request import urlopen
import json
import re
GEOLOOKUP_URL = 'http://api.wunderground.com/api/%s/geolookup%s/q/%s.json'
STATION_QUERY_URL = 'http://api.wunderground.com/api/%s/%s/q/%s.jso... | 2.796875 | 3 |
lpot/ux/components/optimization/graph_optimizer/graph_optimization.py | intelkevinputnam/lpot-docs | 0 | 40980 | <reponame>intelkevinputnam/lpot-docs
# -*- coding: utf-8 -*-
# Copyright (c) 2021 Intel 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/LICENS... | 2.15625 | 2 |
train.py | ilivans/multihead-sentiment | 0 | 40981 | #!/usr/bin/python
"""
Train multihead-classifier with triplet loss
"""
from __future__ import print_function, division
import numpy as np
import pandas as pd
import tensorflow as tf
from sklearn.model_selection import train_test_split
from tensorflow.contrib.layers import fully_connected
from tensorflow.contrib.rnn im... | 2.984375 | 3 |
Logica/Decisao.py | DjCod3r/PythonScripts | 0 | 40982 | a = 15
b = 15
exp = a == b
if a < b:
print(f'{a} e menor que {b}')
elif a > b :
print(f'{a} e maior que {b}')
else:
print('Os valores são iguais')
letra = 'l'
nome = '<NAME>'
if letra in nome:
print(f'Contem {letra} no nome')
else:
print(f'Não Contem {letra} no nome')
valor = '2'
valores = '827189... | 3.671875 | 4 |
test/test_g2p.py | gantzgraf/vape | 4 | 40983 | from .utils import *
def test_g2p():
output = get_tmp_out()
input = os.path.join(dir_path, 'test_data', 'ex2.bcf')
test_args = dict(
no_warnings=True,
input=input,
output=output,
ped=os.path.join(dir_path, "test_data", "test.ped"),
de_novo=True,
biallelic=Tr... | 1.953125 | 2 |
src/pretalx/api/permissions.py | lili668668/pretalx | 418 | 40984 | from rest_framework.permissions import SAFE_METHODS, BasePermission
class ApiPermission(BasePermission):
def _has_permission(self, view, obj, request):
event = getattr(request, "event", None)
if not event: # Only true for root API view
return True
if request.method in SAFE_ME... | 2.546875 | 3 |
09-problems/lc_389_find_difference.py | hamidgasmi/training.computerscience.algorithms-datastructures | 8 | 40985 | <reponame>hamidgasmi/training.computerscience.algorithms-datastructures<gh_stars>1-10
"""
1. Problem Summary / Clarifications / TDD:
output("abcd", "abecd") = "e"
2. Inuition: xor operator
3. Tests:
output("abcd", "abecd") = "e": The added character is in the middle of t
... | 3.734375 | 4 |
stackstrap/__init__.py | movermeyer/stackstrap | 3 | 40986 | __version__ = '0.2.2'
__url__ = 'https://github.com/stackstrap/stackstrap'
| 1.0625 | 1 |
app/ratelimit/time_bucketed.py | mampilly/backend-global | 0 | 40987 | <reponame>mampilly/backend-global<gh_stars>0
'''Rate limiting via Redis'''
import logging
from datetime import timedelta
from redis import Redis
from app.core.database.cache import get_redis_connection
from app.exceptions.application_exception import exception
def rate_request(key, limit, period):
"""Rate request... | 2.140625 | 2 |
za/minstData/test.py | hth945/pytest | 0 | 40988 | <reponame>hth945/pytest<gh_stars>0
#%%
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
import cv2
import numpy as np
import shutil
import random
from zipfile import ZipFile
rootPath = '..\..\dataAndModel\data\mnist\\'
for file in ["train", "test"]:
path = rootPath + file
print(os.listdir(path))
# %%
im... | 2.03125 | 2 |
yesg/__init__.py | Lienus10/yesg | 0 | 40989 | from .main import get_esg_short
from .main import get_esg_full
from .main import get_historic_esg
| 1.039063 | 1 |
Turtles.py | Comp-Sci-Principles-2018-19/chapter-2-exercises-lanoflatfaceo | 0 | 40990 | import turtle
wn=turtle.Screen()
alex=turtle.Turtle()
alex.forward(50)
alex.left(90)
alex.forward(30)
wn.mainloop() | 2.6875 | 3 |
www/lib/components/config/shared.py | cripplet/ipfire-material-design | 0 | 40991 | <gh_stars>0
import json
from lib.components import shared
class IPFireConfigShim(shared.ShimObject):
BOOL_TRANSLATE_DICT = {
'on': True,
'off': False,
}
def FromEngine(self, data: shared.EngineType) -> shared.ConfigType:
if not data:
return {}
parts = [l.strip().split('=', 1) for l in da... | 2.15625 | 2 |
urls.py | bellachp/DashTut | 0 | 40992 | # urls.py
# urls for dash app
url_paths = {
"index": '/',
"home": '/home',
"scatter": '/apps/scatter-test',
"combo": '/apps/combo-test'
}
| 1.585938 | 2 |
toga/genetic_algorithm/mutate/float.py | JPLMLIA/TOGA | 0 | 40993 | <gh_stars>0
"""
Author: <NAME>
Date : 1/23/19
Brief :
Notes :
Copyright 2019 California Institute of Technology. ALL RIGHTS RESERVED.
U.S. Government Sponsorship acknowledged.
"""
import numpy as np
import random
from toga.genetic_algorithm.genetype import Mutator
from toga.genetic_algorithm.mutate.genemutate imp... | 2.609375 | 3 |
services/web/server/src/simcore_service_webserver/clusters/handlers.py | sanderegg/osparc-simcore | 0 | 40994 | <reponame>sanderegg/osparc-simcore
import logging
from typing import List
from aiohttp import web
from models_library.clusters import Cluster
from models_library.users import GroupID, UserID
from pydantic import ValidationError
from servicelib.aiohttp.rest_utils import extract_and_validate
from servicelib.json_seriali... | 1.976563 | 2 |
train.py | ricedatasci/workshop3-aws-floydhub | 0 | 40995 | <filename>train.py
import os
import numpy as np
from sklearn.model_selection import StratifiedShuffleSplit
from keras.callbacks import ModelCheckpoint
from keras.utils import to_categorical
# from plotter_callback import Plotter
import smartphone6 as sm6
from models import naive as model_func
SEED = 2263
np.random.se... | 2.703125 | 3 |
projection_cam_calibration/projection_cam_calibration.py | p-dimi/Projector_Camera_Calibrator | 2 | 40996 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 14 13:47:12 2017
@author: Dima
"""
import time
import numpy as np
import math
import cv2
import sys
''' Currently works with webcams only '''
cam_index = int(input('What index is your webcam? If it is the built in webcam of the laptop, it is... | 3.453125 | 3 |
c2cgeoportal/scaffolds/update/+package+/CONST_migration/versions/015_Add_timeMode_column.py | pgiraud/c2cgeoportal | 0 | 40997 | <filename>c2cgeoportal/scaffolds/update/+package+/CONST_migration/versions/015_Add_timeMode_column.py
from sqlalchemy import MetaData, Table, Column, types
from c2cgeoportal import schema
def upgrade(migrate_engine):
meta = MetaData(bind=migrate_engine)
layer = Table('layer', meta, schema=schema, autoload=Tr... | 1.828125 | 2 |
open_humans/management/commands/remove_expired_keys.py | danamlewis/open-humans | 57 | 40998 | import datetime
from django.core.management.base import BaseCommand
from data_import.models import DataFileKey
class Command(BaseCommand):
"""
A management command for expunging expired keys
"""
help = "Expunge expired keys"
def handle(self, *args, **options):
self.stdout.write("Expung... | 2.546875 | 3 |
histolab/data/_registry.py | nipeone/histolab | 0 | 40999 | # flake8: noqa
# in legacy datasets we need to put our sample data within the data dir
legacy_datasets = ["cmu_small_region.svs"]
# Registry of datafiles that can be downloaded along with their SHA256 hashes
# To generate the SHA256 hash, use the command
# openssl sha256 filename
registry = {
"histolab/broken.svs... | 1.671875 | 2 |