blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
c4f7310327802e48a4ae8130e1f074c7a78cfa75 | Python | p2pu/learning-circles | /places/management/commands/import_us_cities.py | UTF-8 | 2,633 | 2.515625 | 3 | [
"MIT"
] | permissive | from django.core.management.base import BaseCommand, CommandError
from django.db.models import Q
from studygroups.models import StudyGroup
from places.models import City
from places.data import get_countries
from places.data import read_cities
from places.data import read_admin1_codes
from places.data import get_alter... | true |
5b67dd2d83665418cc6e3005e8ec84dabc09ef21 | Python | tukor11/TASK_3 | /sum_of_numbers.py | UTF-8 | 272 | 4.03125 | 4 | [] | no_license | print("Enter first integer")
first = input(">")
print("Enter second integer")
second = input(">")
try:
total = int(first) + int(second)
if total in range(15, 20):
total = 20
print("Sum is ",total)
except:
print("wrong integer value!")
| true |
04c1edf17b323748842042d09ebb6fdb952485c3 | Python | daniel-reich/ubiquitous-fiesta | /Q7oecYfjkq7tHwPoA_3.py | UTF-8 | 501 | 3.4375 | 3 | [] | no_license |
import math
def climb(stamina, obstacles):
cnt = 1
for i in range(1, len(obstacles)):
diff = obstacles[i] - obstacles[i-1]
if diff > 0:
# climbing up:
d = math.ceil(diff)
stamina -= 2 * d
elif diff < 0:
# climbing down
d = -m... | true |
9c1fcf37a2b90a3a2907ab7308f1ab6c7cc45fe0 | Python | 553302670/assistant_of_world_of_warships | /getKey.py | UTF-8 | 381 | 2.9375 | 3 | [] | no_license | import win32api as wapi
'''
keyCheck函数返回从上次调用到这次调用间输入的按键
'''
keyList = ["\b"]
for char in "ABCDEFGHIJKLMNOPQRSTUVWXYZ 123456789":
keyList.append(char)
def keyCheck():
keys = []
for key in keyList:
if wapi.GetAsyncKeyState(ord(key)):
keys.append(key)
return keys
if __name__ == "_... | true |
e3f601d028b36fa3e6e8cd019f5b3ab745ce79a8 | Python | nildanil/Final_BioBootCamp | /filter.py | UTF-8 | 1,391 | 3.296875 | 3 | [] | no_license | import pandas as pd
num_of_rank = float(input("Введите рамку на rank(>): "))
num_of_score = float(input("Введите рамку на score(<): "))
file_name = (input("Введите имя файла, в котором будет список эпитопов: ") +'.fasta')
dir_name = input('Укажите папку с данными: ')
a = int(input('Введите цифру на первом файле с ре... | true |
7f41a2c4ae511a47df9720fb89b13396c2d1e443 | Python | yoavhenig/AutonomicRobotics | /BeresheetSimulator/beresheet.py | UTF-8 | 3,428 | 3.109375 | 3 | [] | no_license | import math
import matplotlib.pyplot as plt
# Moon variables
MOON_RADIUS = 3475 * 1000 # meters
MOON_ACC = 1.622 # m / s ^ 2
EQ_SPEED = 1700 # m / s
WEIGHT_EMP = 165 # kg
WEIGHT_FULE = 420 # kg
WEIGHT_FULL = WEIGHT_EMP + WEIGHT_FULE # kg
MAIN_ENG_F = 430 # N
SECOND_ENG_F = 25 # N
MAIN_BURN = 0.15 ... | true |
bd174fa75127867a0e624b0e97f35698361e0000 | Python | svenstaro/flamejam | /flamejam/models/gamepackage.py | UTF-8 | 3,099 | 2.515625 | 3 | [
"Zlib"
] | permissive | from flamejam import db
from flask import Markup
PACKAGE_TYPES = {
"web": ("Web link (Flash etc.)", "Web"),
"linux": ("Binaries: Linux 32/64-bit", "Linux"),
"linux32": ("Binaries: Linux 32-bit", "Linux32"),
"linux64": ("Binaries: Linux 64-bit", "Linux64"),
"windows": ... | true |
1f1779a7b44a0ac0d9b474a68953b8bd7e611dab | Python | Jagermeister/codejam-template | /search/base.py | UTF-8 | 610 | 3.6875 | 4 | [] | no_license |
class Node:
def __init__(self, v):
self.value = v
def children(self):
return []
def generate_graph():
value = 1
root = Node(value)
return root
def breadth_first_search(root, goal):
# Explore siblings before children.
to_do = [[root]]
while to_do:
path = to_... | true |
73f7316f33725ccad0b2e307466227c0aab7339e | Python | lukaw3d/resolwe-bio | /resolwe_bio/tools/parse_encoding_type.py | UTF-8 | 458 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
import argparse
parser=argparse.ArgumentParser(description='Parse encoding type.')
parser.add_argument('report_file', help='FastQC report file')
args=parser.parse_args()
encoding=''
with open(args.report_file) as report:
for line in report:
if line.startswith('Encoding'):
... | true |
fe3d6fffd3f321d946c4f4e9d2612d445a3ab08b | Python | ivelinakaraivanova/SoftUniPythonFundamentals | /src/Functions_Exercise/01_Smallest_of_Three_Numbers.py | UTF-8 | 299 | 3.390625 | 3 | [] | no_license | first_number = int(input())
second_number = int(input())
third_number = int(input())
def find_the_smallest(a, b, c):
if a < b and a < c:
return a
elif b < a and b < c:
return b
else:
return c
print(find_the_smallest(first_number, second_number, third_number)) | true |
f550f29b8e3364d74f82db03bb9c34d841c81b05 | Python | PedroRamos360/PythonCourseUdemy | /kivy/aulas/Seção 24 - Kivy Language/Prática/0002 - KV vs Python - Kivy/main.py | UTF-8 | 666 | 2.765625 | 3 | [] | no_license | import kivy
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
kivy.require('1.9.1')
class Tela1(BoxLayout):
@staticmethod
def on_press_bt():
janela.root_window.remove_widget(janela.root)
janela.root_window.add_widget(Tela2())
class Tela2(BoxLayout):
@staticmethod
def on_press_bt():
janela... | true |
ebfbf19d208e86a1bf4c86ac60af02931dce1fb9 | Python | cissagatto/Trabalho3_AP | /Trabalho3.py | UTF-8 | 3,693 | 2.65625 | 3 | [] | no_license | import collections
from sklearn import tree
from sklearn.model_selection import cross_validate
from sklearn.neighbors import KNeighborsClassifier
from sklearn.neural_network import MLPClassifier
from sklearn.preprocessing import MinMaxScaler
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import... | true |
029ecc42ee677a9a13f4f45ef26694dafac64c67 | Python | karlicoss/pinbexport | /src/pinbexport/dal.py | UTF-8 | 2,385 | 2.625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
from typing import NamedTuple, Optional, Sequence, Iterator, Set, Iterable
from pathlib import Path
import json
from datetime import datetime
import logging
import pytz
from .exporthelpers.dal_helper import PathIsh, Json
from typing import NewType
Url = NewType('Url', str)
Tag = str
# todo... | true |
b4f940e3ab5a17481c8cb192e332f58e0f0d1eed | Python | fabriciolelis/python_studying | /coursera/USP/course_1/week6/hipotenusa.py | UTF-8 | 687 | 3.53125 | 4 | [] | no_license | import math
def soma_hipotenusas(n):
soma_hipotenusa = 0
hipotenusa = 1
while hipotenusa <= n:
if éHipotenusa(hipotenusa):
soma_hipotenusa = soma_hipotenusa + hipotenusa
hipotenusa = hipotenusa + 1
else:
hipotenusa = hipotenusa +1
return soma_hipotenusa
def éHipotenusa(x):
cateto1 = 1
cateto2 = 1
w... | true |
2a79af3fd2ed06886bd15cfdd8532ada244548ca | Python | jpgsaraceni/python | /básico/dados primitivos/string.py | UTF-8 | 1,445 | 4.46875 | 4 | [] | no_license | # str ou string é um texto dentro de aspas, simples ou duplas.
"""
por ser uma linguagem de tipagem dinâmica, o python
entende que o que está dentro de aspas é uma string.
"""
# barra invertida é caractere de escape
# faz o programa ignorar o próximo caractere.
print('Hello \'mandafaca\'')
# \n quebra a linha.
# r dent... | true |
79c2eec74474de9f10c236fe2f018f84e7a123df | Python | will-henney/proplyd-cloudy | /emission/moments_cube.py | UTF-8 | 3,031 | 2.671875 | 3 | [] | no_license | import pyfits
import glob
import numpy as np
import argparse
# Parse command line arguments
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
description="""
Calculate velocity moments of PPV cubes
""")
parser.add_argument(
"--suffix", type=str, default="nphi400... | true |
fcf091727a9a1575fb23cc854052cdfd2e92ca72 | Python | metinsuloglu/CA-Flow-from-Shape | /deepsphere_model/deepsphere/utils/metrics.py | UTF-8 | 1,633 | 2.828125 | 3 | [
"MIT"
] | permissive | import numpy as np
from scipy.stats import pearsonr
from sklearn.metrics import mean_absolute_error, mean_squared_error
# Mean absolute error
def mae(y_pred, y, mask=None, device=None):
try:
y_pred, y = y_pred.numpy().squeeze(), y.numpy().squeeze()
except TypeError:
y_pred, y, mask = y_pred.cpu().n... | true |
96fc89d4a93cce6a432fa61f8f73cd65c3d5a157 | Python | artvvb/pysdl_stuff | /sprite_system.py | UTF-8 | 5,044 | 2.625 | 3 | [] | no_license | import sdl2
import sdl2.ext
from manager import Resources
from constants import TILE_SIZE, TILE_MAX_WEIGHT
class SurfaceFactory:
def __init__(self):
pass
def from_image(self, filename):
return sdl2.ext.load_image(Resources.get(filename))
class SpriteFactory:
def __init__(self, scene):
self.sprite_system = sc... | true |
fc6b545ebfad93543f929c42269c6566feb2d272 | Python | rykachevskiy/CRISPR_assembler | /src/crispr_assembler/assemblers/arrays_class.py | UTF-8 | 1,240 | 2.609375 | 3 | [] | no_license | from crispr_assembler.utils.utils import transform_spacer_to_id, dict_from_csv, unwrap_nested
from crispr_assembler.utils.misc import rc
class Arrays:
def __init__(self, arrays_path, spacer_to_id_path, add_rc=0):
self.spacer_to_id = dict_from_csv(spacer_to_id_path)
self.arrays_as_dictionary = self.... | true |
8e50b54c3e4b8309caee5e52273f4663dc992ee9 | Python | SyrekGMR/CNN-Backtracking-Sudoku-Solver | /Backtracking.py | UTF-8 | 1,973 | 3.9375 | 4 | [] | no_license | import math
# Solver Backtracking Code
# Check if any subgrids are empty in need of filling.
# Update track parameter to the next empty subgrid.
def check_empty(arr, track):
for i in range(9):
for j in range(9):
if arr[i, j] == 0:
track[0] = i
track... | true |
02550086c5ee766e30a9bc0377281dbbcf4d12cb | Python | BrunoScaglione/Willump | /willump/graph/willump_graph.py | UTF-8 | 1,265 | 3.28125 | 3 | [
"MIT"
] | permissive | from willump.graph.willump_graph_node import WillumpGraphNode
from typing import List, Set
class WillumpGraph(object):
"""
A Willump Graph. Each graph represents a featurization pipeline.
"""
output_node: WillumpGraphNode
def __init__(self,
output_node: WillumpGraphNode) -> None... | true |
9fae22bebf93b03688e41589bb45b6f6f7447836 | Python | chankane/pyind | /pyind/crossover.py | UTF-8 | 2,670 | 3.046875 | 3 | [
"MIT"
] | permissive | import numpy as np
def p2(ind0, ind1):
"""
Two-point crossover
Parameters
----------
ind0 : ndarray
Father
ind1 : ndarray
Mother
Returns
-------
chil : ndarray
Child
"""
sta, end = _cre_sta_end(len(ind0))
return (
np.concatenate((ind0[... | true |
a1c211833062e9dda062725840be198a3fdda366 | Python | Hasso2007/test_pycharm | /pkg/Test.py | UTF-8 | 79 | 3.265625 | 3 | [] | no_license | a = 2
b = 3
sum = a + b
print(sum)
num1 = 3
num2 = 5
sum = num1+num2
print(sum) | true |
ae0f6f883416eccd0c88f82a777df5e20516eedc | Python | kasem777/Python-codeacademy | /dictionary/values_that_are_keys.py | UTF-8 | 694 | 4.9375 | 5 | [] | no_license | # Values That Are keys
# Create a function named values_that_are_keys that takes
# a dictionary named my_dictionary as a parameter.
# This function should return a list of all values in the
# dictionary that are also keys.
# Write your values_that_are_keys function here:
def values_that_are_keys(my_dictionary):
n... | true |
c19faf2f7a8b1adf76d33a7293b5beaa718a0516 | Python | rentainhe/simple-imagenet-test | /imagenet.py | UTF-8 | 1,767 | 2.625 | 3 | [] | no_license | import numpy as np
from skimage import io
# from skimage import transform
from PIL import Image
import matplotlib.pyplot as plt
import os
import torch
import torchvision
from torch.utils.data import Dataset, DataLoader
from torchvision.transforms import transforms
from torchvision.utils import make_grid
class Imagenet... | true |
4f2cbb2d5ae1a14dd1efed282dcd25853d8e4c61 | Python | MarcoContreras23/AutomatasProyecto1 | /ventana/automa.py | UTF-8 | 11,508 | 2.875 | 3 | [] | no_license | import graphviz as gv
from subprocess import check_call
from tkinter import *
import Pila
import Minimizador
import time
import graficarManualmente
import threading
from VentanaInicial import ExpresionRegular
import PIL
import afnd_eaafd
from PIL import Image
import probadorDeCadena
import easygui as eg
import Automata... | true |
e4c25f084fda1e5f939b0fdebb5a8124aa81a6f5 | Python | jkeane889/ThinkLikeACS | /enterString.py | UTF-8 | 464 | 3.703125 | 4 | [] | no_license | def alphaString():
print('Please enter a sentence for analysis: ')
newstring = input('Sentence: ')
alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
counts = {}
index = 0
for i in alphabet:
counts[i] = 0
index = index + 1
for key in newstring:
if key i... | true |
deb87360e83b454d369fab0a57c51997ab1279a6 | Python | ztonege/10805-YelpChallenge | /feature/combineFeatures.py | UTF-8 | 1,863 | 2.734375 | 3 | [] | no_license | import csv
import sys
import itertools as IT
'''
full_feature.csv format
[busi_path, text_path, sent_path, time_path, label_path]
[0]review_id,
[1]business_id,
[2]longitude,
[3]latitude,
[4]rating,
[5]review_count,
[6]Num_token,
[7]num_noun,
[8]num_verb,
[9]num_adj,
[10]num_adverb,
[11]num_!,
[12]num_?,
[1... | true |
33812b4e320bc242821cc421186796d6c3d096b8 | Python | warabanshi/rhi | /rhi/commands/init.py | UTF-8 | 1,956 | 2.75 | 3 | [] | no_license | import configparser
import re
from typing import Any, Dict
import validators
import rhi.libs.helper
import rhi.config
from rhi.commands.command import Command
class Init(Command):
def write_to_file(self, conf: Dict[str, Any]) -> None:
config = configparser.ConfigParser()
config["DEFAULT"] = co... | true |
bab4bc877e82b1d9cea3cb3eedcbf2953524a573 | Python | jpcp13/L2 | /2017/Comptes-Rendus/TP3/Selsane_Manel/exo3_5.py | UTF-8 | 406 | 2.6875 | 3 | [] | no_license | from math import pi
from tp3 import *
#a) voir fichier odt
#b) voir fichier tp3.py
#c) voir fichier tp3.py
#d)
u0 = 1.0
v0 = 0.0
U0 = np.array ([u0, v0])
T = 4*pi
n = 8000
tt, UU = euler_2(f5, U0 , T , n )
print tt
print UU
#e)
import matplotlib.pyplot as plt
plt.plot(tt, UU [0],'r-')
plt.plot(tt,UU[1],'b-')
plt.... | true |
999845b09f9d5b28a7198e151929f6eaf8043f29 | Python | itqop/labs_4sem_py | /исходники/lab2.py | UTF-8 | 5,713 | 3.640625 | 4 | [] | no_license | import random
import time
import timeit
def binary_search(l, value):
low = 0
high = len(l)-1
while low + 1 < high:
mid = low + int(((float(high - low)/( l[high] - l[low])) * ( value - l[low])))
if l[mid] > value:
high = mid
elif l[mid] < value:
low = mid
... | true |
470b761926fd82fdae8db4c160aa2f6b4105290e | Python | gtxmobile/leetcode | /14.最长公共前缀.py | UTF-8 | 379 | 3.03125 | 3 | [] | no_license | # coding:utf-8
class Solution14(object):
def longestCommonPrefix(self, strs):
"""
:type strs: List[str]
:rtype: str
"""
if not strs:
return ""
strs.sort()
first = strs[0]
last = strs[-1]
i = 0
while i < len(first) and first[... | true |
ad4985ac199b6f55df2f9cbfe2f01c5570ed1836 | Python | BrownDwarf/protostars | /sf/exp4/user_prior.py | UTF-8 | 974 | 2.703125 | 3 | [] | no_license | def user_defined_lnprior(p):
'''
Takes a vector of stellar parameters and returns the ln prior.
'''
if not ( (p[2] < 0.5) and (p[2] > 0) and
(p[3] < 1000.0) and (p[3] > -1000.0) and
(p[4] < 500.0) and (p[4] > 2.0) and
(p[6] < 1500.0) and (p[6] > 1000.0) and
... | true |
187589c740681a8a335f85f825d157b5dc8944be | Python | tswc/myGIT | /Python_101/TJ_pack - 副本.py | UTF-8 | 2,478 | 2.640625 | 3 | [] | no_license | import numpy as np
import scipy.io as sio
import math
def Comp2RI(x):
Real = np.real(x)
Imag = np.imag(x)
IR_mat = np.column_stack((Real,Imag))
return IR_mat
def to_logic(x, num):
y = np.zeros((x.shape[0], len(num)))
for i in range(x.shape[0]):
for j in range(len(num)):
... | true |
e102337c4a7482e2fa69b75e8ebdbe34e5d0f206 | Python | Tamminhdiep97/DETECT_FACE_BLUR | /FaceBlur_WebServer/command-line/fd_v.py | UTF-8 | 1,558 | 2.78125 | 3 | [] | no_license | import cv2
import time
# Load the cascade
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
t = time.time()
name = 'out'+str(int(t))+'.avi'
# To capture video from webcam.
#cap = cv2.VideoCapture(0)
# To use a video file as input
print("Name video: ",end="")
name_video = input()
cap = cv2... | true |
8d368aa72892b0347db1d45f3695d38a2c680bd1 | Python | paruchuripavan2000/paruchurifdtghfthf | /college.py | UTF-8 | 228 | 2.75 | 3 | [] | no_license | #printing name
print("paruchuripavankumar")
print("cmruniversity")
print("it is located in baglore")
print("it looks very peaceful and beautiful")
print("there is no ragging in this college and seniors are very friendily to us") | true |
1a9418fde7c66920c5652f332591a3128e8aa333 | Python | Cyrusb01/onramp-tools | /tools_app/plotlydash/helpers.py | UTF-8 | 27,151 | 2.90625 | 3 | [] | no_license | import pandas as pd
import bt
import plotly.express as px
import plotly.graph_objects as go
from .formatting import onramp_colors, onramp_template, onramp_template_dashboard
def get_coin_data(symbol):
df = pd.read_csv(f"datafiles/{symbol}_data.csv")
res = df[
["timestamp", "price_open", "price_high", ... | true |
4fe4a34461627ed7faf832d9e00306f0004e61f8 | Python | kodicpu/codekata | /set437.py | UTF-8 | 123 | 3.03125 | 3 | [] | no_license | number=[int(i) for i in input().split()]
number[0],number[1]=number[1],number[0]
print (str(number[0])+" "+str(number[1]))
| true |
ba3d92e2265784ff6906b65e570f72b726572856 | Python | taw-desarrollo-plataformas-web/EjemploSqlAlchemy | /genera_tablas.py | UTF-8 | 1,450 | 2.65625 | 3 | [
"MIT"
] | permissive | from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, relationship
from sqlalchemy import Column, Integer, String, ForeignKey
# se importa información del archivo configuracion
from configuracion import cadena_base_datos
# se genera en en... | true |
ac9583d67ad4f067e1e8da8f01bb5ceb92626519 | Python | robersonfaria/codility-demo-python | /challenge/time.py | UTF-8 | 335 | 3.84375 | 4 | [] | no_license | # Given time in seconds return in the following format <<hours>> h <<minutes>> m <<seconds>> s
def solution(T):
hour = str(T // 3600)
minute = str((T % 3600) // 60)
seconds = str((T % 3600) % 60)
return hour + "h" + minute + "m" + seconds + "s"
print(solution(7500));
print(solution(83643));
print(sol... | true |
9391ca57d6db8fd2c1a5a7941fdbc56e1be09ac0 | Python | isabelatelles/nes-emulator | /emulator.py | UTF-8 | 1,110 | 2.625 | 3 | [] | no_license | import sys
import numpy as np
from cpu.main import CPU
from ppu.ppu import PPU
def main(rom_path):
rom = np.fromfile(rom_path, dtype=np.uint8)
header = rom[:0x10]
# iNES rom format should start with NES followed by MS-DOS end-of-file
if header[0x0] != 0x4E or header[0x1] != 0x45 or header[0x2] != 0x53... | true |
8c5a4f942cca38babea4a77efd13a27cac33cf72 | Python | josy0319/algorithm_for_problem_solving | /SimpleImplementation/실패율.py | UTF-8 | 505 | 3.59375 | 4 | [] | no_license | #Programmers - 실패율
'''
딕셔너리 정렬
딕셔너리의 items로 값 가져온 후 key를 통해 람다식
[0] -> key값 기준 정렬
[1] -> value값 기준 정렬
'''
def solution(n, s):
res = []
temp = {}
cnt = len(s)
for i in range(1,n+1):
if cnt == 0:
temp[i] = 0
else:
temp[i] = s.count(i)/cnt
cnt -= s.coun... | true |
1a89c502e20c6656b21976dbc65efc15fe46c765 | Python | taarsikis/comparison-of-algorithms | /Generate_plot.py | UTF-8 | 640 | 2.90625 | 3 | [] | no_license | import matplotlib.pyplot as plt
def generate_plot(test_type,res):
sorts = ["insertion_sort", "selection_sort", "merge_sort", "shell_sort"]
x = list(res["insertion_sort"].keys())
y = [[res[sort][length]["counter"] for sort in res.keys()] for length in x]
print(y)
plt.xlabel("Довжина списку")
plt... | true |
038f06f2cd09296bee6a31cd1c0b8c3ac4dc3dff | Python | MathiasLuik/Taltech-AI-and-ML-course | /3 - Dijkstra’s Algorithm, Astar/mathias_luik_harjutus3.py | UTF-8 | 8,127 | 2.6875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Sep 18 13:52:16 2018
@author: mathias.luik
"""
from queue import Queue, PriorityQueue
import numpy as np
#from Graph import *
lava_map1 = [
" ** ** ",
" *** D *** ",
" *** ",
" ... | true |
1f31811bf1c10ae300cde7bc6b9b86586b15cad0 | Python | nkawaller/leetcode_python | /algorithms/binary/number_of_1_bits.py | UTF-8 | 669 | 4.1875 | 4 | [] | no_license | """
Write a function that takes an unsigned integer and returns the number of '1' bits it has (also known as the Hamming weight).
Example 1:
Input: n = 00000000000000000000000000001011
Output: 3
Explanation: The input binary string 00000000000000000000000000001011 has a total of three '1' bits.
"""
# One-liner
def... | true |
d193bb0bfebb4546d055db0ae6c51aa624734a7b | Python | DouglasAllen/Python-projects | /M101_MongoDB/python/other/lists_n_dicts.py | UTF-8 | 179 | 2.875 | 3 | [] | no_license | a = {'interests':['electronics', 'food', 'computers'], 'name':'Douglas'}
print a['name']
print a['interests'][1]
print a
things = {"animals":["dog", "cat", "zebra" ]}
print things | true |
aa9bb6c6f3860e30c22bb922c1fc36be37488b34 | Python | santiago-pan/project-euler | /python/problem9/problem.test.py | UTF-8 | 340 | 3.03125 | 3 | [] | no_license | import unittest
import problem as p
class TestProblem(unittest.TestCase):
def test_is_pythagorean(self):
self.assertEquals(p.isPythagorean(3, 4, 12), True)
def test_find_pythagorean(self):
self.assertEquals(p.findPythagorean(12), 60)
self.assertEquals(p.findPythagorean(1000), 31875000... | true |
1dd96a323971eeb01ac7faad53f6ccc21de07132 | Python | FisicaComputacionalI/20170912-examen-divoneehs | /examen.py | UTF-8 | 230 | 2.734375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
def y(x):
return (x) + 1997
x= np.arange(0.0,20.0,1.0)
plt.plot(x, y(x),'*g')
plt.title("Diana Ivonee Huitzil Sosa")
plt.xlabel("Edad")
plt.ylabel("Anio")
plt.savefig('edadIvonee.png')
plt.show ()
| true |
cb5270960894374f2da9405614f1f71b6c907de3 | Python | Aasthaengg/IBMdataset | /Python_codes/p02898/s358771326.py | UTF-8 | 150 | 2.828125 | 3 | [] | no_license | n,k = map(int,input().split())
count=0
l= list(map(int,input().split()))
for i in range(len(l)):
if l[i]>=k:
count=count+1
print(count) | true |
9beb4a76cc6a356934a4c4cd82ac36bb83e7513d | Python | squibbon37/Pokedex | /pokemon_screenscrape/ScreenScrape.py | UTF-8 | 1,475 | 3.140625 | 3 | [] | no_license | __author__ = 'Captain Vasoline'
from bs4 import BeautifulSoup
import urllib.request
import sqlite3
generation = ["I", "II", "III", "IV", "V", "VI"]
db = sqlite3.connect('../pokedexDB.db')
cur = db.cursor()
def scrapescreen():
createtable()
for version in generation:
url = "http://pokemon.wikia.com/... | true |
1f2166cd87aa712b52dd929e2da9f03981715637 | Python | ErkCurley/AgentBasedSimulation | /runContributionModel.py | UTF-8 | 3,299 | 2.71875 | 3 | [] | no_license | # run.py
from contributionModel import * # omit this in jupyter notebooks
import matplotlib.pyplot as plt
import pandas as pd
import random
import math
# from mesa.datacollection import DataCollector
# The are the potential message topics
potential_topics = ["A", "B", "C", "D", "E", "F", "G", "H", "I"]
number_of_a... | true |
9705375b59bb010ccbcc121b59b2876872f433af | Python | YagoRizzetti/AlgoritmosYEstructurasDeDatos1 | /PrimerCuatrimestre/CargaDeVentasWhile.py | UTF-8 | 1,368 | 3.625 | 4 | [] | no_license | cantDeVentasDelMes = int(input("Ingrse la cantidad de ventas en x mes(Ingrese '-1' Para terminar): "))
cant0=False
cant1=0
cant2=0
cant3=0
acumulador=0
while cantDeVentasDelMes != -1 :
if cantDeVentasDelMes >= 0 :
if cantDeVentasDelMes < 10000 :
cant1 += 1
if cantDeVentasDelMes == ... | true |
05050f63a226041678afb8cb62b99a7a05715c6c | Python | asaa500/sw-carpentryd | /ZodiacWorkingco-Copy1withRepeat.py | UTF-8 | 1,349 | 3.78125 | 4 | [] | no_license |
# coding: utf-8
# In[10]:
# zodiacsteup will do all the opening, loading an closing of files/data
def ZodiacSetup():
# open the zodic descriptions file
ZodiacText = open('zodiacDescriptions.txt','r')
#for line in ZodiacText:
#print(line)
# Load the file. we are going to make a list with each ... | true |
28a3c97fbed2732696e933483bbc4b0d63a08656 | Python | trje3733/FOMMS_integrate | /FOMMS_integrate/stochastic.py | UTF-8 | 549 | 3.328125 | 3 | [
"MIT"
] | permissive | """
This function implements 1d Monte Carlo integration
"""
import numpy as np
def monte_1d(x, f, trials):
"""
Compute a 1D definite integral
Parameters
----------
f : function
User defined function.
x : numpy array
Integration domain.
trials : integer
Total numb... | true |
03335f5b80a835b5ee39d60cfaeaefb7be2478e5 | Python | duxiaobu/data_structure | /20_05_26/字符串轮转.py | UTF-8 | 316 | 3.5 | 4 | [] | no_license | class Solution:
def isFlipedString(self, s1: str, s2: str) -> bool:
# 旋转得到的字串,只需要两个长度一致,s1是s2二倍的字串
return len(s1) == len(s2) and s1 in s2 * 2
if __name__ == '__main__':
s = Solution()
print(s.isFlipedString("waterbottle", "erbottlewat"))
| true |
e2d133cc75b9451fd94ad6e6280226be50d39faa | Python | russwinch/lpthw | /ex5.py | UTF-8 | 482 | 4.09375 | 4 | [] | no_license | #!/usr/local/bin/python3
'''
LPTHW exercise 4
More Variables and Printing
'''
my_name = "Russ"
my_age = 34
my_height = 171 #cms
my_weight = 63 #kgs
my_eyes = "blue"
my_teeth = "white"
my_hair = "blond"
print(f"lets talk about {my_name}.")
print(f"he's {my_height} cms tall.")
print(f"he's {my_weight} kgs heavy.")
prin... | true |
528e262002827e38cb63869341d21f9b6c5be574 | Python | julia-reutskaya/Coursera_Python | /prisoner.py | UTF-8 | 476 | 3.125 | 3 | [] | no_license | brick1, brick2, brick3 = int(input()), int(input()), int(input())
hole1, hole2 = int(input()), int(input())
if hole1 >= brick1:
if hole2 >= brick2 or hole2 >= brick3:
print('Yes')
else:
print('No')
elif hole1 >= brick2:
if hole2 >= brick1 or hole2 >= brick3:
print('Yes')
else:
... | true |
a7e82673faa31c5d1fe6c6541a7250a634326989 | Python | magico13/DeimOS | /App_FileBrowser.py | UTF-8 | 4,072 | 2.546875 | 3 | [
"MIT"
] | permissive | from app import App
import utils
from utils import COLORS
import pygame
import os
import filebrowser_helper
class App_FileBrowser(App):
def __init__(self, path='/home/pi'):
super(App_FileBrowser, self).__init__()
self.dir = path
self.dirty = True
filebrowser_helper.ShowHidden(False)
filebrowser_... | true |
eded09905da04e660d8794183b6283429721dd92 | Python | jeetsukumaran/gerenuk | /gerenuk/simulate.py | UTF-8 | 47,221 | 2.59375 | 3 | [
"BSD-3-Clause"
] | permissive | #! /usr/bin/env python
##############################################################################
## Copyright (c) 2017 Jeet Sukumaran.
## All rights reserved.
##
## Redistribution and use in source and binary forms, with or without
## modification, are permitted provided that the following conditions are met:
##
... | true |
32043c845b76b0ed23f2e7884cba212b4e6ed6a4 | Python | IvarStefansson/Numerical-modelling-of-convection-driven-cooling-deformation-and-fracturing-of-thermo-poroelastic-m | /src/exIV_CDM.py | UTF-8 | 7,706 | 2.59375 | 3 | [
"MIT"
] | permissive | """
Example setup and run script for a 3d example with five vertical fractures.
"""
import logging
import numpy as np
import porepy as pp
import utils
from fracture_propagation_model import THMPropagationModel
logger = logging.getLogger(__name__)
class CDM(THMPropagationModel, pp.THM):
"""
This class prov... | true |
4e908c58e509668456ba42717112fe31630a6c6e | Python | sathish86/workspace_python | /insertion_sort.py | UTF-8 | 2,560 | 3.34375 | 3 | [] | no_license |
"""
def insertion_sort(unsorted):
sorted_list = []
outer_count = 0
inner_count = 0
for un in unsorted:
outer_count += 1
posi = 0
if sorted_list == []:
sorted_list.append(un)
else:
for index, ele in enumerate(sorted_list):
... | true |
0cff88f03a339e127f34f3f967795647be747c3f | Python | K-Ikram/apdm-predictor | /Services/FHBPrediction.py | UTF-8 | 2,452 | 3.109375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Feb 16 15:17:21 2017
@author: BOUEHNNI
"""
#import sys
import numpy as np
from DataAccess import DataAccessFHB
from Services import WeightedKNN
class FHBPrediction(object):
def __init__(self):
self.fhbDataAccess = DataAccessFHB.DataAccessFHB()
self.fhbTra... | true |
d7c9971b59f11cc421138a597d75b0f3182f51b9 | Python | Yuri68velvet/python-basic | /50.py | UTF-8 | 243 | 3.890625 | 4 | [] | no_license | #Example:Counting the number of objects of a class
class Student:
count=0
def __init__(self):
Student.count=Student.count+2
s1=Student()
s2=Student()
s3=Student()
s4=Student()
print("The number of stundents:",Student.count)
| true |
59adad9a640b90da6f01571184011ac8f1e7e63a | Python | Aadil313/assignment-tuesday | /qs11.py | UTF-8 | 136 | 3.171875 | 3 | [] | no_license | my_dict = {'x':500,'y':5874,'z':8502}
key_min =min(my_dict.keys(), key=(lambda k: my_dict[k]))
print('minimum value: ',my_dict[key_min]) | true |
4c78712fb804c72a0c6ee890194b1e542bfc42dd | Python | gschen/sctu-ds-2020 | /1906101035-罗政/day0225/test04.py | UTF-8 | 163 | 3.21875 | 3 | [] | no_license | list=[1,2,3,4]
for i in list:
print(i)
str="abcdefg"
for j in str:
print(j)
for i in rang(2,5):
print(i)
for i in rang(1,10,2):
print(i)
# | true |
dbfbe7842cf0a8c4818d38da5a10c94804a95e3a | Python | silviogn/leetcode.com | /114_Flatten_Binary_Tree_to_Linked_List/main.py | UTF-8 | 833 | 3.59375 | 4 | [] | no_license | # Definition for a binary tree node.
class TreeNode(object):
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution(object):
def flatten(self, root):
if root is None or (root.right is None and root.left is None):
... | true |
0199f601b356e211135de6d6222dad03bf4a3128 | Python | Joaom123/padroes-de-projeto-ifce | /observer/StockGrabber.py | UTF-8 | 862 | 2.890625 | 3 | [] | no_license | from abc import ABC
from observer.Publisher import Publisher
from observer.Subscriber import Subscriber
class StockGrabber(Publisher, ABC):
def __init__(self):
self.subscribers = []
self.ibm_price = 0.0
self.google_price = 0.0
def set_ibm_price(self, ibm_price: float):
self.i... | true |
640b2f8ce850cddc638a6dc5b30658a4caeed72e | Python | Will3577/code | /leetcode/max_integer.py | UTF-8 | 1,242 | 3.15625 | 3 | [] | no_license | #
# 最大数
# @param nums int整型一维数组
# @return string字符串
# [2,20,23,4,8]
# "8423220"
import heapq
class Solution:
def fill(self, s, l):
if len(s)==l:return s
t = s[-1]
while len(s)<l:
s+=t
return s
def solve(self , nums ):
# write code here
if len(nu... | true |
576359fbbda58271a4214a609c0736d5c737f256 | Python | GihanMora/Extreme_LexiBERTa | /us_election_experiments/process_data.py | UTF-8 | 403 | 2.53125 | 3 | [] | no_license | import pandas as pd
for i in range(50):
df = pd.read_csv(r"E:\Projects\DSI Gihan Prev\Datasets\us_election\hashtag_joebiden.csv", lineterminator='\n', nrows=20000, skiprows=range(1, 20000*i))
print(df.columns)
print(len(df))
df['text'] = df['tweet']
df['label'] = [0]*len(df['tweet'])
df.to_csv... | true |
bfc5f4af51519d367f3962dd0d12e1c3badc3307 | Python | mom1/messager | /talkative_server/talkative_server/cli.py | UTF-8 | 5,581 | 2.8125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
# @Author: MaxST
# @Date: 2019-07-23 22:59:32
# @Last Modified by: MaxST
# @Last Modified time: 2019-08-30 08:13:22
import logging
import sys
from tabulate import tabulate
from .commands import AbstractCommand, icommands
from .db import DBManager
# ActiveUsers, TypeHistory, User, UserHist... | true |
272c3ea6328d46577c53ac4f24f21cf7e1457235 | Python | c940606/leetcode | /1038. Binary Search Tree to Greater Sum Tree.py | UTF-8 | 395 | 3.03125 | 3 | [] | no_license | class Solution:
def bstToGst(self, root: TreeNode) -> TreeNode:
cur = 0
if not root: return root
def dfs(root):
nonlocal cur
if not root.left and not root.right:
return
dfs(root.right)
root.val += cur
cur += root.va... | true |
b6724e14483e10e4d84652642e6da49260fafd58 | Python | yeq71/py_image_processing | /image_handling/resize_image.py | UTF-8 | 3,945 | 3.4375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Bin the image.
Written by: Andy Kiss
Started: 2017-01-25
Last modified: 2017-01-25
"""
# Import modules
import numpy as np
from skimage.transform import resize
def bin_image(img, B=1, method='average'):
"""
Bin the image in the horizontal and verticle direction
Parameters... | true |
3dff8755a9fe588518e1aab46027489ff4f108ef | Python | v3l0c1r4pt0r/libarsc | /arsc/type/uint8.py | UTF-8 | 1,844 | 3.59375 | 4 | [
"Apache-2.0",
"LicenseRef-scancode-unicode"
] | permissive | #!/usr/bin/env python3
## \file uint8.py
# \brief Unsigned 8-bit Integer
import struct
import unittest
class uint8:
def __init__(self, integer, little=False):
self.little = little
if little:
self._endian = '<'
else:
self._endian = '>'
self.integer = integer... | true |
9f6b2b362efcac46915d24e9b795af66e2c1bf4b | Python | earthcube2022/ec22_kwan_etal | /scripts/normalize_data.py | UTF-8 | 5,825 | 3.390625 | 3 | [] | no_license | import re
import pandas as pd
import numpy as np
def remove_bracket_text(df):
"""remove trailing text inside brackets.
example: '1 [notes]' becomes '1'."""
df.replace(r" *\[.*\] *$", "", regex=True, inplace=True)
return df
def remove_whitespace(df):
"""remove leading and trailing whitespaces fr... | true |
48a2112f5ba7a597f4ab0e932fa2ab78b609e2cc | Python | sullivancolin/hexpy | /src/hexpy/base.py | UTF-8 | 1,897 | 3.078125 | 3 | [
"MIT"
] | permissive | """rate limiting decorator and handling responses for exceptions and JSON conversion"""
import functools
import logging
import threading
import time
from collections import deque
from typing import Any, Callable, Deque, Dict
from requests.models import Response
JSONDict = Dict[str, Any]
def rate_limited(
func:... | true |
aa2141b4a1624f08e42b54331dbfc2dcf2d92a13 | Python | ChengCuotuo/learnpython | /游戏-打飞机/5.py | UTF-8 | 7,038 | 3.296875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
'''
author:wudi
date:20180325
func:planegame
0.游戏背景框架1.出现玩家飞机2.玩家飞机自由移动3.出现子弹4.出现敌机
'''
import pygame
from sys import exit
from pygame.locals import *
import random
# 玩家飞机类
class Player(pygame.sprite.Sprite):
def __init__(self, plane_img,init_pos):
pygame.sprite.Sprite.__init__(sel... | true |
342888056ef97d557c67900c1c684aee3cbce296 | Python | marzdeveloper/Top-View-Re-Identification | /csv and txt creator and manager/TVPR2/make_txt_from_csv_TVPR2_random_people.py | UTF-8 | 2,376 | 2.90625 | 3 | [] | no_license | import csv
import random
path_train = "C:/Users/Daniele/Desktop/TVPR2/train.csv" #path al csv di train
path_test = "C:/Users/Daniele/Desktop/TVPR2/test.csv" #path al csv di test
txt_path = "C:/Users/Daniele/Desktop/TVPR2/txt/prova/"
min = 80 #numero minimo di foto per classe
max = 80 #numero massimo di foto per class... | true |
49c5fec4df377b7a1a5baa63c96d1b55fb20f691 | Python | tarunvelagala/python-75-hackathon | /files-1.py | UTF-8 | 316 | 2.953125 | 3 | [
"MIT"
] | permissive | # to view the contents of zip file
#from zipfile import *
#z = ZipFile("test.zip","r")
# z.extractall()
# z.close()
from itertools import islice
def file_read_from_head(fname, nlines):
with open(fname) as f:
for line in islice(f, nlines):
print(line)
file_read_from_head('sample.txt', 2) | true |
e3437c7f0e1682979fda4951649e9f633c742836 | Python | noAudio/WeeklyMealPlanner | /WeeklyMealPlanner/logic/db_actions/dbconnection.py | UTF-8 | 850 | 2.953125 | 3 | [] | no_license | from sqlite3.dbapi2 import Connection, Cursor, connect
class DBConnection:
'''
Establishes connection to database.
Also allows database commit and disconnection via _commit_disconnect_db().
'''
connection: Connection
_db: str = 'foods.db'
def __init__(self) -> None:
'''
Ac... | true |
d8e7cc59cedb141b37cf2f599d8c0e1be52f2e4e | Python | ericholscher/django-rating | /rating/managers.py | UTF-8 | 1,101 | 2.84375 | 3 | [
"MIT"
] | permissive | """
Custom Managers for generic rating models.
"""
from django.db.models import Manager
from django.contrib.contenttypes.models import ContentType
from rating.utils import get_target_for_object
class RatedItemManager(Manager):
def get_for_object(self, object):
ctype_id, obj_id = get_target_for_object(ob... | true |
d7e98491d9f5340ba45f1ebdbc1c6899550668ac | Python | yoobyungchan/baek11058 | /11058.py | UTF-8 | 322 | 3.125 | 3 | [] | no_license | t = int(input())
d = [0] * (t+1)
for i in range(1,t+1):
temp1 = temp2 = 0
if i-1 >= 0:
temp1 = d[i-1] + 1
for j in range(1, i-2):
if i - (j+2) >= 0:
a = d[i-(j+2)]*(j+1)
if temp2 < a:
temp2 = a
d[i] = max(temp1, temp2)
print(d[t])
... | true |
0368a173b32c6e354b0d3b93611b7d563211d9a3 | Python | serkanishchi/zerosleap | /zerosleap/comp/server.py | UTF-8 | 8,344 | 2.875 | 3 | [] | no_license | """
Module to compute functions in a parallel manner.
Provides computation from a separate process or a remote computation resource.
The files that the computation needed should be accessible from server side.
"""
import time
import logging
import numpy as np
import tensorflow as tf
from abc import abstractmethod
fr... | true |
61e8d40435e47a7ffb256ccea5503a1020f7dce7 | Python | abdulkadirkarakus/pythonOdevler | /class.py | UTF-8 | 656 | 3.046875 | 3 | [] | no_license | class Insan:
def __init__(self, ad, soyad, yas, ulke, sehir):
self.ad = ad
self.soyad = soyad
self.yas = yas
self.ulke = ulke
self.sehir = sehir
self.yetenekler = []
def kisi_bilgileri(self):
return f' Ad: { self.ad }, Soyad: { self.soyad },Yas: { self.yas... | true |
725b25be4b88886050cc6db2300aaf9502834d27 | Python | cxzhangqi/CNNs-for-Wind-Field-Downscaling | /networks/modular_downscaling_model/core_modules/ResUNetSuper.py | UTF-8 | 8,832 | 2.578125 | 3 | [
"MIT"
] | permissive | import torch.nn as nn
from networks.modular_downscaling_model.base_modules import ConvBlock, ResNetMultiBlock, ConvMultiBlock
from networks.modular_downscaling_model.core_modules.unet_template import BaseUNet
from networks.modular_downscaling_model.core_modules.unet_template.SkipConnectionModule import SkipConnectionMo... | true |
fa11767ce80eabe1515e59d22847d49c16dcec34 | Python | iriama/Apprentissage-Automatique | /traitement-images/filtres.py | UTF-8 | 1,040 | 3.078125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from PIL import Image as pImage
from PIL import ImageOps
def copy(image):
return image
def grayscale(image):
return image.convert('L')
def blue(image):
hsv = image.convert('RGB').convert('HSV')
pixdata = hsv.load()
for y in range(image.size[1]):
for x in range(i... | true |
be5378d01e9a7e83cf675a0d4840b68af60ac9ef | Python | KonradMarzec1991/Codewars-LeetCode | /Codewars/Python/3kyu/3kyu_Binomial Expansion.py | UTF-8 | 998 | 2.78125 | 3 | [] | no_license | from math import factorial as fact
def get_coefficient(n, k, a, c):
return (a ** (n - k)) * fact(n) // fact(k) // fact(n - k) * (c ** k)
def expand(expr):
base, pow = tuple(expr.split('^'))
pow, base = int(pow), base[1:-1]
if pow in (0, 1):
return ('1', base)[pow]
i = 0
while not bas... | true |
974140366019cd8749823c98c170ea9ee02c0030 | Python | alldatacenter/alldata | /ai/modelscope/modelscope/models/cv/video_single_object_tracking/models/layers/patch_embed.py | UTF-8 | 1,234 | 2.6875 | 3 | [
"Apache-2.0",
"BSD-3-Clause",
"MIT"
] | permissive | # The implementation is adopted from OSTrack,
# made publicly available under the MIT License at https://github.com/botaoye/OSTrack/
import torch.nn as nn
from timm.models.layers import to_2tuple
class PatchEmbed(nn.Module):
""" 2D Image to Patch Embedding
"""
def __init__(self,
img_size... | true |
a036c19e55b617f085cc9fb3a04503429168f4c2 | Python | avtomato/netology-homework | /homework-2-6/homework_2_6.py | UTF-8 | 617 | 2.828125 | 3 | [] | no_license | import os
def template():
currentdir = 'Source'
destinationdir = 'Result'
# проверяем существование папки, если нет создаем
if not os.path.exists(destinationdir):
os.mkdir(destinationdir)
# читаем каталог 'Source', конвертируем файлы и складываем их в 'Result'
for file in os.listdir(cu... | true |
93a56ebe3750fe5a9c3520d571ac47397d520909 | Python | huydoIT/PythonSocket | /client.py | UTF-8 | 774 | 3.203125 | 3 | [] | no_license | import socket
HOST = 'localhost' # Cấu hình address server
PORT = 8000 # Cấu hình Port sử dụng
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # Cấu hình socket
# ip = input("Input IP address: ")
s.connect((HOST, PORT)) # tiến hành kết nối đến server
while True:
cmd = input("Client: ")
mes = str()
... | true |
aba42ed08f710d651639f601ee3449983d45d3fd | Python | JoseALermaIII/python-tutorials | /pythontutorials/Udacity/CS101/Lesson 07 - Problem Set Optional/Q1-Weekend.py | UTF-8 | 336 | 4.59375 | 5 | [
"MIT"
] | permissive | # Define a procedure weekend which takes a string as its input, and
# returns the boolean True if it's 'Saturday' or 'Sunday' and False otherwise.
def weekend(day):
if day[0] == 'S':
return True
return False
print weekend('Monday')
# >>> False
print weekend('Saturday')
# >>> True
print weekend('Jul... | true |
f1d9b828da182d84e22c3a9d8cc3912e66146823 | Python | tachylyte/HydroGeoPy | /one_d_analytical.py | UTF-8 | 1,833 | 2.765625 | 3 | [
"BSD-2-Clause"
] | permissive | import math
def domenicoConc(t, v, De, R, deg, x, c0):
''' t is time (T), v is velocity (L/T), De is effective hydrodynamic dispersion (including diffusion) (L^2/T),
R is retardation (-), deg is first order decay constant (1/T), x is position along path (L),
c0 is source concentration (M/L^3), n is e... | true |
1ea6d165c174ad72ca3713b0783963f63c85bb73 | Python | paregorios/awol | /awol/Article.py | UTF-8 | 609 | 2.84375 | 3 | [] | no_license | #Class that represents all the data that is important from the xml file
class Article:
def __init__(self, id, title, tags, content, url, blogUrl, issn, template):
self.id = id
self.title = title
self.tags = tags
self.content = content
self.url = url
self.blogUrl = blo... | true |
105d3fd5363888081c9f42640a8d4bbce61afbe7 | Python | miknyko/cs224n_2019winter_assignments_solution | /a5_public/cnn.py | UTF-8 | 1,964 | 3.40625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
CS224N 2018-19: Homework 5
"""
### YOUR CODE HERE for part 1i
import torch
class CNN(torch.nn.Module):
"""
卷积网络
"""
def __init__(self,e_word,k=5):
"""
卷积网络初始化
@param e_word(int):输出通道数量,也即是最后word embedding的维数
@param e_c... | true |
0b23ab514e3c7be78d09159d5634e9ac238df6eb | Python | edvitor13/lista-exercicios-python | /1. ESTRUTURA SEQUENCIAL/questao04.py | UTF-8 | 355 | 4.15625 | 4 | [] | no_license | """
4. Faça um Programa que peça as 4 notas
bimestrais e mostre a média.
"""
print("[BOLETIM ESCOLAR]")
nota1 = float(input("Informe a nota 1: "))
nota2 = float(input("Informe a nota 2: "))
nota3 = float(input("Informe a nota 3: "))
nota4 = float(input("Informe a nota 4: "))
media = (nota1 + nota2 + nota3 + not... | true |
f4d0fbd3015939c5f1fbedeb7e90834ae6473193 | Python | naraekwon/CodingInterviewMastery | /ds_algos_primer/python/arrays_and_strings_solutions.py | UTF-8 | 15,724 | 4.65625 | 5 | [] | no_license | """
Title: Arrays and Strings Solutions
This file contains the solutions for the Arrays and Strings exercises in
the DS & Algos Primer. If you have not already attempted these exercises,
we highly recommend you complete them before reviewing the solutions here.
Execution: python arrays_and_strings_solutions.py
*** ... | true |
e909f919bfed60064dc312738bff9e693e9d6391 | Python | nitishymtpl/lecture-generator | /utils.py | UTF-8 | 2,498 | 3.015625 | 3 | [] | no_license | import re
import os
import os.path as osp
from datetime import timedelta
def srt_files_in_dir(directory):
for file in os.listdir(directory):
if not file.endswith('.srt'):
continue
file_path = osp.join(directory, file)
yield file_path
class Record(object):
def __init__(sel... | true |
29770a15e1f9e0d12560ccfb01dd2b13d9d934b2 | Python | nehajain1991/Morse-Code-Decoder | /word_29325013.py | UTF-8 | 2,447 | 3.96875 | 4 | [] | no_license | # Author: Neha Jain
# Student_ID: 29325013
# Start Date: 28 April 2018
# Last Modified Date: 3 May 2018
# This code will analyse the number of words given as the input by the user in
# individual morse code sequence and the entire morse code sequence
class WordAnalyser:
def __init__(self):
# f... | true |
74324216e543cd3a560e096b0d18d4d4d82d3fd1 | Python | cesarmarinhorj/LUI | /Builtin/LUIButton.py | UTF-8 | 1,699 | 2.671875 | 3 | [] | no_license |
from panda3d.lui import LUIObject
from LUILayouts import LUIHorizontalStretchedLayout
from LUILabel import LUILabel
from LUIInitialState import LUIInitialState
class LUIButton(LUIObject):
""" Simple button """
def __init__(self, text=u"Button", template="ButtonDefault", **kwargs):
LUIObject.__init__(... | true |
9e642e82a186593c66783e8319980dd4365e469d | Python | IcesDiscordTools/Python-Obfuscator-UserFriendly | /obfuscator.py | UTF-8 | 1,852 | 3.015625 | 3 | [] | no_license | import os
import base64
from sys import argv
# configuration
OFFSET = 10
VARIABLE_NAME = '__obf_obf' * 100
#made by wodx
def obfuscate(content):
b64_content = base64.b64encode(content.encode()).decode()
index = 0
code = f'{VARIABLE_NAME} = ""\n'
for _ in range(int(len(b64_content) / OFFSET) + 1):
... | true |
95582cf01ae90e66fc402dc687f05be1318eb7e0 | Python | Tadele01/Competitive-Programming | /Week-03/minimum_distance_bst.py | UTF-8 | 553 | 3.140625 | 3 | [] | no_license | class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def minDiffInBST(self, root: TreeNode) -> int:
prev = [-float('inf'), float('inf')]
return self.in_order(root, prev)
def in_order(self,... | true |