blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
55029255df618d6b92ec09e15132e6762a643b72 | greynotgrayskies/pines-engine | /engine/experiment/__init__.py | UTF-8 | 4,686 | 3.40625 | 3 | [] | no_license | """
"""
import re
__all__ = ['Experiment', 'Parameter', 'IntParameter']
class Experiment(object):
data_points = []
instruments = {}
parameters = {}
def __init__(self, **kwargs):
for param_name, param in self.parameters.items():
setattr(self, param_name, param.parameterize(kwargs[... | true |
59913f83fe2d448c1e311dee83be64dcb7e8a40e | Wenqin-Du/Python-for-Everybody | /Course1_week6Code.py | UTF-8 | 1,487 | 4.75 | 5 | [] | no_license | # simple function
# A function takes some input and has output
def thing():
print('Hello')
print('Fun')
thing()
print('Zip')
thing()
# max() and min() function (built-in function)
print(max('Hello Python'))
print(min('Hello Python'))
print(max('123.t'))
# function with parameters
def greet(lang):
if... | true |
151b6a77c64da01e15ef6d7f297481b5d93b3dc8 | mahesaagatha/project-akhir-kel2-arm2 | /Project-Akhir_Kelompok2_ARM2(Python Console)/HVAC.py | UTF-8 | 1,678 | 2.984375 | 3 | [] | no_license | import mysql.connector
import random, datetime, time
mydb = mysql.connector.connect(
host="localhost",
user="root",
password="tukangsapu0721",
database="db_tugasakhir"
)
mycursor = mydb.cursor()
def Menu():
print("SIMULATOR MESIN")
print("1. Show Data Monitoring HVAC")
print("2. Delete Data User d... | true |
c3d8544d4513f173fe9e47dfe2fe7fde3de1e50d | zzeleznick/pymaze | /utils.py | UTF-8 | 2,504 | 3.171875 | 3 | [] | no_license | from itertools import chain, product
from collections import OrderedDict as OD
from collections import deque
import numpy as np
import random
def makeWalls(rows, cols, density):
if density > .8:
print "WARN: Wall map with excessive density of %f" % density
grid = list(product(np.arange(rows), np.arang... | true |
58e85561d5cd8a242e66a77f103b07ac97b655d7 | may1114/triplet-loss | /generate_data.py | UTF-8 | 16,467 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[ ]:
from keras.applications.inception_v3 import preprocess_input
from keras.preprocessing.image import load_img, img_to_array, array_to_img
from keras.utils import Sequence
import os
import numpy as np
import random
import cv2
def center_crop(x, center_crop_size):
cent... | true |
e12abf3194f681070622ba0ae016ae10f4732f4d | victorrgouvea/URI-Problems | /Prova 1/3170.py | UTF-8 | 508 | 3.734375 | 4 | [] | no_license | b = int(input()) #entradas da quantidade de bolinhas e do número de galhos, respectivamente
g = int(input())
bN = g // 2 #aqui calculamos quantas bolinhas são necessárias para completar a árvore
bF = bN - b #aqui calculamos quantas bolinhas estão faltando
if bF <= 0: ... | true |
87bbe3fd08480c70bbf87784824425460794957a | raamana/confounds | /confounds/base.py | UTF-8 | 11,146 | 3.265625 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
"""
Conquering confounds and covariates in machine learning
Definition of confound from Rao et al., 2017:
"For a given data sample D, a confound is a variable that affects the image data
and whose sample association with the target variable is not representative of the
population-of-interest.... | true |
896c6c2a6380592594ebd83faed891ba41267c6a | JetBrains/intellij-community | /python/testData/resolve/FStringInsideAssertStatement.py | UTF-8 | 136 | 2.96875 | 3 | [
"Apache-2.0"
] | permissive | def test(name: str) -> int:
assert name is not None, f'{name} is None'
# <ref>
return len(name)
| true |
d0f08887d24b10773cc50d4e044bc816991eba4b | Code-Institute-Submissions/FSF-Milestone-Project | /items/models.py | UTF-8 | 2,633 | 2.625 | 3 | [] | no_license | from django.db import models
class Category(models.Model):
class Meta:
verbose_name_plural = 'Categories'
# more human-readable for site management
internal_name = models.CharField(max_length=30)
name = models.CharField(max_length=60)
def __str__(self):
return self.name
# item m... | true |
06c4f28255676b013d261163e9219213e92b394d | rzehumat/HPGeResAnalyzer | /addOrigin.py | UTF-8 | 198 | 2.59375 | 3 | [] | no_license | def addOrigin(df, info, yield_df):
cols = info.columns.to_list()
df[cols] = info[cols]
df["fiss_yield"] = yield_df["Yield"]
df["sigm_fiss_yield"] = yield_df["Error"]
return df
| true |
bd8cc82c83ffa283080424a5cd567f3d3e4b709e | Jawad1347/py_tricks | /new_language_wordlisting.py | UTF-8 | 723 | 3.5625 | 4 | [] | no_license | #!/usr/bin/python
""" This will careate a funny langauge """
NEW_SENTENCE = []
WORDS = input("Say something ").lower().split()
NEW_WORD_LIST = []
WORD_LIST = []
for word in WORDS:
if word[0] in "aeiou":
word = word + "yay"
NEW_WORD_LIST.append(word)
NEW_SENTENCE.append(word)
else:
... | true |
df47f7a3c1882b75bbc18c6832ae158866decbec | SocioProphet/CodeGraph | /kaggle/python_files/sample672.py | UTF-8 | 11,673 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[ ]:
# This Python 3 environment comes with many helpful analytics libraries installed
# It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python
# For example, here's several helpful packages to load in
import numpy as np # linear algebra
i... | true |
df0a690625b3f2efffb74d8206652cfecace32ef | muremwa/Python-Pyramids | /right_angled_pyramid.py | UTF-8 | 260 | 3.859375 | 4 | [] | no_license | """
write a function to print a pyramid of the following fashion
*
**
***
****
*****
******
*******
********
"""
def right_pyramid(num_rows):
for i in range(1, num_rows+1):
print("*"*i)
rows = input("How many rows?: ")
right_pyramid(int(rows))
| true |
bb80d41696d83113727f45a0766e1acd4dd6aba4 | mattalcock/hacks | /problems/compress.py | UTF-8 | 531 | 3.5625 | 4 | [] | no_license | #A function to compress a string.
def compress(st):
count , last, new = 1,None, ""
if len(st) ==1:
return "%s%s%s" % (new,count,st[0])
else:
for i in xrange(1, len(st)):
if st[i] == st[i-1]:
count +=1
else:
new="%s%s%s" % (new,count,st... | true |
75278c521b503ebccf37c786a7bc54c44ad9d5c2 | PAJADK/myPythonLektioner | /lektion1/lektion1.py | UTF-8 | 469 | 3.8125 | 4 | [] | no_license | #Opgave 2
navn = " parviz "
efternavn="javadian"
fullnavn= navn.title().strip()+ " " +efternavn.title()
print("Hej, mit navn er " +navn)
print(fullnavn)
print(fullnavn.upper())
print("Albert Einstein once said, “A person who never made a mistake never tried anything new.”")
#Opgave 3
tal1 =7+5
tal2 = 3*4
tal3 = 14-2
t... | true |
51e13ee1f65c84e05306f2c330532c0836dc8c04 | byashimov/typus | /typus/processors/quotes.py | UTF-8 | 4,394 | 3.125 | 3 | [
"BSD-3-Clause"
] | permissive | from itertools import cycle
from typing import Match
from ..chars import DLQUO, LAQUO, LDQUO, LSQUO, RAQUO, RDQUO, RSQUO
from ..utils import re_compile
from .base import BaseProcessor
class BaseQuotes(BaseProcessor):
"""
Replaces regular quotes with typographic ones.
Supports any level nesting, but doesn... | true |
fb9c39c1d70501a4e986967e1b624a356f0f8d82 | mew177/Solar_Battery_Balance_System | /Code/utils/demandPredictor.py | UTF-8 | 2,401 | 2.875 | 3 | [] | no_license | from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split
import pandas as pd
import numpy as np
class demandPredictor:
def __init__(self):
self.model = LinearRegression()
def train(self, file='../Data/electricity/electricity_record.csv', test_size=0.25, t... | true |
2b11cb88e3d360da80f8f0f5d09ea6b6ae3a7f42 | blackwer/garfunkel | /deepblast/dataset/parse_mali.py | UTF-8 | 5,047 | 2.59375 | 3 | [
"BSD-3-Clause"
] | permissive | import os
from deepblast.dataset.utils import state_f, revstate_f
import pandas as pd
import numpy as np
from collections import Counter
def read_mali(root, tool='manual', report_ids=False):
""" Reads in all alignments.
Parameters
----------
root : path
Path to root directory
tool : str
... | true |
1458f4345849cd4099a4d43e43feac60345d9104 | Chananchida58364111/Network305445-udp | /server.py | UTF-8 | 429 | 2.859375 | 3 | [] | no_license | import socket
UDP_IP = "127.0.0.1"
UDP_PORT = 5030
def fact(n):
f = 1
for i in range(1, n +1):
f *= i
return f
sock = socket.socket(socket.AF_INET, # Internet
socket.SOCK_DGRAM) # UDP
sock.bind((UDP_IP, UDP_PORT))
while True:
data, addr = sock.recvfrom(1024) # buffer size is 1024 byt... | true |
192f9c4fc69d46dddde6bb34d87be66287b18a52 | ChuanleiGuo/AlgorithmsPlayground | /LeetCodeSolutions/python/209_Minimum_Size_Subarray_Sum.py | UTF-8 | 564 | 2.9375 | 3 | [
"MIT"
] | permissive | class Solution(object):
def minSubArrayLen(self, s, nums):
"""
:type s: int
:type nums: List[int]
:rtype: int
"""
MAX_INT = 2 ** 31 - 1
if not nums or len(nums) == 0:
return 0
i = j = n_sum = 0
min_len = MAX_INT
while j < ... | true |
0eb9c856a4c7bb543c3329f09e232475dfc9ad35 | rogeralexei/Python | /Tarea 1(Semana 5)/super.py | UTF-8 | 2,520 | 3.625 | 4 | [] | no_license |
if __name__ == "__main__":
print("Lista de Supermercado")
lista={}
#Abrir archivo para convertir sus lineas en keys
listilla=open("Lista.txt","r").read().split('\n')
for linea in listilla:
if linea in lista.keys():
lista[linea]+=1
else:
lista[linea]=1
#im... | true |
1abaf5052a4369706e6248b367c02f9b4cdd68ac | mkurg/coursework | /facets.py | UTF-8 | 2,476 | 2.5625 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from os import listdir
from os.path import isfile, join
import csv
import pymorphy2
morph = pymorphy2.MorphAnalyzer()
tags_dict = {}
tag_files = [ f for f in listdir('./tags/') if isfile(join('./tags/',f)) ]
for tag_file in tag_files:
if tag_file[-4... | true |
e410ce8c6f89a14a31604be0a8166ffcc0600870 | DayGitH/Python-Challenges | /DailyProgrammer/DP20170501A.py | UTF-8 | 3,061 | 3.859375 | 4 | [
"MIT"
] | permissive | """
[2017-05-01] Challenge #313 [Easy] Subset sum
https://www.reddit.com/r/dailyprogrammer/comments/68oda5/20170501_challenge_313_easy_subset_sum/
# Description
Given a sorted list of distinct integers, write a function that returns whether there are two integers in the list that
add up to 0. For example, you would r... | true |
368efa0a7041d04be183df1b71b9f3fdc7aea70b | Revathinatarajan/python | /prgm04.py | UTF-8 | 205 | 2.875 | 3 | [] | no_license | k1,l1=map(str,input().split())
yas=0
if len(k1)>len(l1):
k1,l1=l1,k1
p1=0
while p1<len(k1):
yas+=(ord(l1[p1])-ord(k1[p1]))
p1+=1
for p1 in range(p1,len(l1)):
yas+=ord(l1[p1])-ord('a')+1
print(yas)
| true |
e087b0182ca9c5f2e3adf067ef4f00afb84ad27d | w1r2p1/AlgoTrading | /AlgoTrading/Database.py | UTF-8 | 17,524 | 2.578125 | 3 | [] | no_license | import sqlite3
from decimal import Decimal
from datetime import datetime
class BotDatabase:
def __init__(self, name:str):
self.name = name
self.initialise()
def initialise(self):
""" Initialises the Database """
conn = sqlite3.connect(self.name, detect_types=sqlite3.PARSE_DECLTYPES)
conn.row_facto... | true |
74198f7ef5a8bbbcb5526288e39486f8e7fafd03 | danielchen79/fluent-python | /Ch14 Iterater, Generator/arith_prog.py | UTF-8 | 2,264 | 3.40625 | 3 | [] | no_license | class ArithmeticProgression:
def __init__(self, begin, step, end=None):
self.begin = begin
self.step = step
self.end = end
def __iter__(self):
result = type(self.begin + self.step)(self.begin)
forever = self.end is None
index = 0
while forever or result <... | true |
6580df6e197ac3be075cd2aeb5f3c48a1b4cb37f | Dqvvidq/Nauka | /Operacje na plikach/main.py | UTF-8 | 809 | 3.90625 | 4 | [] | no_license | import os
import csv
# tworzenie ścieżki dostępu do pliku
os.path.join("czesc.txt")
# tworzenie pliku i zapisywanie coś na nim
st = open("czesc.txt", "w")
st.write("czesc")
st.close()
# otwieranie pliku i jego zawartości
with open("czesc.txt", "r") as f:
print(f.read())
# umieszanie zmian... | true |
db8a01f28a1f3dc4d48c03c4192566fcc5257b0d | TomasSchilling/MCOC2021-P0 | /timing_matmul.py | UTF-8 | 2,075 | 3.03125 | 3 | [] | no_license | import scipy as sp
import matplotlib.pyplot as plt
import numpy as np
from time import perf_counter
import sys as sys # Para obtener la memoria del objeto https://www.analyticslane.com/2018/11/19/reducir-el-consumo-de-memoria-en-python/
Tiempos=[[],[],[],[],[],[],[],[],[],[],[],[]]
Memoria=[]
valores=[2,5,... | true |
ebb81c89a56b2507260ca1791674722ae5fb3faa | olly-writes-code/advent_of_code | /2020/day8/star2.py | UTF-8 | 2,261 | 3.046875 | 3 | [] | no_license | from utils import get_input
class Command:
def __init__(self, idx, raw_input):
self.idx = idx
self.command = self.parse_command(raw_input)[0]
self.action = self.parse_command(raw_input)[1]
def increase_accumulator(self, accumulator):
self.acc_command_input = accumulator
... | true |
665a6337c8be69c45de0c07bf3bb378f82bd0d7c | advaith101/Computer_Vision | /PS1 Image Filtering and Color/PS1Q4.py | UTF-8 | 4,269 | 3.265625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import cv2
from skimage import io
import matplotlib.image as mpimg
class Prob4():
def __init__(self):
"""Load input color image indoor.png and outdoor.png here as class variables."""
###### START CODE HERE ######
self.indoor = mpimg.imread(... | true |
31f1f98648944d91017283b1678f7172d7c39365 | Feriow/Estacio-Python | /Tema 3 - Python estruturado - arquivos py/zip/figura16.py | UTF-8 | 192 | 3.859375 | 4 | [] | no_license | escolha = eval(input("Escolha uma opção de função, 1 ou 2: "))
if escolha == 1:
def func1(x):
return x + 1
else:
def func1(x):
return x * 2
s = func1(10)
print(s)
| true |
2593dbe60c3891869c6a9fd1ed6de5e692145947 | NUDTUGVexplorer/osqp_benchmarks | /benchmark_problems/example.py | UTF-8 | 6,384 | 3.046875 | 3 | [
"Apache-2.0"
] | permissive | import os
from multiprocessing import Pool, cpu_count
from itertools import repeat
import pandas as pd
from solvers.solvers import SOLVER_MAP
from problem_classes.random_qp import RandomQPExample
from problem_classes.eq_qp import EqQPExample
from problem_classes.portfolio import PortfolioExample
from problem_classes.l... | true |
d53507443a777526fbcec303f9665f8ca5d27704 | suriyadeepan/rnn-theano | /gen_data.py | UTF-8 | 2,450 | 2.953125 | 3 | [] | no_license | import itertools
import csv
import nltk
import numpy as np
import pickle as p
vocab_size = 8000
token_unknown = 'UNK'
token_start = 'START'
token_end = 'END'
'''
* Read the data from csv file
* append SENTENCE_START and SENTENCE_END tokens
'''
def read_data(file_name='data/reddit-comments-2015-08.csv'):
with ope... | true |
0a58c4cda4399041281d426d4ad3ac6036784b8e | mayvali/Youtube_dl-GUI | /main.py | UTF-8 | 8,049 | 2.578125 | 3 | [] | no_license | from tkinter import *
from tkinter import ttk
import json
from io import BytesIO
import requests
from PIL import Image, ImageTk
from downloader import Preview, Downloader
class Popup_menu(Menu):
def __init__(self, parent):
super().__init__(parent, tearoff=0)
self.add_command(label=... | true |
c114de425eaf600c309711c3b9835258386ce0b0 | skeeperloyaltie/Assignmen1-operators | /-operators.py | UTF-8 | 41 | 2.75 | 3 | [] | no_license | # = operators
x = 15
y = 5
print(x - y) | true |
993f9f6bc62d642486f74308fdd1943fb5f00750 | joaquinOnSoft/PhytonTutorialRelease3.7.0 | /IterateReverse.py | UTF-8 | 133 | 3.4375 | 3 | [] | no_license | import Reverse
from Reverse import Reverse
reverse = Reverse("Hello World!")
for character in reverse:
print(character, end="") | true |
8d58ff2b6f261d6c43f43a598f7e66dd5fe47855 | baunilha/DataClassesITP | /venv/build/Mongoengine/tests/inheritance_test.py | UTF-8 | 4,589 | 3 | 3 | [
"MIT"
] | permissive | import unittest
class BasesTuple(tuple):
"""Special class to handle introspection of bases tuple in __new__"""
pass
class DocumentMetaclass(type):
"""Metaclass for all documents.
"""
def __new__(cls, name, bases, attrs):
flattened_bases = cls._get_bases(bases)
super_new = super(D... | true |
96af283ba5178b0c18ddb1613b31d4d5bd057769 | GeoffBarrett/ml_ephys | /ml_ephys/preprocessing/p_mask_out_artifacts.py | UTF-8 | 9,294 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | from mountainlab_pytools import mdaio
import numpy as np
import multiprocessing
import time
import os
processor_name = 'ephys.mask_out_artifacts'
processor_version = '0.1.0'
class SharedChunkInfo():
def __init__(self, num_chunks):
self.timer_timestamp = multiprocessing.Value('d', time.time(), lock=False)... | true |
0123591aee5f1945f73b67caf540733800b8134c | Alhadis/Menloco | /utils/ff-extend.py | UTF-8 | 4,018 | 2.71875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import fontforge
import re
import sys
# Assign a new name to the font
def setFontName(font, name):
font.fontname = font.fondname = font.familyname = font.fullname = name;
return font;
# Return the Y ordinates of the highest/lowest points in a glyph
def getExtents( glyph ):
min = 0;
max = ... | true |
1e2f87158ceeb9251d9738939e60e594c333b3b3 | childofthefence/leetcodepython | /longest_substring.py | UTF-8 | 1,699 | 3.890625 | 4 | [] | no_license | class Solution(object):
def lengthOfLongestSubstring(self, s):
"""
:type s: str
:rtype: int
"""
count=0
"""will hold longest substring"""
current_count=0
"""will hold current substring length"""
"""algorithm: iterate through, find first long... | true |
5ce9e75b6698f38af71a6dfbb2447d155c32c4f5 | cash2one/xai | /xai/brain/wordbase/adjectives/_restrictive.py | UTF-8 | 438 | 2.515625 | 3 | [
"MIT"
] | permissive |
#calss header
class _RESTRICTIVE():
def __init__(self,):
self.name = "RESTRICTIVE"
self.definitions = [u'limiting the freedom of someone or preventing something from growing: ']
self.parents = []
self.childen = []
self.properties = []
self.jsondata = {}
self.specie = 'adjectives'
def run(self, o... | true |
8842c794476d9aa86e7c0be4c49098e9fe25edeb | jonathanrgoh/Personal-Projects | /Python-Projects/GuiPython/rps2.py | UTF-8 | 1,793 | 3.09375 | 3 | [] | no_license | from guizero import App, Text, Combo, PushButton
from random import randint
def play_game_def():
player_msg.value = "Player Chose: " + player_choice.value
chosen = randint(1,3)
if chosen==1:
computer = 'Rock'
elif chosen ==2:
computer = 'Paper'
else:
computer = 'Scissors'
computer_msg.value =... | true |
7e472bfdcd1562b3221940a56c140d22428c809f | yang4978/LeetCode | /Python3/0473. Matchsticks to Square.py | UTF-8 | 383 | 2.640625 | 3 | [] | no_license | class Solution:
def makesquare(self, nums: List[int]) -> bool:
if not nums:
return False
l = len(nums)
perimeter = sum(nums)
side = perimeter//4
if side*4!=perimeter:
return False
def dfs(index):
if index == l:
... | true |
af44f1ff1b0afd955cddd1900b788c5a04147388 | laowantong/paroxython | /examples/idioms/programs/015.0184-pick-uniformly-a-random-integer-in-ab.py | UTF-8 | 400 | 2.953125 | 3 | [
"MIT"
] | permissive | """Pick uniformly a random integer in [a..b].
Pick a random integer greater than or equals to _a, inferior or equals to _b. Precondition : _a < _b.
Source: programming-idioms.org
"""
# Implementation author: programming-idioms.org
# Created on 2016-02-18T16:57:57.20109Z
# Last modified on 2016-02-18T16:57:57.20109Z
... | true |
f360f80aca57fbaf1056f8b52a79187c99186983 | orakaro/rainbowstream | /rainbowstream/py3patch.py | UTF-8 | 973 | 3.03125 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import sys
# Library compatibility
if sys.version[0] == "2":
from HTMLParser import HTMLParser
from urllib2 import URLError
unescape = HTMLParser().unescape
else:
from html.parser import HTMLParser
from urllib.error import URLError
# HTMLParser().unescape is deprecated since Python 3.4 and is u... | true |
873616988b98ccdf72672a04aed3871b452baa4b | JoaoGome/PRC2021_Projeto | /app/src/assets/square.py | UTF-8 | 379 | 3.34375 | 3 | [] | no_license | from PIL import Image
image = Image.open('imagens/Taylor Swift.jpeg')
(x,y) = image.size
print( (x,y) )
tam = min(x,y)
new_image = image
if y != tam:
# crop((left, top, right, bottom))
new_image = image.crop((0, 0, x, tam))
if x != tam:
cortar = (x-y)/2
new_image = image.crop((cortar, 0, (x-cortar),... | true |
1276c29150c06c4db6ddb07a33667e0bfaa98a54 | xdql/Project_1 | /my.py | UTF-8 | 416 | 2.671875 | 3 | [] | no_license | from sys import argv
from os.path import exists
scrip,from_file,to_file=argv
print "Copy from %s to %s "%(from_file,to_file)
#we could do these two on one line too,how?
in_file=open(from_file)
indata=in_file.read()
print "the input file is %d bytes long"%len(indata)
print "Does the output file exist?%r"%exists(to_file)... | true |
438e3704d4003b24d1219ddd2eb898b1b7b8d8d5 | acgis-drap0051/gis4107-day05 | /ex1.py | UTF-8 | 757 | 2.65625 | 3 | [] | no_license | #-------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: MCE
#
# Created: 03/10/2017
# Copyright: (c) MCE 2017
# Licence: <your licence>
#-------------------------------------------------------------------------------
def main():
... | true |
5247ca0998dcfcd0292a3b916518650adc591ca9 | Fudeveloper/python | /cz/tencent_scrapy/tencent_scrapy/spiders/tencent.py | UTF-8 | 1,671 | 2.890625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import scrapy
from tencent_scrapy.items import TencentScrapyItem
# 默认__init__方法
class TencentSpider(scrapy.Spider):
name = 'tencent'
allowed_domains = ['tencent.com']
url='http://hr.tencent.com/position.php?&start='
offset=0
start_urls = [url+str(offset)]
def get_text(... | true |
19bbf111eb7471ab045db641ed6ba5c38970af29 | D-Kamunya/scrapper | /scrapper/pagination.py | UTF-8 | 1,518 | 2.640625 | 3 | [] | no_license | """
Extend the LimitOffsetPagination class
"""
from rest_framework.pagination import LimitOffsetPagination
def _positive_int(integer_string, strict=False, cutoff=None):
"""
Cast a string to a strictly positive integer.
"""
ret = int(integer_string)
if ret < 0 or (ret == 0 and strict):
rai... | true |
7237e213f8ebd8d48615211d23cf408d1793d2aa | wsbbb331/battery-swapping-simulation | /bus_saturation/parameterEffect/movingSpeed/plotData.py | UTF-8 | 2,709 | 2.609375 | 3 | [
"MIT"
] | permissive | import numpy as np
import pandas as pd
from scipy import stats, integrate
import matplotlib.pyplot as plt
from matplotlib.ticker import FuncFormatter
from matplotlib.dates import DateFormatter, HourLocator, MinuteLocator, AutoDateLocator
import seaborn as sns
import csv
import sys
from datetime import datetime,date,tim... | true |
e1e4342d2c43c24e9daa8845fde9e3d728683a1a | Greaux/PythonToImport | /hash | UTF-8 | 1,263 | 2.703125 | 3 | [] | no_license | #!/usr/bin/python
import hashlib
import random
mval = 10 ** 6
kval = 50 # >= 1
def apply_reduction(h):
return '{:06d}'.format(sum([int(h[i * 8:(i + 1) * 8], 16) for i in range(4)]) % mval)
def apply_encryption(p):
return hashlib.md5(p).hexdigest()
def apply_chain(p, k=kval):
# p = apply_reduction(h)
... | true |
21fedebf4c01cfcabb204c172a45050841247aab | elenabarreto/Funciones | /g_mayuscula.py | UTF-8 | 320 | 4.3125 | 4 | [] | no_license | print "_______________________"
print " Mayusculas con upper "
print "_______________________"
print " "
print " "
def mayuscula(s):
if s.upper()==True:
print "El caracter ingresado es mayuscula"
else:
print "El caracter ingresado en mayuscula es: ",s.upper()
#s=raw_input("Ingrese un caracter => ")
#mayuscula(s) | true |
8e56df531e1a05eae2a2777df71587ec5cf031c4 | jgabriel1/stock-tracker-legacy-backend | /tests/services/authentication/test_authenticate_unregistered_user.py | UTF-8 | 818 | 2.53125 | 3 | [] | no_license | import pytest
from fastapi.testclient import TestClient
from starlette.status import HTTP_401_UNAUTHORIZED
class AuthenticateUnregisteredUserCase:
def __init__(self, client: TestClient, user_data: dict):
self.client = client
self.user_data = user_data
def try_to_authenticate(self):
r... | true |
d8f761fa02f3f80cb90f36d6dcd830d41595e4a7 | SURGroup/UQpy | /tests/unit_tests/distributions/test__independent_distributions.py | UTF-8 | 6,802 | 2.96875 | 3 | [
"MIT"
] | permissive | # Test all distributions available in UQpy, using the cdf method or pdf method for multivariate distributions
from UQpy.distributions import *
import numpy as np
def test_beta():
result = Beta(a=1., b=2.).cdf(x=0.8)
assert result == 0.96
def test_cauchy():
assert np.round(Cauchy().cdf(x=0.8), 3) == 0.7... | true |
e50737b7cd2506226ac081d835cdf5d1a2d0df12 | ivynasantino/crawler_news | /crawler_news/spiders/carta_capital.py | UTF-8 | 3,293 | 2.6875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import scrapy
import time
import datetime
import json
from crawler_news.items import CrawlerNewsItem
class CartaCapitalSpider(scrapy.Spider):
name = 'carta_capital'
allowed_domains = ['cartacapital.com.br']
start_urls = []
def __init__(self, *a, **kw):
super(CartaCapi... | true |
b46773626f4b0ac002e263219b36b1d60a5ff90a | hecong520/kuaishang_auto | /common/common_function.py | UTF-8 | 8,015 | 3.109375 | 3 | [] | no_license | # -*- coding: UTF-8 -*-
'''
Created on 2020/2/27
@File : common_function.py
@author: ZL
@Desc :
'''
import csv
import zipfile
import os
import pandas
import re
curPath = os.path.abspath(os.path.dirname(__file__))
rootPath = os.path.split(curPath)[0]
class CommonFunction:
@staticmethod
def get_url(port, pa... | true |
d45dc4e60c00811a4b61ce883096168565916c41 | atxarib99/titanic | /svmExample.py | UTF-8 | 1,100 | 3.265625 | 3 | [
"MIT"
] | permissive | '''
This class sets up the titanic problem to be solved using SVM, Support Vector Machines.
Accuracy: 0.77511
'''
#import the SVM class
import SVM.SVM as svm
#import the model
import data.TitanicParser as model
#build the SVM trainer, use 50% of data to train, 30% to validate, and 20% to test
trainer = svm.SV... | true |
af018b14f1b6e26cee8bc4bc2436904c568341e6 | legavaz/replace | /replace.py | UTF-8 | 1,738 | 3.09375 | 3 | [] | no_license | import os
m_dir = os.path.abspath(os.path.dirname(__file__))
print('Поиск файлов *.txt в :{0}'.format(m_dir))
massif_file = []
for file in os.listdir(m_dir):
if file.endswith(".txt"):
massif_file.append(os.path.join(m_dir, file))
def save_new_txt_file(file_name,some_text):
new_name ... | true |
d74c79ac2e24994c663db563dab52e6b91a54d38 | mateuszwwwrobel/Problem-Solving-With-Algorithms-And-Data-Structures-Using-Python-by-B.-Miller-and-D.-Ranum | /Chapter1/Fraction.py | UTF-8 | 3,828 | 3.515625 | 4 | [] | no_license | """ counter = 1
done = True
while counter <= 2 and not done:
print("Lecimy z tematem.")
counter = counter+1 """
""" for item in [3,3,5,3,7,7]:
print(item)
print(item)
"""
""" x = -34
print(x)
x=abs(x)
print(x) """
""" sqlist=[]
for x in range(1,16):
sqlist.append(x*x)
print(sqlist) """
""" sqli... | true |
ad43efb91fdaf95bba87b609afa9e37d599bcde6 | CleanLivinDrew/learning_python | /check_fermat.py | UTF-8 | 474 | 3.484375 | 3 | [] | no_license | def check_fermat():
"""function to perform the fermat check"""
print('enter variable a: ')
a = input()
a = int(a)
print('enter variable b: ')
b = input()
b = int(b)
print('enter variable c: ')
c = input()
c = int(c)
print('enter variable n: ')
n = input()
n = int(n)
... | true |
7d7b0a6f4945c90ebdafdbed4b64bec062b2adf9 | charliehahn/Learn-Python-the-Hard-Way | /ex32.py | UTF-8 | 1,987 | 4.4375 | 4 | [] | no_license | the_count = [1, 2, 3, 4, 5]
fruits = ['apples', 'oranges', 'pears', 'apricots']
change = [1, 'pennies', 2, 'dimes', 3, 'quarters']
# In Python these collections of data are called "lists."
# square brackets = lists
# In many other languages they are called "arrays." FYI.
# For for-loops, structure is similar to "def" ... | true |
a38376860620dece26cfd35dfa4d80d76dda3522 | bradenwatkins/advent-of-code | /2020/python/07.py | UTF-8 | 1,547 | 3.28125 | 3 | [] | no_license | from collections import deque
def count_bags(bags, source):
queue = deque([source])
count = -1
while queue:
count += 1
queue.extend(bags[queue.popleft()])
return count
def can_carry(bags, source, target):
queue = deque([source])
while queue:
dest = set(bags[queue.poplef... | true |
eb685edefadcdbba07aede74962b37fdde305a7c | AlanLatte/MyPrograms | /python/1st_semester/labs/lab_5/lab_5.py | UTF-8 | 1,054 | 3.734375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
import numpy as np
import random, math
try:
sum_or_subtraction = None
m = int ( input( 'Укажите количество столбцов: \n'))
n = int ( input( 'Укажите количество строк: \n'))
matrix_a = np.random.randint(100, size=(n,m))
matrix_b = np.random.randint(100, size=(n,m))
print('... | true |
7f45b83787ef717cb497b8801b1e24c33d48b648 | Aasthaengg/IBMdataset | /Python_codes/p03147/s954131353.py | UTF-8 | 401 | 2.828125 | 3 | [] | no_license | # coding: utf-8
# https://atcoder.jp/contests/abc116
def main():
N = int(input())
h = list(map(int, input().split()))
H = max(h)
mat = [None] * H
for i in range(H):
mat[i] = "".join(["1" if i < h[j] else "0" for j in range(N)])
ans = 0
for i in range(H):
ans += sum([1 i... | true |
c4990e893f65d152c74b06cecfe5833cd469b162 | staho/PSI_GCP04_zima_2017-2018_Kamil_Stachowicz | /PSI_2/sigm.py | UTF-8 | 402 | 2.859375 | 3 | [] | no_license | import numpy as np
class Sigm:
def __call__(self, beta):
def sigm(x):
return 1.0/(1.0+np.exp(-beta*x))
sigm.__name__ += '({0:.3f})'.format(beta)
return sigm
def derivative(self, beta):
def sigmDeriv(x):
return beta*np.exp(-beta*x)/((1.0+np.exp(-beta*x))**2... | true |
62574f53ef4a40ecb2831af0f9cdd85cd28bdfa0 | maartenbreddels/mab | /mab/stat/plots.py | UTF-8 | 2,289 | 2.65625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
from kaplot import *
class Plot4(object):
def __init__(self, f):
self.f = f
def run(self, args, opts, scope):
box()
dp = 0.001
p = arange(dp/2, 1+dp/2, dp)
x = self.f.R(p)
y = self.f(p)
print x
print y
graph(x, y)
#ylim(0, 1)
draw()
class PlotEdgeworth(objec... | true |
3932afaf5e9f31650ccef194a1ff2245c55705df | rain-zhao/leetcode | /py/Task1207.py | UTF-8 | 388 | 3.375 | 3 | [] | no_license | from typing import List
from collections import Counter
class Solution:
def uniqueOccurrences(self, arr: List[int]) -> bool:
counter = Counter(arr)
s = set()
for num in counter:
if counter[num] in s:
return False
s.add(counter[num])
return Tr... | true |
2c268c07cd95be78523fbdba3896fe22672d6fb2 | maizzuu/ot-harjoitustyo | /src/tests/month_repository_test.py | UTF-8 | 2,198 | 3.140625 | 3 | [] | no_license | import unittest
from entities.user import User
from entities.month import Month
from repositories.month_repository import month_repository
class TestMonthRepository(unittest.TestCase):
def setUp(self):
month_repository.delete_all()
self.user = User('Daniel', 'salasana')
self.june = Month('... | true |
b9011c5df9602d957659c4a018f39cbfa886510e | Aasthaengg/IBMdataset | /Python_codes/p03963/s080866112.py | UTF-8 | 85 | 2.734375 | 3 | [] | no_license | n,k= map(int,input().split())
if n==1:
print(k);exit()
print(k*((k-1)**(n-1)))
| true |
f548fb8a0fd062d331cb63a074f1e0f5b0c6febe | pdugan20/smc-cis-680mc | /Lab4/functions_lab4.py | UTF-8 | 1,139 | 3.796875 | 4 | [] | no_license | #!/usr/local/bin/python3
# Douglas Putnam
# functions_lab4.py
def main():
print(sum_all(1,2,43))
print(get_volume(c=12,b=2,a=99))
for a in alphas():
print(a)
@td_decorator
def test_td(alist):
for a in alist:
print(a)
test_td(1,2,3,4)
# alphas()
# One Way
def alphas()... | true |
4da74e97e4abc78f784278a7eb25bc404047481e | cardin-higley-lab/CBASS | /python/Pipeline/.ipynb_checkpoints/CLAMS_L1_AddPhaseRandomizedSignal-checkpoint.py | UTF-8 | 2,215 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | from sklearn.decomposition import PCA
import numpy as np
import time
from Pipeline.Utilities.CBASS_U_PhaseRandomize1D import PhaseRandomize1D
def AddPhaseRandomizedSignal(sREC, sOPTION):
'''
Part of L1 of the bout pipeline. Creates surrogate LFP having the same
covariance matrix and the same spectral den... | true |
a73d512812dddad5612f41c7865a2ba4d6fdb612 | davidebrunetto94/big_data_project_2020 | /proj/trend_graphs.py | UTF-8 | 1,771 | 2.921875 | 3 | [] | no_license | import datetime
import time
import matplotlib.dates as mdates
import matplotlib.pyplot as plt
from data_manipulation import get_avg_tweet_sentiment_df, get_tweet_count_df
from get_spark_context import get_spark_sql_context
spark, sqlContext = get_spark_sql_context()
# This module generates the graphs for the sentime... | true |
245aa2e6c8b1b63d65c54f28c6e05795e4a7106a | JesseLivezey/appliancescience | /ApplianceFeatures.py | UTF-8 | 48,593 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python
# encoding: utf-8
"""
ApplianceFeatures.py
Extract features from Belkin energy training data.
Created by Adam N Morgan on 2013-08-25.
"""
import sys
import os
import unittest
import numpy as np
from matplotlib.pylab import *
from scipy import io
from cmath import phase
import sys
import cPickle... | true |
5a5a7147bc3ecbed5e7600b3c3753d854e3a6eff | MonsterDove/PaddleRec | /models/rank/dlrm/net.py | UTF-8 | 6,445 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | true |
482ef098953e9a43516b919965f76755f4350076 | marcos7almeida/PythonClass | /Lista de Exercícios 2 Q9(25.10).py | UTF-8 | 807 | 3.59375 | 4 | [] | no_license |
def test():
import doctest
doctest.testmod(verbose=True)
def sorted_numbers(a,b,c):
"""
>>> sorted_numbers(9,6,7)
6,7,9
>>> sorted_numbers(8,5,1)
1,5,8
>>> sorted_numbers(2,6,7)
2,6,7
"""
if a < b and b < c:
print(a,b,c)
elif a < c and c < b:
print... | true |
4c87712c8168dcd32f54620df913c858e5b59a94 | Darkbladecr/MND-patient-dashboard | /server/apis/patientsImport.py | UTF-8 | 3,634 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive | """
Patient Excel Importer.
Imports the patient details from a standardized excel
workbook and then inserts them into mongoDB
"""
from datetime import datetime, date
from pprint import pprint
from bson.objectid import ObjectId
from openpyxl import load_workbook
from pymongo import MongoClient
_id = '58ef74e7e500480... | true |
e1d58b6118c600a8d047023ab8c046ba73449b58 | ppapalampidi/GraphTP | /modules/helpers.py | UTF-8 | 2,554 | 2.71875 | 3 | [] | no_license | import torch
from torch.nn import functional as F
def sequence_mask(lengths, max_len=None):
"""
Creates a boolean mask from sequence lengths.
"""
batch_size = lengths.numel()
max_len = max_len or lengths.max()
return (torch.arange(0, max_len, device=lengths.device)
.type_as(lengths... | true |
b9f56beb40136a21ddd7e42c00b6f5b7346ccbef | Aasthaengg/IBMdataset | /Python_codes/p02791/s824646495.py | UTF-8 | 300 | 2.609375 | 3 | [] | no_license | from sys import exit
import math
import collections
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))
n = ii()
p = li()
min_p = p[0]
cnt = 0
for i in range(n):
if min_p >= p[i]:
cnt += 1
min_p = min(min_p,p[i])
print(cnt) | true |
5f33ac63264b6b676c207613fc9dd8e000ba7e33 | Aasthaengg/IBMdataset | /Python_codes/p03730/s219610080.py | UTF-8 | 216 | 3.34375 | 3 | [] | no_license | s = input().split()
a = int(s[0])
b = int(s[1])
c = int(s[2])
check = False
for i in range(b):
p = a * i
if p % b == c:
check = True
break
if check:
print('YES')
else:
print('NO')
| true |
0439ee18e23abdf060d238846f8035d8bdff124a | guptachetan1997/YoutubeLikesPredictor | /utils/loklak_search.py | UTF-8 | 1,086 | 3.140625 | 3 | [
"MIT"
] | permissive | """
Use LokLak to get approxiamated twitter feed of 100 tweets
Then get following features from it:
Search using the cleaned titles:
so first clean the title
1. Number of HITS
2. Number of Countries using "place_country_code"
"""
import requests
import json
import time
import random
import datetime
def getTw... | true |
74acc61af1979641066b11219614e7fcfe8bcf32 | roby10/PredictNews | /DJIApart1.py | UTF-8 | 6,037 | 2.9375 | 3 | [] | no_license | import pandas as pd
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.linear_model import LogisticRegression
from nltk.corpus import stopwords
from sklearn.metrics import classification_report
from sklearn.metrics import f1_score
from sklearn.metrics import accuracy_score
from sklearn.metrics im... | true |
ed209e2d1efdb774e364f939fbf99f32effcff1d | Aionrichman/py_fun | /coroutineTest/coroAverage1.py | UTF-8 | 729 | 2.859375 | 3 | [] | no_license | """
>>> coro_avg = averager()
>>> from inspect import getgeneratorstate
>>> getgeneratorstate(coro_avg)
'GEN_SUSPENDED'
>>> coro_avg.send(10)
10.0
>>> coro_avg.send(30)
20.0
>>> coro_avg.send(5)
15.0
>>> coro_avg.send('spam')
Traceback (most recent call last):
...... | true |
d5a91a4ca3bd0a15f26efe7f60f2058d69dcd6f0 | wanglinjie/coding | /leetcode/intersectionoftwoarraystwo.py | UTF-8 | 1,312 | 3.703125 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# date:20160611
class Solution(object):
def intersect(self, nums1, nums2):
"""
:type nums1: List[int]
:type nums2: List[int]
:rtype: List[int]
Given two arrays, write a function to compute their intersection.
Example:
Given nums1 = [1,... | true |
c8da8c773a3544fff2c7c9c79edef731d4edd8ac | lmql-lang/lmql | /evaluation/result_utils.py | UTF-8 | 1,355 | 2.609375 | 3 | [
"Apache-2.0",
"MIT"
] | permissive | import pandas as pd
import os
def reasoning(row):
lines = row.interaction_trace.split("\n")
for i in range(len(lines) - 1, 0, -1):
if "Let's think step by step." in lines[i]:
break
lines = lines[i:]
return "\n".join(lines)
class Results:
def __init__(self, task):
i... | true |
f8ec150ac15596bc26e8b30417e8cde59d5800b8 | GrishonNganga/Bankr | /bank.py | UTF-8 | 965 | 3.25 | 3 | [] | no_license | import uuid
class User():
def __init__(self, first, last, dob, id):
'''
Create bank user.
'''
self.first = first
self.last = last
self.dob = dob
self.id = id
self.accounts = [] # Ids of the accounts (Account number)
def create_account(self, amount... | true |
f7102ecd5b21eaba51931b346b6f21e9ea02ab33 | lordjuacs/ICC-Trabajos | /Ciclo 1/Examen2/test.py | UTF-8 | 676 | 3.765625 | 4 | [] | no_license | def construccion_dic(n):
dic = {}
for i in range(1, n + 1):
(fecha, valor) = input("Registro " + str(i) + ": ").split(" ")
if fecha in list(dic.keys()):
dic[fecha].append(float(valor))
else:
dic[fecha] = []
dic[fecha].append(float(valor))
return di... | true |
e8ef3265cbf163d25fbc5c1b2d530465a5259c44 | NaN-xyz/thundernixon-glyphs_scripts | /report-path-directions.py | UTF-8 | 535 | 3.515625 | 4 | [
"Apache-2.0"
] | permissive | #MenuTitle: Report Path Direction
# -*- coding: utf-8 -*-
__doc__="""
Go through all glyphs and report path directions.
"""
font = Glyphs.font
clockwise = 0
counterClockwise = 0
for glyph in font.glyphs:
for layer in glyph.layers:
for path in layer.paths:
if path.direction == 1:
... | true |
c555b62f95a967a7bdeedf578ecf25a029991d09 | Jason101616/LeetCode_Solution | /Dynamic Programming/688. Knight Probability in Chessboard.py | UTF-8 | 2,167 | 3.9375 | 4 | [] | no_license | # On an NxN chessboard, a knight starts at the r-th row and c-th column and attempts to make exactly K moves. The rows and columns are 0 indexed, so the top-left square is (0, 0), and the bottom-right square is (N-1, N-1).
#
# A chess knight has 8 possible moves it can make, as illustrated below. Each move is two squar... | true |
36caf38733571477b761a7ad1294630d01ece8dd | Hee0305/pandas | /4장_시각화 도구/pd_17.py | UTF-8 | 1,975 | 3.671875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# 148p 회귀선이 있는 산점도 ( regplot() 함수는 서로 다른 2개의 연속 변수 사이의 산점도를 그리고 선형 회귀분석에 대한 회귀선을 나타냄)
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
titanic=sns.load_dataset('titanic')
print(titanic.head())
print('\n')
print(titanic.info())
sns.set_style('darkgrid')... | true |
4466f1366b91499b6a1573b045b57aceb43d95ba | hurtnotbad/pythonStudy | /studyNotes/method/keywordTest.py | UTF-8 | 768 | 3.78125 | 4 | [] | no_license | import keyword
"""
关键字是python内置的、具有特殊意义的标识符,可通过print(keyword.kwlist) 查看所有关键字有如下:
['False', 'None', 'True', 'and', 'as', 'assert', 'break', 'class',
'continue', 'def', 'del', 'elif', 'else', 'except', 'finally',
'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda',
'nonlocal', 'not', 'or', 'pass', 'raise',... | true |
4405c75b055376bdb6ffbee5369db4d368b5c45b | jDiazPrieto/Perceptron_model | /perceptron.py | UTF-8 | 3,492 | 3.765625 | 4 | [] | no_license | import random
from math import dot_product
class Perceptron:
def __init__(self):
self.W = None
self.learning_rate = 0
self.performance = None
def predict(self, xi):
"""
This function returns the classfication for observation xi using our model's weights
and a h... | true |
e20596471f5b903ebee2a8691535ecd634fca463 | Aasthaengg/IBMdataset | /Python_codes/p03417/s704348532.py | UTF-8 | 121 | 2.875 | 3 | [] | no_license | n, m = map(int, input().split())
if n*m == 1:
print(1)
elif m*n == 4:
print(0)
else:
print(abs((n-2)*(m-2))) | true |
424527157386d0074c47d3f6eafb69d7a45e774e | MaxSaunders/1aDay | /round_sum.py | UTF-8 | 723 | 4.5 | 4 | [] | no_license | """
For this problem, we'll round an int value up to the next multiple of 10
if its rightmost digit is 5 or more, so 15 rounds up to 20.
Alternately, round down to the previous multiple of 10 if its rightmost
digit is less than 5, so 12 rounds down to 10. Given 3 ints, a b c,
return the sum of their rounded va... | true |
0a43bcef62948bd35fda7f5403443078bd896cd9 | Jayshri15/request | /main.py | UTF-8 | 4,739 | 2.859375 | 3 | [] | no_license | import requests
import json
result=requests.get('https://saral.navgurukul.org/api/courses')
data=result.json()
with open("availableCourses.json","w")as f:
json.dump(data,f,indent=4)
def opt(select,var2,slug,data2):
while True:
x=var2
print(".....................")
options=input("enter yo... | true |
349948058e2fe5009ff56c2d5c98afeb93237e02 | yuyexiaohan/python_base | /apps/offer_algorithm/11-二进制中1的个数.py | UTF-8 | 936 | 3.4375 | 3 | [] | no_license | # coding=utf-8
# Time : 2019/2/14
# Author : achjiang
"""
输入一个整数,输出该数二进制表示中1的个数。其中负数用补码表示。
"""
#
# class Solution:
# def NumberOf1(self, n):
# # write code here
class Solution:
def NumberOf1(self, n):
# write code here
return bin (n).replace ("0b", "").count ("1") if n >= 0 else bin (2 ** 32 + n).replace ("0b... | true |
c840c72c545bdb9bfd2be32b3b5571053fa00ae0 | MrBrunotte/python-crash-course-notes | /exercises_functions.py | UTF-8 | 10,629 | 4.28125 | 4 | [] | no_license | # 8.1 - Message
excercise = "8.1 - Message"
print("\n#--------------------------------------------------#")
print("\t" + excercise.upper() + "\t")
print("#--------------------------------------------------#\n")
def display_message():
"""A function that prints what I am learning in this chapter"""
print("In th... | true |
4698899d119b42b68f864558bbb7952994be1ec1 | N0urM/Mines | /metal Detector.py | UTF-8 | 1,098 | 2.984375 | 3 | [] | no_license | import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
metalPin = 36
Trig = 40
echo = 38
GPIO.setup (Trig , GPIO.OUT)
GPIO.setup (echo , GPIO.IN)
GPIO.setup (metalPin , GPIO.IN)
print ("Hello Echo !")
time.sleep (0.1)
def measure () :
GPIO.output (Trig , True)
time.sleep (0.00001)
GPIO.outp... | true |
0638d34671b9d1a6b9ea495a1abfb08bf0a3ddff | zzh89982330/Final-Year-Project-Novel-View-Synthesis-Problem-Using-Deep-Learning-Method | /dataset.py | UTF-8 | 4,714 | 2.71875 | 3 | [] | no_license | from torch.utils.data import Dataset
import os.path as path
import cv2
from graphics import *
def read_raw_tensorimg(folder, x_idx):
img_name = "Frame_" + str(int(x_idx)).zfill(3) + '.png'
img_path = path.join(folder, img_name)
img = cv2.imread(img_path) / 255
return img
class TrainingDataset(Dataset)... | true |
1b5ffbfa8f9650f51519304597ec1c6476e0df38 | daxiazhuluoji/Python-sample | /test_6.1.py | UTF-8 | 1,189 | 3.515625 | 4 | [
"MIT"
] | permissive |
#def myFirstFunction(name,code):
def myFirstFunction(name='lidianjun',code='123456'):
"""
here is function document string
"""
print("this is my first python function")
if (name == 'lidianjun') and (code == '123456'):
print('use default params')
return 'code_right'
elif (name ... | true |