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 |
|---|---|---|---|---|---|---|
hackerrank/all-domains/data-structures/arrays/2d-array-ds/solution.py | arvinsim/coding-site-solutions | 0 | 12795251 | #!/bin/python
#https://www.hackerrank.com/challenges/2d-array
# KEY INSIGHTS
# 1. Variables in list comprehensians are not encapsulated. They could shadow
# local variables if you name them the same
# 2. When looping 2-dimensional arrays, the outer loop should represent the
# y-axis while the inner loop should repres... | 4.125 | 4 |
psosc.py | AlgoLab/pso-cancer-evolution | 1 | 12795252 | <filename>psosc.py
"""
Particle Swarm Optimization Single Cell inference
Usage:
psosc.py (-i infile) (-c cores) (-k k) (-a alpha) (-b beta)
[-p particles] [-g gamma] [-t iterations] [-d max_deletions] [-e mutfile] [-T tolerance] [-m maxtime] [-I truematrix] [--quiet] [--output output]
psosc.py --help
... | 2.296875 | 2 |
drf_nested/mixins/base_nestable_mixin.py | promoteinternational/drf-nested | 1 | 12795253 | <reponame>promoteinternational/drf-nested
from rest_framework import serializers
class BaseNestableMixin(serializers.ModelSerializer):
def _get_model_pk(self):
if isinstance(self, serializers.ListSerializer):
model = self.child.Meta.model
else:
model = self.Meta.model
... | 2.015625 | 2 |
eval.py | EkdeepSLubana/OrthoReg | 9 | 12795254 | <reponame>EkdeepSLubana/OrthoReg
# -*- coding: utf-8 -*-
import torch
import torchvision
from torchvision import datasets, models, transforms
import numpy as np
import torch.optim as optim
import os
import shutil
from models import *
from pruner import *
from config import *
from ptflops import get_model_complexity_inf... | 2.25 | 2 |
ansible_lib/firebrew.py | mrk21/ansible-lib | 3 | 12795255 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import absolute_import
from __future__ import generators
from __future__ import division
import pipes
from ansible.module_utils.basic import *
class Firebrew(object):
STATUS_SUCCESS = 0
STATUS_FAILURE = 1
... | 2.0625 | 2 |
main/consecutive-array-elements/consecutive-array-elements.py | EliahKagan/old-practice-snapshot | 0 | 12795256 | <filename>main/consecutive-array-elements/consecutive-array-elements.py
#!/usr/bin/env python3
def read_record():
return list(map(int, input().split()))
def is_consecutive(a):
return max(a) - min(a) + 1 == len(a) == len(frozenset(a))
for _ in range(int(input())):
input() # don't need n
print('Yes' if... | 4 | 4 |
examples/util/lookups.py | OptionMetrics/petl | 495 | 12795257 | from __future__ import division, print_function, absolute_import
# lookup()
##########
import petl as etl
table1 = [['foo', 'bar'],
['a', 1],
['b', 2],
['b', 3]]
lkp = etl.lookup(table1, 'foo', 'bar')
lkp['a']
lkp['b']
# if no valuespec argument is given, defaults to the whole
# row ... | 2.46875 | 2 |
OptWind/WindFarm/flow_field.py | ArjunRameshV/OptWind | 1 | 12795258 | <gh_stars>1-10
# -*- coding: utf-8 -*-
import numpy as np
class FlowField(object):
def __init__(self, wf_design, getAkf, height_ref, alpha=0.04,
ws_binned=np.linspace(1, 30, 30),
wd_binned=np.linspace(0, 330, 12),
z0=0.01
):
... | 2.265625 | 2 |
lambdata/fibo.py | mudesir/lambdata-mudesir | 0 | 12795259 | """ Fibonancci series up to n"""
def fib(n): # write Fibonacci series up to n
a, b = 0, 1
while a < n:
print(a, end=' ')
a, b = b, a + b
print()
def fib2(n): # return Fibonacci series up to n
result = []
a, b = 0, 1
while a < n:
result.append(a)
a, b = b,... | 4.03125 | 4 |
DataTypes.py | jingr1/SelfDrivingCar | 0 | 12795260 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2017-10-14 19:45:05
# @Author : jingray (<EMAIL>)
# @Link : http://www.jianshu.com/u/01fb0364467d
# @Version : $Id$
import os
# STRINGS
print("STRINGS")
my_string_1 = "hello"
my_string_2 = 'world'
my_multiline_string = """
Dear World,
Hello. I am a mult... | 4.40625 | 4 |
pitch_table.py | andrewtron3000/jampy | 0 | 12795261 | pitch_table = {
"C-1" : 8.176,
"C#-1": 8.662,
"D-1" : 9.177,
"D#-1": 9.723,
"E-1" : 10.301,
"F-1" : 10.913,
"F#-1": 11.562,
"G-1" : 12.250,
"G#-1": 12.978,
"A-1" : 13.750,
"A#-1": 14.568,
"B-1" : 15.434,
"C0" : 16.352,
"C#0" : 17.324,
"D0" : 18.354,
"D#0... | 1.609375 | 2 |
code/utils/memory_file_utils.py | ahillbs/minimum_scan_cover | 0 | 12795262 | """These utils can be used to get an StringIO objects that
can be written like a file but does not close at the end of a "with" statement.
Objects can be retrieved with the virtual path.
This was implemented to use in configargparser in mind.
To use it, call for example:
holder = StringIOHolder()
parser = configargpar... | 3.28125 | 3 |
tests/lib/test_time_util.py | daisuke19891023/covid19-yamanashi-scraping | 4 | 12795263 | import pytest
from src.lib.time_util import TimeUtil
import datetime
@pytest.fixture(scope="module", autouse=True)
def tmu_object():
tmu = TimeUtil()
yield tmu
class TestTimeUtil:
@pytest.mark.parametrize("test_input, expected_wareki, expected_other", [(
'令和2年10月31日',
'令和',
'2年10... | 2.484375 | 2 |
scripts/Portfolio.py | jcoffi/FuturesAndOptionsTradingSimulation | 14 | 12795264 |
class Portfolio:
# define array of items that are the trades in the portfolio
# run-time interpretation will handle polymorphism for me
Trades = []
Cash = 0.0
Name = ''
def __init__(self,name=''):
self.Name = name
self.Trades = []
self.Cash = 0.0
def Append(self,X):
self.Trades.appen... | 3.125 | 3 |
tests/api/testDepositLog.py | starkbank/sdk-python | 6 | 12795265 | <reponame>starkbank/sdk-python<filename>tests/api/testDepositLog.py
import starkbank
from unittest import TestCase, main
from starkbank.error import InputErrors
from tests.utils.user import exampleProject
starkbank.user = exampleProject
class TestDepositLogGet(TestCase):
def test_success(self):
logs = ... | 3.078125 | 3 |
main.py | shizacat/pdf-add-watermark | 0 | 12795266 | #!/usr/bin/env python3
"""
sudo apt-get install libqpdf-dev
"""
import zlib
import argparse
import pikepdf
from pikepdf import Pdf, PdfImage, Name
from reportlab.pdfgen import canvas
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
from reportlab.lib import units
class PdfWater... | 2.484375 | 2 |
code/test1-eng.py | jdellert/ccnc | 0 | 12795267 | <reponame>jdellert/ccnc<gh_stars>0
# TEST 1: Validation of shared bigram significance test on English data
from ccnc.algorithm import ccnc_statistic
from ccnc.data import LexicalDataset, ShuffledVariant
from ccnc.filters import AnySubsequenceFilter
from clics2.model import Clics2Model
import statistics
# define segme... | 2.34375 | 2 |
hw_asr/model/quartznet_model.py | art591/dla_asr | 0 | 12795268 | <reponame>art591/dla_asr<gh_stars>0
from torch import nn
from torch.nn import Sequential
from hw_asr.base import BaseModel
class TCSConv(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, dilation=1, activation=nn.ReLU, separable=True):
super().__init__()
tcsconv = []
... | 1.96875 | 2 |
app/migrations/0007_auto_20190909_1207.py | LuoBingjun/Pic_demo | 1 | 12795269 | <reponame>LuoBingjun/Pic_demo
# Generated by Django 2.2 on 2019-09-09 04:07
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0006_auto_20190908_1239'),
]
operations = [
migrations.RemoveField(
model_name='record',
... | 1.578125 | 2 |
Introduction to Artificial Intelligence/PA3/src/rnn.py | youyl/Programming-Assignments-THU | 0 | 12795270 | <reponame>youyl/Programming-Assignments-THU<filename>Introduction to Artificial Intelligence/PA3/src/rnn.py<gh_stars>0
import torch
import torch.nn as nn
import torch.nn.functional as F
class Rnn(nn.Module):
def __init__(self):
super(Rnn,self).__init__()
self.lstm=nn.LSTM(input_size=300,hidden_size=150,bidirectio... | 3.78125 | 4 |
scholarship_graph/profiles.py | Tutt-Library/cc-scholarship-graph | 1 | 12795271 | """Profiles for Scholarship App"""
__author__ = "<NAME>"
import base64
import bibcat
import datetime
import hashlib
import io
import os
import pprint
import smtplib
import subprocess
import threading
import uuid
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import mimetypes
impo... | 2.25 | 2 |
DeepLearning from scratch/example3.py | Nikeshbajaj/MachineLearningFromScratch | 15 | 12795272 | <reponame>Nikeshbajaj/MachineLearningFromScratch
'''
Example 3: Deep Neural Network from scrach
@Author _ <NAME>
PhD Student at Queen Mary University of London &
University of Genova
Conact _ http://nikeshbajaj.in
n[dot]<EMAIL>
bajaj[dot]<EMAIL>
'''
import numpy as np
import matplotlib.pyplot as plt
from DeepNet im... | 3.640625 | 4 |
session-3/tflite/converter.py | darkling-thrush/MLIntroduction | 0 | 12795273 | '''
Created on Dec 23, 2019
@author: mohammedmostafa
'''
import tensorflow as tf
modelPath = "../model/CNDetector_5.h5"
converter = tf.lite.TFLiteConverter.from_keras_model_file(modelPath)
converter.optimizations = [tf.lite.Optimize.OPTIMIZE_FOR_SIZE]
lite_model = converter.convert()
open("../model/CNDetector_Lite_5... | 2.46875 | 2 |
am_exps/__init__.py | AxlAlm/SegNLP | 1 | 12795274 |
from .jpnn_exp import jpnn
from .lstm_cnn_crf_exp import lstm_cnn_crf
from .lstm_crf_exp import lstm_crf
from .lstm_dist_exp import lstm_dist
from .lstm_er_exp import lstm_er
| 1.015625 | 1 |
scripts/AIA_CH_spoca_jobs.py | bmampaey/spoca4rwc | 0 | 12795275 | <gh_stars>0
#!/usr/bin/env python3
import os
import sys
import logging
import argparse
from glob import glob
from datetime import datetime, timedelta
from job import Job, JobError
from AIA_quality import get_quality, get_quality_errors
# Path to the classification program
classification_exec = '/opt/spoca4rwc/SPoCA/b... | 2.015625 | 2 |
frontend/model/migrations/versions/d385c3eb6937_users_autoincrement_set_to_pk.py | MarioBartolome/GII_0_17.02_SNSI | 1 | 12795276 | """USERS - Autoincrement set to PK
Revision ID: d385c3eb6937
Revises: ee2cbe4166fb
Create Date: 2018-02-16 11:23:29.705565
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'd385c3eb6937'
down_revision = 'ee2cbe4166fb'
branch_labels = None
depends_on = None
def... | 1.476563 | 1 |
algeria.py | yasserkaddour/covid19-icu-data-algeria | 5 | 12795277 | # A large portion of the code came from the COVID-19 Dataset project by Our World in Data
# https://github.com/owid/covid-19-data/tree/master/scripts/scripts/vaccinations/src/vax/manual/twitter
# Mainly contributed by <NAME> https://github.com/lucasrodes
# The code is under completely open access under the Creative Com... | 2.6875 | 3 |
hiMoon/haplotype.py | sadams2013/hiMoon | 4 | 12795278 | <reponame>sadams2013/hiMoon
# Copyright 2021 <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 ap... | 2.4375 | 2 |
pioneer/das/api/sensors/radar_conti.py | leddartech/pioneer.das.api | 8 | 12795279 | <reponame>leddartech/pioneer.das.api
from pioneer.das.api.interpolators import nearest_interpolator
from pioneer.das.api.samples import Sample, XYZVI
from pioneer.das.api.sensors.sensor import Sensor
class RadarConti(Sensor):
def __init__(self, name, platform):
super(RadarConti, self).__init__(name,
... | 2.234375 | 2 |
scripts/f247.py | Eve-ning/aleph0 | 0 | 12795280 | from math import pi
import numpy as np
from aleph.consts import *
from reamber.algorithms.generate.sv.generators.svOsuMeasureLineMD import svOsuMeasureLineMD, SvOsuMeasureLineEvent
from reamber.osu.OsuMap import OsuMap
# notes: 01:37:742 (97742|2,125moves993|2) -
SHAKES = np.array(
[100560, 100790, 101018, ... | 2 | 2 |
bin/flt-include-doc-map.py | tapaswenipathak/MkTechDocs | 9 | 12795281 | #!/usr/bin/env python3
# Copyright (c) 2017 AT&T Intellectual Property. 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.703125 | 3 |
src/rez/command.py | alexey-pelykh/rez | 0 | 12795282 | # SPDX-License-Identifier: Apache-2.0
# Copyright Contributors to the Rez Project
from rez.config import config
class Command(object):
"""An interface for registering custom Rez subcommand
To register plugin and expose subcommand, the plugin module..
* MUST have a module-level docstring (used as the c... | 2.546875 | 3 |
src/streetool/classifications.py | actionprojecteu/action-tool | 0 | 12795283 | # -*- coding: utf-8 -*-
# ----------------------------------------------------------------------
# Copyright (c) 2021
#
# See the LICENSE file for details
# see the AUTHORS file for authors
# ----------------------------------------------------------------------
#--------------------
# System wide imports
# ----------... | 2.125 | 2 |
kerasAC/interpret/form_modisco_inputs.py | kundajelab/kerasAC | 6 | 12795284 | import argparse
import math
import pysam
import shap
import tensorflow
from deeplift.dinuc_shuffle import dinuc_shuffle
from scipy.spatial.distance import jensenshannon
from scipy.special import logit, softmax
tensorflow.compat.v1.disable_v2_behavior()
import kerasAC
import matplotlib
import pandas as pd
from keras... | 1.851563 | 2 |
wd_cw05/wd_cw05_zadanie_2.py | pawel2706111/wizualizacja-danych | 0 | 12795285 | # Przeciąż metodę __add__() dla klasy Kwadrat,
# która będzie zwracała instancje klasy Kwadrat o nowym boku,
# będącym sumą boków dodawanych do siebie kwadratów.
class Ksztalty:
def __init__(self, x, y):
self.x=x
self.y=y
self.opis = "To będzie klasa dla ogólnych kształtów"
... | 4.0625 | 4 |
cpmpy/ski_assignment.py | tias/hakank | 279 | 12795286 | <gh_stars>100-1000
"""
Ski assignment in cpmpy
From <NAME>, Jr.:
PIC 60, Fall 2008 Final Review, December 12, 2008
http://www.math.ucla.edu/~jhellrun/course_files/Fall%25202008/PIC%252060%2520-%2520Data%2520Structures%2520and%2520Algorithms/final_review.pdf
'''
5. Ski Optimization! Your job at Snapple is pleasant bu... | 3.265625 | 3 |
maya/maximumreplacer/maximumreplacer.py | KasumiL5x/misc-scripts | 0 | 12795287 | #
# Maximum Replacer
# <NAME>, 2019
# GitHub: KasumiL5x
import re
import PySide2.QtCore as QC
import PySide2.QtGui as QG
import PySide2.QtWidgets as QW
import shiboken2
import maya.cmds as mc
import maya.mel as mel
import maya.OpenMayaUI as omui
def get_maya_window():
ptr = omui.MQtUtil.mainWindow()
... | 2.078125 | 2 |
poradnia/advicer/migrations/0017_auto_20190404_0337.py | efefre/poradnia | 23 | 12795288 | # Generated by Django 1.11.13 on 2019-04-04 01:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("advicer", "0016_auto_20190404_0320")]
operations = [
migrations.AlterField(
model_name="advice",
name="subject",
fie... | 1.421875 | 1 |
python/GV.py | lehaianh3112/ProjectLeHaiAnh | 2 | 12795289 | from __future__ import division, print_function, unicode_literals
import streamlit as st
from sklearn.metrics import mean_squared_error, r2_score
from sklearn.model_selection import train_test_split
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
st.title('Mô hình dự đoán giá nhà đất tại hồ gươm... | 2.640625 | 3 |
tests/test_toBig.py | andreacosolo/granite | 3 | 12795290 | #################################################################
# Libraries
#################################################################
import sys, os
import pytest
import bitarray
from granite.toBig import (
main as main_toBig
)
from granite.lib.shared_... | 1.875 | 2 |
src/melissa/__init__.py | aleksandrgordienko/melissa-quiz | 0 | 12795291 | <reponame>aleksandrgordienko/melissa-quiz<gh_stars>0
from melissa.melissa import Melissa
| 0.945313 | 1 |
Lecture_notes/数据提取与验证码的识别(下)/code/lol_test.py | littleturings/2021PythonWebCrawler | 1 | 12795292 | <reponame>littleturings/2021PythonWebCrawler
from selenium import webdriver
from time import sleep
driver = webdriver.Chrome()
driver.get("https://www.huya.com/g/lol")
while True:
names = driver.find_elements_by_class_name("nick")
counts = driver.find_elements_by_class_name("js-num")
for name, count in zi... | 3.15625 | 3 |
notas/urls.py | shiminasai/cafodca | 0 | 12795293 | from django.conf.urls import url
from django.views.generic import ListView, DetailView
from models import Notas
from .views import *
urlpatterns = [
url(r'^$', list_notas,name='notas_list'),
# url(r'^$', 'lista_notas', name="notas_list"),
url(r'^pais/(?P<id>\d+)/$', lista_notas_pais, name="notas_list_pais"... | 1.992188 | 2 |
dev/tools/leveleditor/direct/directbase/DirectStart.py | CrankySupertoon01/Toontown-2 | 1 | 12795294 | <gh_stars>1-10
# This is a hack fix to get the graphics pipes to load with my
# hacked up Panda3D. If you want to load the level editor
# using DirectX 8 or DirectX 9, uncomment the import for the
# pipe you want to use. Make sure the pipe you want to load
# first is imported first.
# DirectX 9
#try:
# import libpa... | 1.804688 | 2 |
python/terminal/question.py | VEXG/experimental | 1 | 12795295 | get_nama = input('Masukan nama : ')
try:
get_umur = int(input('Masukan umur : '))
except Exception as e:
print('Harus pakek angka ya')
else:
print(f'Halo {get_nama.capitalize()}!')
print(f'Umur kamu {str(get_umur)}')
| 3.546875 | 4 |
loopChat.py | ThePenultimatum/transformer | 0 | 12795296 | # -*- coding: utf-8 -*-
#/usr/bin/python2
'''
June 2017 by <NAME>.
<EMAIL>.
https://www.github.com/kyubyong/transformer
'''
from __future__ import print_function
import codecs
import os
import tensorflow as tf
import numpy as np
from hyperparams import Hyperparams as hp
from data_load import load_test_data, load_de... | 2.453125 | 2 |
minik/models.py | bafio/minik | 86 | 12795297 | <filename>minik/models.py
import json
from minik.status_codes import codes
class MinikRequest:
"""
Simple wrapper of the data object received from API Gateway. This object will
parse a given API gateway event and it will transform it into a more user
friendly object to operate on. The idea is that a v... | 2.5 | 2 |
manage.py | DzoanaZ/Aplikacje-internetowe2 | 0 | 12795298 | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "forecastsite.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
try:
import django
except ImportError:
... | 1.359375 | 1 |
No_0171_Excel Sheet Column Number/excel_sheet_column_number_by_recursion.py | coderMaruf/leetcode-1 | 32 | 12795299 | '''
Description:
Given a column title as appear in an Excel sheet, return its corresponding column number.
For example:
A -> 1
B -> 2
C -> 3
...
Z -> 26
AA -> 27
AB -> 28
...
Example 1:
Input: "A"
Output: 1
Example 2:
Input: "AB"
Output: 28
Example 3:
Input: "ZY"
Output: 701
'''... | 3.765625 | 4 |
utils/criterion.py | zjunlp/SemEval2021Task4 | 8 | 12795300 | import torch.nn as nn
import torch
class LabelSmoothing(nn.Module):
def __init__(self, size, smoothing=0.0):
super(LabelSmoothing, self).__init__()
self.criterion = nn.KLDivLoss(size_average=False)
#self.padding_idx = padding_idx
self.confidence = 1.0 - smoothing
self.smoothi... | 2.90625 | 3 |
studzie/keras_gym/mountain_car_v0.py | amozie/amozie | 0 | 12795301 | <filename>studzie/keras_gym/mountain_car_v0.py
import numpy as np
import matplotlib.pyplot as plt
import gym
import time
import copy
from keras.models import Sequential, Model
from keras.layers import Dense, Activation, Flatten, Lambda, Input, Reshape, concatenate, Merge
from keras.optimizers import Adam, RMSprop
fro... | 2.46875 | 2 |
PGMF/script/focaljunction.py | haiwangyang/PGMF | 0 | 12795302 | <reponame>haiwangyang/PGMF<gh_stars>0
#!/usr/bin/env python
"""
Purpose:
Handling normalized read count of genes
"""
import focalannotation
import focalgene
import sharedinfo
import pandas as pd
from sharedinfo import exist_file, get_lines
def get_junction_of_species_by_partiallocation(species, partiallocation):... | 2.375 | 2 |
comb_spec_searcher/tree_searcher.py | odinn13/comb_spec_searcher-1 | 0 | 12795303 | <reponame>odinn13/comb_spec_searcher-1
"""
Finds and returns a combinatorial specification, that we call a proof tree.
"""
import time
from collections import defaultdict, deque
from copy import deepcopy
from itertools import chain, product
from random import choice, shuffle
from typing import Dict, FrozenSet, Iterator... | 2.71875 | 3 |
openbabel-2.4.1/scripts/python/setup.py | sxhexe/reaction-route-search | 1 | 12795304 | <gh_stars>1-10
#!/usr/bin/env python
import os
import subprocess
import sys
from distutils.command.build import build
from distutils.command.sdist import sdist
from distutils.errors import DistutilsExecError
from distutils.version import StrictVersion
from setuptools.command.build_ext import build_ext
from setuptools.c... | 1.835938 | 2 |
tests/scheme/test_stochastic.py | olivierverdier/odelab | 15 | 12795305 | # -*- coding: utf-8 -*-
from __future__ import division
import unittest
import odelab
from odelab.scheme.stochastic import *
from odelab.system import *
from odelab.solver import *
import numpy as np
class Test_OU(unittest.TestCase):
def test_run(self):
sys = OrnsteinUhlenbeck()
scheme = EulerMaruyama()
sc... | 2.625 | 3 |
src/polybius.py | nicholasz2510/Polybius | 1 | 12795306 | <reponame>nicholasz2510/Polybius<filename>src/polybius.py
import asyncio
import discord
from discord.ext import commands
import json
import math
import datetime
import os
import random
trivia_answers = [":regional_indicator_a:", ":regional_indicator_b:", ":regional_indicator_c:", ":regional_indicator_d:"]
unicode_max_... | 2.6875 | 3 |
pnno/engine/processor.py | zjykzj/pnno | 3 | 12795307 | # -*- coding: utf-8 -*-
"""
@date: 2020/7/14 下午8:34
@file: processor.py
@author: zj
@description:
"""
from ..anno import build_anno
from ..util.logger import setup_logger
class Processor(object):
"""
The labeled data is processed to create training data with specified format
"""
def __init__(self,... | 2.515625 | 3 |
800/11_05_2021/236A.py | hieuptch2012001/Python_codeforces | 0 | 12795308 | def main():
a = input()
set_a = set(a)
if len(set_a) % 2 == 0:
print('CHAT WITH HER!')
else:
print('IGNORE HIM!')
if __name__ == "__main__":
main()
| 3.515625 | 4 |
plugins/supervisor/__init__.py | ajenti/ajen | 3,777 | 12795309 | <gh_stars>1000+
# pyflakes: disable-all
from .api import *
from .aug import *
from .main import *
| 1.078125 | 1 |
src/apps/core/admin_actions.py | crivet/HydroLearn | 0 | 12795310 |
# potentially not, may be better to use 'ModelAdmin' methods
# 'https://docs.djangoproject.com/en/2.0/ref/contrib/admin/actions/#advanced-action-techniques'
#
# def delete_with_placeholders(modeladmin, request, queryset):
# for obj in queryset:
# obj.delete()
#
#
# delete_with_placeholders.short_descriptio... | 1.90625 | 2 |
tests/seahub/utils/test_get_conf_test_ext.py | jjzhang166/seahub | 0 | 12795311 | <gh_stars>0
from constance import config
from django.conf import settings
from seahub.utils import get_conf_text_ext
from seahub.test_utils import BaseTestCase
class GetConfTextExtTest(BaseTestCase):
def setUp(self):
self.clear_cache()
def tearDown(self):
self.clear_cache()
def test_get... | 1.820313 | 2 |
ch5/op_test.py | oysstu/pyopencl-in-action | 21 | 12795312 | '''
Listing 5.1: Operator usage (and vector usage)
'''
import pyopencl as cl
import pyopencl.array
import utility
kernel_src = '''
__kernel void op_test(__global int4 *output) {
int4 vec = (int4)(1, 2, 3, 4);
/* Adds 4 to every element of vec */
vec += 4;
/* Sets the third element to 0
Doesn't cha... | 2.765625 | 3 |
regulator.py | Jerry-Terrasse/LlfSystem | 6 | 12795313 | import time
from surgeon import *
ori_time=int()
cur_time=int()
pre_time=int()
waves=int()
double_water=False
AUTO=False
def fight_start():
global ori_time,started,double_water,pre_time
ori_time=time.time()
pre_time=0
started=True
double_water=False
def fight_end():
global started
print... | 2.90625 | 3 |
src/day17.py | nlasheras/aoc-2021 | 0 | 12795314 | """ https://adventofcode.com/2021/day/17 """
import re
import math
from typing import Tuple
class Rect:
"""A 2D rectangle defined by top-left and bottom-right positions"""
def __init__(self, left, right, bottom, top):
self.left = left
self.right = right
self.bottom = bottom
sel... | 4.25 | 4 |
ehelp/application/urls.py | Taimur-DevOps/ehelp_fyp | 7 | 12795315 | <filename>ehelp/application/urls.py
from django.urls import path, include
from django.conf.urls import url
from .views import (
view_dashboard,
view_home,
view_queue,
view_privacy,
view_requests,
view_responses,
view_login,
view_logout,
view_signup,
view_activate,
view_profil... | 1.96875 | 2 |
awx/main/migrations/_rbac.py | Avinesh/awx | 1 | 12795316 | <reponame>Avinesh/awx
import logging
from time import time
from awx.main.models.rbac import Role, batch_role_ancestor_rebuilding
logger = logging.getLogger('rbac_migrations')
def create_roles(apps, schema_editor):
'''
Implicit role creation happens in our post_save hook for all of our
resources. Here we... | 2.21875 | 2 |
tests/test_contrast.py | bunkahle/PILasOPENCV | 19 | 12795317 | <filename>tests/test_contrast.py<gh_stars>10-100
# from PIL import Image, ImageEnhance
import PILasOPENCV as Image
import PILasOPENCV as ImageEnhance
img = Image.open('lena.jpg')
#
enhancer = ImageEnhance.Contrast(img)
enhancer.enhance(0.0).save(
"ImageEnhance_Contrast_000.jpg")
enhancer.enhance(0.25).sav... | 2.671875 | 3 |
TEP-IFPI-2017_8-master/django-api-atv1-master/app/settings.py | danieldsf/ads-activities | 1 | 12795318 | <reponame>danieldsf/ads-activities
import os, raven, logging
from unipath import Path
from decouple import config
BASE_DIR = Path(__file__).parent
PROJECT_DIR = BASE_DIR.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/
# SEC... | 1.882813 | 2 |
python/vsi/utils/image_iterators.py | cabdiweli1/vsi_common | 7 | 12795319 | import numpy as np
from collections import namedtuple
import skimage.measure
#import matplotlib.pyplot as plt
#import ipdb
# could maybe turn this into a generic mutable namedtuple
class Point2D(object):
__slots__ = "x", "y"
def __init__(self, x, y):
self.x = x
self.y = y
def __iter__(self):
'''itera... | 2.65625 | 3 |
lib/firmware/ap_firmware_config/grunt.py | khromiumos/chromiumos-chromite | 0 | 12795320 | # -*- coding: utf-8 -*-
# Copyright 2019 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Grunt configs."""
from __future__ import print_function
def is_fast_required(use_futility, servo):
"""Returns true if --fa... | 2.234375 | 2 |
foundation/organisation/migrations/0001_initial.py | Mindelirium/foundation | 0 | 12795321 | <reponame>Mindelirium/foundation
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Person'
db.create_table(... | 2.171875 | 2 |
make_validation_set.py | lelloman/python-languagedetector | 0 | 12795322 | from common import *
from os.path import join as join_path, isdir
from shutil import rmtree
from os import mkdir
import feedparser
from bs4 import BeautifulSoup as bs
languages_names = [x['name'] for x in languages]
rss_sources = {
'da': [
'https://politiken.dk/rss/senestenyt.rss',
'https://borsen... | 2.484375 | 2 |
train.py | liujiachang/Graph-WaveNet | 0 | 12795323 | <reponame>liujiachang/Graph-WaveNet
import torch
import numpy as np
import argparse
import time
import util
import matplotlib.pyplot as plt
from engine import trainer
parser = argparse.ArgumentParser()
parser.add_argument('--device', type=str, default='cuda:0', help='')
parser.add_argument('--data', type=str, default=... | 2.109375 | 2 |
modules/tankshapes/base.py | bullseyestudio/guns-game | 0 | 12795324 | <filename>modules/tankshapes/base.py
""" Base tank shape -- all other shapes derive from this
Minimal requirements:
- typeID
- position (relative to tank origin)
- size (fixed for most shapes)
- layer (fixed for most shapes)
- anchor rectangle (what portion of the shape must be supported by the lower layer;
most shap... | 3.25 | 3 |
news/migrations/0001_initial.py | SIBSIND/PHPMYADMINWEBSITE | 31 | 12795325 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import markupfield.fields
import django.utils.timezone
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODE... | 1.992188 | 2 |
chapters/10/src/biglittle/domain/loan.py | PacktPublishing/-Learn-MongoDB-4.0 | 13 | 12795326 | <reponame>PacktPublishing/-Learn-MongoDB-4.0
"""
biglittle.domain.loan
Description: module which interacts with the "loans" collection
"""
import pymongo
import decimal
from config.config import Config
from pymongo.cursor import CursorType
from decimal import Decimal
from bson.decimal128 import Decimal128
from utils.u... | 2.6875 | 3 |
examples/retrieve_folders.py | swimlane/python-office365 | 21 | 12795327 | <reponame>swimlane/python-office365<filename>examples/retrieve_folders.py
from office365api import Mail
from dotenv import load_dotenv
from os.path import join, dirname, normpath
from os import environ
dot_env_path = normpath(join(dirname(__file__), '../', '.env'))
load_dotenv(dot_env_path)
def simplest(auth):
m... | 3.015625 | 3 |
ExtractionModule/fileStructureIdentifier.py | k41nt/ECEN403-ML-for-Data-Organization | 0 | 12795328 | """
Title:: File Structure Identifier
Brief:: Implementation of the program that trains the model for identifying a known set of document classes
Author:: <NAME>
Date:: 04/02/2019
""" | 0.648438 | 1 |
notice.py | rookiesmile/yibanAutoSgin | 24 | 12795329 | # -*- coding: utf-8 -*-
"""
@Time : 2021/8/24 13:00
@Auth : apecode
@File :notice.py
@IDE :PyCharm
@Blog:https://liiuyangxiong.cn
"""
import json
import time
from email.mime.text import MIMEText
from email.header import Header
from smtplib import SMTP_SSL
import requests
import config
class Notic... | 2.796875 | 3 |
app/storage/storage_encryption.py | pricem14pc/eq-questionnaire-runner | 0 | 12795330 | <gh_stars>0
import hashlib
from typing import Optional, Union
from jwcrypto import jwe, jwk
from jwcrypto.common import base64url_encode
from structlog import get_logger
from app.utilities.json import json_dumps
from app.utilities.strings import to_bytes, to_str
logger = get_logger()
class StorageEncryption:
d... | 2.375 | 2 |
models/__init__.py | bdbaraban/mlb_tweets | 1 | 12795331 | <gh_stars>1-10
import json
from models.league import League
from models.standings import Standings
league = League()
league.reload()
standings = Standings()
standings.reload()
| 1.679688 | 2 |
aries_cloudagent/did/tests/test_did_key_bls12381g1.py | kuraakhilesh8230/aries-cloudagent-python | 247 | 12795332 | from unittest import TestCase
from ...wallet.key_type import KeyType
from ...wallet.util import b58_to_bytes
from ..did_key import DIDKey, DID_KEY_RESOLVERS
from .test_dids import (
DID_B<KEY>,
)
TEST_BLS12381G1_BASE58_KEY = (
"<KEY>"
)
TEST_BLS12381G1_FINGERPRINT = (
"<KEY>"
)
TEST_BLS12381G1_DID = f"di... | 2.390625 | 2 |
tests/test_executable.py | cirosantilli/python-utils | 1 | 12795333 | #!/usr/bin/env python
"""
this calls test_executable_caller as it should be called for the test to work.
"""
import subprocess
if __name__ == '__main__':
process = subprocess.Popen(
['python', 'test_executable_caller.py','test_executable_callee.py'],
shell = False,
universal_newlines = T... | 2.21875 | 2 |
quiz/tests/test_models.py | Palombredun/django_quiz | 0 | 12795334 | import datetime
from django.contrib.auth.models import User
from quiz.models import (
AnswerUser,
Category,
Grade,
Question,
QuestionScore,
Quiz,
Statistic,
SubCategory,
ThemeScore,
)
import pytest
### FIXTURES ###
@pytest.fixture
def category_m(db):
return Category.object... | 2.203125 | 2 |
ex_017.py | antonioravila/Exercicios-CEV-Python | 0 | 12795335 | '''
#Método 1 de calcular a hipotenusa (sem o módulo math)
co = float(input('comprimento do cateto oposto: '))
ca = float(input('comprimento do cateto adjacente: '))
h = (co ** 2) + (ca ** 2) ** (1/2)
print(f'a hipotenusa equivale a {h:.2f}')
'''
# Método 2 de calcular a hipotenusa (com o módulo math)
import math
c... | 3.9375 | 4 |
src/backend/data/bofa.py | akmadian/openfinance | 1 | 12795336 | import csv
import json
from ofxtools.Parser import OFXTree
"""
statement schema:
{
"id":int,
"ref_no": int,
"date": string,
"account": int, account code,
"isincome": bool,
"countinbudget": bool,
"payee": string,
"notes": {
"bank": string,
"personal": string
},
"categories": [strings],
"t... | 2.75 | 3 |
code_transformer/configuration/great_transformer.py | SpirinEgor/code-transformer | 0 | 12795337 | <gh_stars>0
from code_transformer.configuration.configuration_utils import ModelConfiguration
class GreatTransformerConfig(ModelConfiguration):
def __init__(
self,
num_layers: int,
positional_encoding=None,
embed_dim=256,
num_heads=8,
ff_dim=1024,
dropout_ra... | 2.015625 | 2 |
adminmgr/testmgr/testoutput.py | IamMayankThakur/test-bigdata | 9 | 12795338 | <reponame>IamMayankThakur/test-bigdata<filename>adminmgr/testmgr/testoutput.py
import os
from hdfs import InsecureClient
from .config import *
def test_task_3(output_paths):
if(output_paths[0] == None):
return [0]
path_to_correct_output_1 = os.path.join(SETTERS_OUTPUT_BASE_PATH,
... | 2.28125 | 2 |
setup.py | kipparker/django-trello-webhooks | 11 | 12795339 | import os
from setuptools import setup
README = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name="django-trello-webhooks",
version="0.3",
packages=[
... | 1.242188 | 1 |
examples/lightfm_recs.py | ankane/pgvector-python | 10 | 12795340 | from lightfm import LightFM
from lightfm.datasets import fetch_movielens
from pgvector.sqlalchemy import Vector
from sqlalchemy import create_engine, text, Column, Float, Integer, String
from sqlalchemy.orm import declarative_base, Session
engine = create_engine('postgresql+psycopg2://localhost/pgvector_example', futu... | 2.390625 | 2 |
src/SimpleSchemaGenerator/Plugins/PicklePlugin.py | davidbrownell/Common_SimpleSchemaGenerator | 0 | 12795341 | <filename>src/SimpleSchemaGenerator/Plugins/PicklePlugin.py
# ----------------------------------------------------------------------
# |
# | PicklePlugin.py
# |
# | <NAME> <<EMAIL>>
# | 2020-07-24 15:08:32
# |
# ----------------------------------------------------------------------
# |
# | Copyright <N... | 1.984375 | 2 |
2019/Lecture02/02Examples/Lecture02_Profiling02.py | cbchoi/SIT32004 | 1 | 12795342 | <gh_stars>1-10
# calculate 10!
import time
from functools import wraps
def timefn(fn):
@wraps(fn)
def measure_time(*args, **kwargs):
t1 = time.perf_counter()
result = fn(*args, **kwargs)
t2 = time.perf_counter()
print("@timefn: {} took {} seconds".format(fn.__name__, t2 - t1))
... | 3.28125 | 3 |
catkin_ws/build/simple_applications/cmake/simple_applications-genmsg-context.py | a-yildiz/ROS-Simple-Sample-Packages | 1 | 12795343 | <filename>catkin_ws/build/simple_applications/cmake/simple_applications-genmsg-context.py
# generated from genmsg/cmake/pkg-genmsg.context.in
messages_str = "/home/yildiz/GitRepos/ROS_Samples/catkin_ws/src/simple_applications/msg/Distance.msg"
services_str = "/home/yildiz/GitRepos/ROS_Samples/catkin_ws/src/simple_appl... | 1.179688 | 1 |
tail.py | doctoryes/python-morsels | 0 | 12795344 |
def tail(things, num_items):
if num_items <= 0:
return []
x = list(things)
return [i for i in x[max(len(x)-num_items, 0):]]
| 3.5625 | 4 |
xarray/tests/test_tutorial.py | apkrelling/xarray | 0 | 12795345 | <reponame>apkrelling/xarray
import os
import pytest
from xarray import DataArray, tutorial
from . import assert_identical, network
@network
class TestLoadDataset:
@pytest.fixture(autouse=True)
def setUp(self):
self.testfile = "tiny"
def test_download_from_github(self, tmp_path, monkeypatch):
... | 2.1875 | 2 |
qb_to_dynaboard.py | Pinafore/qb | 122 | 12795346 | <gh_stars>100-1000
import argparse
import json
from pathlib import Path
DS_VERSION = "2018.04.18"
LOCAL_QANTA_PREFIX = "data/external/datasets/"
QANTA_TRAIN_DATASET_PATH = f"qanta.train.{DS_VERSION}.json"
QANTA_DEV_DATASET_PATH = f"qanta.dev.{DS_VERSION}.json"
QANTA_TEST_DATASET_PATH = f"qanta.test.{DS_VERSION}.json"
... | 2.421875 | 2 |
CodeUp/1546.py | chae-heechan/Algorithm_Study | 0 | 12795347 | # 함수로 plus/minus/0 판별하기
def f(key):
if key>0:
print("plus")
elif key==0:
print("zero")
else:
print("minus")
f(int(input())) | 3.890625 | 4 |
Python/PythonExercicios/ex014.py | isabellathome/College-Activities | 0 | 12795348 | <reponame>isabellathome/College-Activities
celsius = float(input('Informe a temperatura em graus ºC: '))
fah = ((celsius * 9) / 5) + 32
print('A temperatura de {}ºC corresponde a {}ºF'.format(celsius, fah))
| 3.84375 | 4 |
ecorelevesensor/models/animal.py | NaturalSolutions/ecoReleve-Server | 0 | 12795349 | <filename>ecorelevesensor/models/animal.py
from sqlalchemy import (
Column,
Index,
Integer,
Sequence,
String,
)
from ecorelevesensor.models import Base
class Animal(Base):
#TODO: Ajouter un autoincrément à la fin d'eRelevé
__tablename__ = 'T_Animal'
id = Column('PK_id', Integer, primary_ke... | 2.40625 | 2 |
billforward/apis/profiles_api.py | billforward/bf-python | 2 | 12795350 | # coding: utf-8
"""
BillForward REST API
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
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... | 1.65625 | 2 |