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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
49cb23b1e913593aed82077ac848ea23dfa073fe | Python | LucianoBI/POO | /assets/provas/prova-1/questao1/Main.py | UTF-8 | 323 | 3.109375 | 3 | [] | no_license | from Pessoa import Pessoa
from CalculadoraAfinidade import CalculadoraAfinidade
pessoa1 = Pessoa("Coutinho", 27)
pessoa2 = Pessoa("Neymar", 26)
calculadora = CalculadoraAfinidade()
afinidade = calculadora.calcular_afinidade(pessoa1,pessoa2)
print("Afinidade entre %s e %s = %d " % (pessoa1.nome, pessoa2.nome, afinidad... | true |
52e8055f04087945bcdcd69d4dd0a23de2ce0b2a | Python | AlessandroFC15/Python | /instagramProfilePic.py | UTF-8 | 875 | 3.4375 | 3 | [] | no_license | import urllib
def get_page(username):
url = "https://instagram.com/" + username
try:
return urllib.urlopen(url).read()
except:
return ""
def download_pic (url, name):
urllib.urlretrieve(url, name)
def get_profile_pic (username):
page = get_page(username)
if page == "":
print "# FAILED TO DOWNLOAD #"... | true |
b776231401368a9a9d9182b581b7c3683b769b3a | Python | Jaredbartley123/Lab-5 | /targetmark.py | UTF-8 | 1,188 | 4.09375 | 4 | [] | no_license | def calculateTargetMark(mm,tp):
mm=int(mm)
tp=int(tp)
tm=mm*(tp/100)
return tm
while True:
try:
#student inputs maximum mark of test
maxMarks = input("Please enter the maximum mark of the assignment ... ")
maxmarks = int(maxMarks)
except(ValueError):
... | true |
f73a5270c7320eecd02013bd0204eea9c5064450 | Python | joelwitherspoon/PythonCrashCourse | /die_visual.py | UTF-8 | 717 | 3.40625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Mar 2 15:06:47 2020
@author: jwitherspoon
"""
from die import Die
import pygal
#create a D6
die = Die()
#make some rolls and store rolls in list
results = []
for roll_num in range(1000):
result = die.roll()
results.append(result)
#analyze the results
frequencies =... | true |
2933d405ac2815be2a0a555620f015fa02e7382f | Python | lch1000m/Code_Snippets | /python/multiprocessing/pgm2.py | UTF-8 | 198 | 2.703125 | 3 | [] | no_license |
import time, os
def run_program():
print('pgm start!')
time.sleep(30)
print('pgm end!')
if __name__ == '__main__':
print('pid is {0}'.format(os.getpid()))
run_program()
| true |
00c0cc23d0a35ea0b645a9c4546b8ca6404b8745 | Python | marannan/repo_1 | /OS/p2/xv6/mlfq2.py | UTF-8 | 461 | 2.6875 | 3 | [] | no_license | __author__ = 'Ashok Marannan'
import matplotlib.pyplot as plt
plt.xlabel("Time -->")
plt.ylabel("Priority Queue -->")
plt.plot([1,2,3,4,5,6,7,8,9,10,11], [0,1,1,2,2,2,2,3,3,3,3],marker="*",label="P1")
plt.plot([3,7,8,11,12,13,14,19], [0,1,1,2,2,2,2,3],marker="^",label="P2")
plt.plot([4,9,10,15,16,17,18,20,21,22],... | true |
66617b63bfe1e55bf4379f0d4c94645ef6cfb9ad | Python | chrisvonbienias/HeritageAddon | /curvature.py | UTF-8 | 3,715 | 2.625 | 3 | [] | no_license | import bpy
import bmesh
from mathutils import Vector
from collections import defaultdict
import numpy as np
import colorsys
class HERITAGE_OT_CheckCurvature(bpy.types.Operator):
bl_idname = "heritage.check_curvature"
bl_label = "Calculate curvature"
bl_description = "Calculate minimal and maximal mesh cur... | true |
cabf42ba31a685f1e110f2e6ce42b289b7ece9f2 | Python | andy1li/adventofcode | /2018/day22_cave.py | UTF-8 | 2,804 | 3.34375 | 3 | [] | no_license | # https://adventofcode.com/2018/day/22
from advent import get_neighbor_items, iterate
from typing import NamedTuple
import networkx
import numpy as np
class Pos(NamedTuple): x: int; y: int
def scan_cave(depth, target, MOD=20183):
y_times, x_times = 2, 3
cave = np.zeros((target.y*y_times, target.x*x_times), d... | true |
60e82367887d127aa441291f059f6e91b5b3823b | Python | sweekar52/APS-2020 | /Daily-Codes/togglingCases.py | UTF-8 | 163 | 3.71875 | 4 | [] | no_license | char = input("Input the character whose case has to be toggled ")
asci = ord(char)
if asci < 97 :
asci |= 32
else :
asci &= 95
char = chr(asci)
print(char) | true |
b26cf9fe1ce0d046915104e1cbca34dc516521ed | Python | wiktorski/data-intensive-systems-ed1 | /multiline_input.py | UTF-8 | 805 | 2.53125 | 3 | [] | no_license | from mrjob.job import MRJob
import random
class MRMultilineInput(MRJob):
def mapper_init(self):
self.message_id = ''
self.in_body = False
self.body = []
def mapper(self, _, line):
line = line.strip()
if line.find('Message-ID:') == 0:
self.... | true |
d8d038f0862006370b1771b6d2993370403117f9 | Python | lmlmsan/pyblog | /www/hannuota.py | UTF-8 | 370 | 3.59375 | 4 | [] | no_license | #! /usr/local/bin/python3.7
# -*- coding: utf-8 -*-
#汉诺塔规则:
#每次只能挪动一个,且大盘在下小盘在上,借助中间盘从开始盘挪到终点盘
def mov(n,a,b,c):
if n == 0:
print("不能输入为0")
if n == 1:
print(a+" --> "+c)
if n == 2:
print(a+" --> "+b)
print(a+" --> "+c)
print(b+" --> "+c)
else:
mov(2,'A','B','C')
| true |
f140d478f5b5f903b9334f1cbf0af3d2b9d5ec08 | Python | hppRC/nlp100knocks | /chapter2/17.py | UTF-8 | 168 | 3.28125 | 3 | [] | no_license | with open("popular-names.txt") as f:
first_columns = set(line.strip().split("\t")[0] for line in f.readlines())
print(*sorted(first_columns), sep="\n", end="")
| true |
4fc6bd0a14c0cafc513527aeb5bb163be3e7ec97 | Python | ajagdev/seng480a | /python/p3.py | UTF-8 | 4,302 | 2.5625 | 3 | [] | no_license | import tkinter
import visualization
import time
import random
from multiprocessing import *
from visualization import TrafficVisualization
# Generates poison distribution for triggers with a mean time of 1 per 20 seconds for each trigger, not exceeding 30 seconds.
# If nonDeterminism is false just sleeps
de... | true |
df51d188ceffbf8119ac425702b0747684e5d244 | Python | Kristin-ZLCHEN/spektral | /spektral/layers/ops.py | UTF-8 | 15,047 | 2.859375 | 3 | [
"MIT"
] | permissive | import numpy as np
import scipy.sparse as sp
import tensorflow as tf
from tensorflow.keras import backend as K
from tensorflow.python.ops.linalg.sparse import sparse as tfsp
modes = {
'S': 1, # Single (rank(a)=2, rank(b)=2)
'M': 2, # Mixed (rank(a)=2, rank(b)=3)
'iM': 3, # Inverted... | true |
70f8ecf35547b101a4b82f026c8e8c749c558ebd | Python | stephenbradshaw/pentesting_stuff | /clients/tcp_sender.py | UTF-8 | 1,231 | 2.8125 | 3 | [
"BSD-3-Clause"
] | permissive | import socket
import ssl
def send_receive(host: str, port: int, filename: str, wrap_ssl: bool=False, sni_hostname: str=None, timeout: int=5):
'''Connect to host on given TCP port, with optional ssl wrapping, send data from provided filename, and return response'''
client_socket = socket.socket()
client_soc... | true |
2ee25a438eee2ad91512155a8b0809ba0d14ebdc | Python | jjspetz/FCC-backend-projects | /URLshortener/main.py | UTF-8 | 1,374 | 3.28125 | 3 | [] | no_license | import random
import validators
from flask import Flask, redirect
app = Flask(__name__)
# 1. create variable for storage ****
# 2. /new/<url> route assigns short random url and saves url into storage ****
# 3. random url in storage redirect to original page ****
# 4. url validator ****
# 5. add basic homepage
# 6. dep... | true |
8958021b4dd17d83804f84e52ff68a2af3c84722 | Python | djchain/ICHI2019-Hospital-NLP | /train_text.py | UTF-8 | 3,701 | 2.515625 | 3 | [] | no_license | """
Created on Jan 17, 2019
Group activity label classification based on text data.
Using transformer structure (self-attention) without any fusion models.
Experiment is based on 67 trauma cases, input samples is sentence-level data.
@author: Yue Gu, Ruiyu Zhang, Xinwei Zhao
"""
from __future__ import print_function
f... | true |
b271c0c6f96e1e9b3d652f44e79dfe950db1de8f | Python | mamemilk/acrc | /プログラミングコンテストチャレンジブック_秋葉,他/src/2-5-1_01_abc126_d.py | UTF-8 | 505 | 3.109375 | 3 | [] | no_license | # https://atcoder.jp/contests/abc126/tasks/abc126_d
import sys
sys.setrecursionlimit(100000)
N = int(input())
G = [[] for _ in range(N+1)]
color = [-1 for _ in range(N+1)]
for _ in range(N-1):
u, v, w = map(int, input().split())
G[u].append((v,w))
G[v].append((u,w))
def dfs(v, c):
color[v] = c
for ... | true |
cce7850656d0350233b706eb17c8b26862a6bb36 | Python | bernardli/leetcode | /51-100/80_Remove_Duplicates_from_Sorted_Array_II.py | UTF-8 | 728 | 3.359375 | 3 | [] | no_license | from typing import List
class Solution:
def removeDuplicates(self, nums: List[int]) -> int:
if len(nums) == 0:
return 0
currNum = nums[0]
currNumCount = 1
tailPointer = 0
for idx in range(1, len(nums)):
if nums[idx] == currNum:
currNu... | true |
6e8c866d6bf7178db5ca3d760ccd9094a3ba56c5 | Python | JRC1995/Tweet-Disaster-Keyphrase | /Data/data_analysis.py | UTF-8 | 1,393 | 3.109375 | 3 | [
"Apache-2.0"
] | permissive | import json
count_data = {}
total_count = 0
train_count = 0
dev_count = 0
test_count = 0
def count(filename, key):
global count_data
global train_count
global dev_count
global test_count
global total_count
with open(filename) as file:
for json_data in file:
obj = json.loa... | true |
6dd3a4f2726e5724634d7380eaaed9879c6f374c | Python | jmrinaldi/epigenetics-software | /Epigenetics/WaveGenerator/Utilities/AlignedReadObjPET.py | UTF-8 | 798 | 3.125 | 3 | [] | no_license | '''
Created on 2013-01-28
@author: fejes
'''
class AlignedReadObjPET():
'''An object to hold PET aligned read objects, mainly from BAM files'''
def __init__(self, chr_id, le, re, read1, read2):
'''Create the object, store coordinates and reads'''
self.left_end = le
self.right_end = re... | true |
2fdb78dfcc8ccff568731f691750b056df64bab9 | Python | camilapulido/course-material | /exercices/080/solution.py | UTF-8 | 250 | 3.328125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Sep 23 18:42:03 2014
@author: Camila
"""
data = ["a", "b", "c", "d", "e", "f", "g", "h"]
for i in range(len(data)):
for f in range(i+1,len(data),1):
if i!=f:
print (data[i]+data[f]) | true |
4e9d5f36db7b9e40b5a80e394ba752f6214371af | Python | Barbapapazes/dungeons-dragons | /utils/hud.py | UTF-8 | 6,911 | 2.75 | 3 | [
"MIT"
] | permissive | import pygame as pg
from os import path
from sprites.player import Player
from config.window import TILESIZE, WIDTH, HEIGHT
from config.colors import RED, GREEN, CYAN, DARKGREY, GOLD, BLACK
from config.sprites import ITEMS, PLAYER_MAX_HP, PLAYER_MAX_MP
from utils.container import Container
class Hud:
"""Create th... | true |
2974e8c24549e95fd7a18b68e1a8db9f74352f37 | Python | xbw1266/self_driving_rc | /train_data/train.py | UTF-8 | 3,096 | 2.65625 | 3 | [] | no_license | import csv
import cv2
import numpy as np
filepath = '/home/bowen/data_new/'
filename = 'record.csv'
lines = []
key_map = {"a": [15, 30], "w": [25, 25], "s": [-25,-25], "d": [30, 15], " ": [0, 0]}
with open(filepath + filename) as f:
reader = csv.reader(f)
for line in reader:
lines.append(line)
images = []
meas... | true |
3acf8dc82abdfcdffd259d984f0fbbbc10059aca | Python | ModelOriented/MAIR | /scripts/citations_graph.py | UTF-8 | 2,193 | 2.96875 | 3 | [] | no_license | # get all arxiv ids
# fetch metadata from Semantic Scholar for all of them and dump it
# visualize the citation graph
# what is most cited?
# What are the most frequent authors by name/id?
import json
import os
import time
from collections import Counter
import semanticscholar as sch
GRAPH_JSON = "../data/arxiv_dump... | true |
5e72821d37e5dd6c277cd9de5ccdb446c71be772 | Python | shaojim12/my_leetcode | /91.decode-ways.py | UTF-8 | 538 | 2.859375 | 3 | [] | no_license | #
# @lc app=leetcode id=91 lang=python3
#
# [91] Decode Ways
#
# @lc code=start
class Solution:
def numDecodings(self, s: str) -> int:
if not s:
return 0
dp = [0 for x in range(len(s) + 1)]
dp[0] = 1
dp[1] = 1 if 0 < int(s[0]) <= 9 else 0
for i in range(1, len(... | true |
3474378aa70150e4b54a45b0ba55400470c2165d | Python | cash2one/5173.com | /monitor/test/b64.py | UTF-8 | 646 | 2.78125 | 3 | [] | no_license | import base64
import time
import datetime
a = ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
c = 'YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWF\r\nhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYW\r\nFhYWFhY... | true |
25adb355927e76e915a63c44c9c0de9e5a8c846e | Python | KunalSharma3197/Flappy-Bird | /bird/Bird.py | UTF-8 | 1,892 | 3.390625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
# Class representing bird in the game
import pygame
from pygame.locals import *
class Bird(pygame.sprite.Sprite) :
def __init__(self, x, y, flying, game_over) :
pygame.sprite.Sprite.__init__(self)
self.images = []
self.index = 0
self.counter = 0
for i... | true |
2e271acb8f05aa8ecc637943b2b244e13a961d3e | Python | python402837617/python2 | /联手.py | UTF-8 | 815 | 3.03125 | 3 | [] | no_license | from enum import IntEnum,unique
from 类 import Human
class Sb(Human):
sex=18
def __init__(self,name,age):
super(Sb,self).__init__(name,age)
def sb_name(self):
print(self.name)
@classmethod
def sb_sex(cls):
print(cls.sex)
@unique
class shitang(IntEnum):
yst=1
est=2
... | true |
14ef524c1e72391412da3120bc30352f1521f3a2 | Python | VikMaamaa/python-projects | /Project 7/curse.py | UTF-8 | 869 | 3.3125 | 3 | [] | no_license | import random
Noun = ('Goat','Fool','Thief','Bastard','Dog','Fish','Idiot','asshole','bitch','nigga','empty brain','gold digger')
Adjective = ('Ugly', 'poor', 'Sweet', 'Red', 'Black', 'Bitter',
'wonderful', 'gentle', 'unfortunate', 'sleepy', 'foolish', 'quick',
'Crazy','stupid','rotten... | true |
cdb95feed58cf60a4a09c7b147aae4a9f6bf666b | Python | abhay27chauhan/Python-concepts | /operator.py | UTF-8 | 1,183 | 4.875 | 5 | [] | no_license | '''
# 1 operations in python
2 + 3
7 - 4
3 * 2
10 % 2
6 / 3 -> 2.0 (always give float)
2 ** 3 -> 2*2*2
10 * 'str' -> 'strstrstrstrstrstrstrstrstrstr'
# 2 operators precedence -
1. () -> parentheses
2. ** -> exponents
3. * / -> both have same precedence, anyone of the two operators coming 1st in
e... | true |
3c613a16faa3ee20f5280f0f4d667b9e6f88e72b | Python | AjinkyaTaranekar/AlgorithmX | /Codeforces/118/B.py | UTF-8 | 241 | 3.46875 | 3 | [] | no_license | n = int(input())
for i in range(-n, n+1):
top = n - abs(i)
for j in range(abs(i)):
print(" ", end="")
for j in range(top):
print(j, end=" ")
for j in range(top, 0, -1):
print(j, end=" ")
print(0)
| true |
991a5a4b0cc82cb4e4cbaf5bf120c0150d5049a6 | Python | cr21/neuralNetwork | /nn/conv/lenet.py | UTF-8 | 1,069 | 2.53125 | 3 | [] | no_license | from tensorflow.keras.layers import Conv2D
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Activation
from tensorflow.keras.layers import MaxPool2D
from tensorflow.keras.layers import Flatten, Dense
from tensorflow.keras import backend as K
class Lenet():
@staticmethod
de... | true |
82edb74d29671c73df9f1f7254b52f516b1d33e5 | Python | sparckix/BlurConcurrentProgramming | /blur.py | UTF-8 | 3,406 | 2.96875 | 3 | [
"Apache-2.0"
] | permissive | '''Archivo de ayuda para el procesamiento de la imagen. Hay que tener en cuenta que se trata de una simulacion y que por tanto
se usa memoria compartida. En un caso real distribuido la imagen podria estar en un servidor central y cada nodo cogeria su "trozo", por ejemplo'''
import sys
import Image, numpy, ImageFilter
i... | true |
5126769342ac1c4d27ad95f9967011d09b2006e5 | Python | jfsawyer88/CodeEval | /2-Moderate/076-StringRotation/StringRotation.py | UTF-8 | 501 | 3.1875 | 3 | [] | no_license | ## CodeEval
## String Rotation
import sys
f = open(sys.argv[1], 'r')
for line in f:
line = line.strip()
if line:
line = line.split(',')
s = line[0]
t = line[1]
out = False
if len(s) == len(t):
for i in xrange(len(t)):
if s == t[i:] + t[:i]... | true |
7ea8dcfc70253ef558495255b24113f76151f2be | Python | horseno/userStudy | /process_result/parse_result.py | UTF-8 | 1,521 | 2.828125 | 3 | [] | no_license | import os
import pandas as pd
import pre_process
import numpy as np
'''Retrieve data from DB and parse result to determine rejections.
Rules:
- If all the responses are the same.
- If there are more than 3 occurrences with rt<=500ms => reject
- If there are more than 5 occurrences with obvious wrong answ... | true |
e93407ef888a1760b724682a5e489870c3c4b7df | Python | rhorrace/CS445-MachineLearning | /HW2/experiment2.py | UTF-8 | 2,355 | 3.25 | 3 | [] | no_license | # Robert Horrace
# 967743553
import numpy as np
import network as N
# begin function declarations
# Convert actual to output targets
def identity(n):
matrix = np.identity(n, dtype = float)
matrix = np.where(matrix == 1, 0.9,0.1)
return matrix
# end convert
# Begin Assigment 2 program
#epochs
epochs = 50
# Nu... | true |
a4991f9b9cfbab1a9dd23d4849dc9b15d0ac47c9 | Python | zzxuanyuan/machine-learning-project | /merge_preempt.py | UTF-8 | 951 | 2.890625 | 3 | [] | no_license | # This file merges LightPreempted, HeavyPreempted and Weird(A job id only occurs once but the last job activity was Busy)
# into Preempted. The output file will be used for classification
import sys
import csv
preemptDict = dict()
lines = list()
with open(sys.argv[1], 'r') as fr:
for row in csv.reader(fr):
if(ro... | true |
528d56a0a74db01e931e26f3dbc10d99ed0cac48 | Python | sudeepigntion/machine_learning | /Language Recognizer/Init.py | UTF-8 | 2,028 | 3.265625 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
import pandas as pd
from nltk.corpus import stopwords
stop = stopwords.words('english')
# print(stop)
train = pd.read_csv("reviews.csv")
# Note *
# We shall make use if the Ney York Times user comments (from Kaggle Datasets)
# Once we create the language classifier, we w... | true |
38fedaa30d0e0dd3725af37d40ee57740ab16bf5 | Python | ttanay/GSFacebookLeads | /src/db_io.py | UTF-8 | 3,773 | 2.75 | 3 | [] | no_license | import sqlite3
import time
def open_connection(db_name='gs_leads.db'):
conn = sqlite3.connect(db_name)
return conn
def create_table_leads(conn):
sql_statement = '''CREATE TABLE IF NOT EXISTS leads(
fb_profile_link TEXT UNIQUE NOT NULL,
name TEXT NULL... | true |
6a64a664d63ce7d5a33d37a25b62fb857366cc43 | Python | dc-liska/python-challenge | /PyBank/main.py | UTF-8 | 1,825 | 3.109375 | 3 | [] | no_license | #main.py for PyBank, by David Liska
import os
import csv
csvpath = "C:/Users/Lightman/Documents/Boot Camp/Assignments/03-Python/Instructions/PyBank/Resources/budget_data.csv"
monthcount =0
cashtotal =0
prevRowValue =0
profitChange =0
runningChange =0
averageChange =0
topProfits =0
topLoss =0
changes = []
with open(c... | true |
f4db2f7a71676afb368ed100c4fd01ae38d465ec | Python | Latishfaction/python-OOP-practice | /encapsulation/nameMangling-privateFeils.py | UTF-8 | 962 | 4.75 | 5 | [] | no_license | '''Encapsulation: Name Mangling and Private Feilds '''
'''Private Feilds: To make the initialization to private variable so that we can not access it directly but we can access it from function and make use of that variable and also through "name mangling"'''
'''Name Mangling: It is th method to access the variables ... | true |
963e02cb026c38a49cbd4609a8959f7196564fbd | Python | frigid-sll/python | /python实习代码/_1one_month/15/last.py | UTF-8 | 257 | 2.9375 | 3 | [] | no_license | class A(object):
b=2
def __init__(self):
self.a=1
@classmethod
def q(cls):
cls.b=3
@staticmethod
def w():
A.b=3
A.a=4
z=A()
print(A.b)
z.q()
print(A.b)
print(z.a)
z.w()
print(z.b)
print(z.a)
print(A.a) | true |
dd9ef8ec2f5ce4c87a96da8c5388e0e77d4d0e88 | Python | suhaibani/WS-Evaluation | /evaluator.py | UTF-8 | 1,904 | 2.75 | 3 | [] | no_license | # coding: utf-8
import numpy as np
from collections import defaultdict
from Queue import PriorityQueue
import sys
from scipy import spatial
from scipy import stats
def load_benchmark(filename, all_words):
scores = {}
for line in open(filename):
w1, w2, score = line.strip().split()
w1 = w1.lowe... | true |
21d87fe80ea20ee1546936ec8b9ad7a1940e5aed | Python | touchstoneanalytics/Biterm_Topic_Modeling_BigQuery_skashif | /Biterm_Topic_Modeling_BigQuery/src/extract_tweets.py | UTF-8 | 1,653 | 3.359375 | 3 | [] | no_license | """ Code to extract tweets for a particular company """
import os
import sys
import pandas as pd
class Tweets_Extractor():
def __init__(self):
"""
Checking whether the tweet file exists or not
"""
self.dir_path = os.path.dirname(os.path.realpath(__file__))
self.file_path = ... | true |
a678a7b634bfc52c6aebdc6915bd28e84164c510 | Python | mccarvik/python_for_finance | /dx/portfolio.py | UTF-8 | 13,750 | 3.03125 | 3 | [] | no_license | import math
from .frame import *
import scipy.optimize as sco
import scipy.interpolate as sci
from pandas_datareader import data as web
class mean_variance_portfolio(object):
'''
Class to implement the mean variance portfolio theory of Markowitz
'''
def __init__(self, name, mar_env):
self.nam... | true |
f82175b3af4f6fa5350d4387b8a392afeb2c39d0 | Python | leehyehwan/Learning_Python | /gorvernment_newpost_bot/new_post_bot.py | UTF-8 | 8,139 | 2.75 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
from slacker import Slacker
from private.tokens import slack as slack_token
def post_bot1():
# 고용노동부
# 제목 확인을 위한 파서
req = requests.get('http://www.moel.go.kr/news/notice/noticeList.do')
req.encoding = 'utf-8'
html = req.text
soup = BeautifulSoup(h... | true |
fc2697965e4049777392a4c2f67cb92528309b03 | Python | kiyoshiWK/nlp_100_python | /007/nlp100_007.py | UTF-8 | 463 | 3.328125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import sys
def template(args_list):
if len(args_list) != 3:
sys.exit('ERROR: num of args is not 3. please set 3 args.')
else:
return str(args_list[0]) + '時の' + str(args_list[1]) + 'は' + str(args_list[2])
def main(args_list):
print(template(args_list))
if __name__ ... | true |
eeae148c3681c07a4c3983297847bb7a250cd1b5 | Python | mberkay/computer-graphics | /lights/light.py | UTF-8 | 1,415 | 2.734375 | 3 | [] | no_license | # CENG 487 Assignment5 by
# Mustafa Berkay Özkan
# StudentId: 230201005
# 12 2019
import math
from OpenGL.GL import *
from transform import Transform
from vec3d import Vec3d
class Light:
count = 0 # Static light counter
def __init__(self, ambient, diffuse, specular, transform: Transform):
if Light... | true |
0ef236b94fa785e36fd5bcfee6891610e2f0d9bb | Python | sssilvar/funny_coding | /vtk/00_cube_render.py | UTF-8 | 1,054 | 3.078125 | 3 | [] | no_license | import vtk
from vtk.util.colors import azure
# 1. Source
# Generate polygon data for a cube: cube
cube = vtk.vtkCubeSource()
# 2. Mapper
# Create a mapper for the cube data: cube_mapper
cube_mapper = vtk.vtkPolyDataMapper()
cube_mapper.SetInputConnection(cube.GetOutputPort())
# 3. Actor
# Connect the mapper to an ac... | true |
993641ac55c9cae5425a108f02b8be99a1c121a4 | Python | marcmir70/Python3 | /PythonPro PythonBirds+Django/novo/exercicios/Pkg2.1.10_Atributo_Complexo/pessoa..py | UTF-8 | 722 | 3.765625 | 4 | [] | no_license | class Pessoa:
def __init__(self, *filhos, nome = None, idade=35):
self.idade = idade
self.nome = nome
self.filhos = list(filhos)
def cumprimentar(self):
return f'Olá, {self.nome} -id:{id(self)}'
if __name__ == '__main__':
mell = Pessoa(nome='Mell', idade=26)
... | true |
349ce64b6e4a9543126731e14f5b5f221abbe947 | Python | jesadrperez/Fundamentals-of-Computing | /An Introduction to Interactive Programming in Python/Mini-project #6 - Blackjack.py | UTF-8 | 6,738 | 3.3125 | 3 | [] | no_license | # Mini-project #6 - Blackjack
#http://www.codeskulptor.org/#user42_yUWSsWhf55_12.py
import simplegui
import random
# load card sprite - 936x384 - source: jfitz.com
CARD_SIZE = (72, 96)
CARD_CENTER = (36, 48)
card_images = simplegui.load_image("http://storage.googleapis.com/codeskulptor-assets/cards_jfitz.png... | true |
7bd69f76ff69975f5c3c7911cf05477ea4222a59 | Python | Rickmaru/Jinryu_analysis | /s3_ul.py | UTF-8 | 2,509 | 2.546875 | 3 | [] | no_license | #author;R.Kunimoto, TAKENAKA co.
#coding:utf-8
import boto3
import os
import re
import time
import sys
from uhurusys_json_trans import main_jsontrans
seiki_csv = re.compile("TRJ.+csv")
# pathは人流csvデータが保存されるディレクトリのパス、jpathはuhuruシステム用のjsonを掃出したいディレクトリのパスを指定してください。
# エクスプローラからコピーしたパスではディレクトリ間の接続が「\」で表現されてい... | true |
cf14392e41bf45d3ff0adacba8f4ec7475e80e26 | Python | SunJingpeng6/MachineLearning | /kd_tree.py | UTF-8 | 4,135 | 3.609375 | 4 | [] | no_license | import numpy as np
# 最近邻 kd tree
class KdNode():
def __init__(self, dom_element, left=None, right=None):
# n维向量节点(n维空间中的一个样本点)
self.dom_element = dom_element
# 该结点分割超平面左子空间构成的kd-tree
self.left = left
# 该结点分割超平面右子空间构成的kd-tree
self.right = right
class KdTree():
"... | true |
1c97996db37eb8099a982b09736bd49738dcdb11 | Python | SrinathAkkem/ATM | /login.py | UTF-8 | 778 | 3.03125 | 3 | [] | no_license | from menu2 import clear_screen, menu2
def login(acc_list):
login_id = input('Please enter your information (to return, click "Ctrl+C"). \n>>ID: ')
login_password = input('>>Password: ')
found = False
for account in acc_list:
if account[0] == login_id and account[2] == login_password:
... | true |
6bb9b28f275c4b6fac50d0285545ed8ce1317241 | Python | iotTesting/led | /python code/led python/UdemyLedButton.py | UTF-8 | 1,093 | 2.90625 | 3 | [] | no_license | import RPi.GPIO as GPIO
import time
#Pin Defination
pwmPin =18
ledPin =23
butPin =17
#Brigness Control
duty =75
#setup GPIO
GPOI.setmode(GPIO.BCM)
GPIO.setup(ledPin, GPIO.OUT)
GPIO.setup(pwmPin, GPIO.OUT)
GPIO.setup(butPin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
#200 beeing the frequency in Hz
pwm... | true |
e4ffc31db05a5432481119c32384842c6a8989b3 | Python | jgpstuart/Kattis-Solutions | /busnumbers.py | UTF-8 | 590 | 3.1875 | 3 | [] | no_license | stops = int(input())
bus = [int(x) for x in input().split()]
answer = []
bus.sort()
z=0
i=0
while i < len(bus):
if i+1 == len(bus):
compare = bus[i]
else:
compare = bus[i+1]
if bus[i]+1 == compare:
z += 1
if bus[i]+1 != compare:
if z == 0:
answer.append(str(b... | true |
01c46bc9f88c9866560d0d5e715eec62e25096cf | Python | sun1638650145/RetinaNet | /RetinaNet/model/feature_pyramid_network.py | UTF-8 | 2,631 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | from tensorflow.keras import layers
from tensorflow.keras.activations import relu
from tensorflow.keras.applications import ResNet50
from tensorflow.keras.models import Model
def get_backbone():
"""获取ResNet50的骨架网络, 返回ResNet50提取的特征信息."""
backbone = ResNet50(include_top=False, input_shape=[None, None, 3])
c... | true |
600939929846b57b5aa8543ff8a7a7774ed8827c | Python | jongchan-kim524/Python-Selenium | /create_100_kakao.py | UTF-8 | 2,417 | 2.984375 | 3 | [] | no_license | from selenium import webdriver
import time
import sys
import os
kakao_email = input('카카오 이메일: ')
kakao_pwd = input('카카오 비밀번호: ')
n = int(input('몇개나 만들까요?: '))
driver = webdriver.Chrome()
stg_dev = input('운영이면 0, stg면 1을, dev면 2를 눌러주세요')
if stg_dev == '0':
url = 'https://www.tripcody.com/itinerary/182592'
elif ... | true |
0abd2027899bfbf4067983413495e3aba6da1b60 | Python | Bogdan-Moskovchenko/Programming-Basics | /homeworks/Bogdan.Moskovchenko_Bogdan-Moskovchenko/Homework-2/Homework-2.py | UTF-8 | 1,211 | 3.984375 | 4 | [] | no_license | #intro
print('Our WORLD OF SEACREATURES welcomes you newcomer')
print('This game is for people who loves to observe all kinds of seadwellers')
print('For yours and ours conveniece please input some personal information')
#request
name = input('What is your name?\n')
surname = input ('What is your surname?\n')
age = ... | true |
5ba7112e90631b98c6582c1565d1e75aecf2e5fe | Python | adldotori/DeepKnowledgeTracing | /main.py | UTF-8 | 7,149 | 2.546875 | 3 | [] | no_license | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torch.utils.data as data
from torchvision import datasets, transforms
import pandas as pd
import argparse
from tqdm import tqdm
from sklearn import metrics
import numpy as np
device = torch.device('cuda' if torch.cud... | true |
b9364f0ac0571d9e8e6d23f439e114f978b8a915 | Python | malmgrens4/discord_bot | /src/utils/format_helper.py | UTF-8 | 812 | 3.078125 | 3 | [] | no_license | def format_number(value):
return str('{:,}'.format(value))
def discord_display_at_username(user_id):
return '<@!%s>'%user_id
def create_display_table(headers, rows, col_length=15):
header_display=''
underline = ''
bottom = ''
side_bar = '|'
for header in headers:
header_display+= (... | true |
35fd5c9e98a0f4a04f013bbae84f41b81c70c4df | Python | SoadB/100DaysOfCode-Python | /Day_31.py | UTF-8 | 417 | 3.859375 | 4 | [] | no_license | # Ex1
def my_function():
print("Hello in my function")
my_function()
print("-------------------------")
# Ex2
def my_fun(fname):
print(fname + " Refsnes")
my_fun("Email")
my_fun("Tobies")
my_fun("linus")
print("-------------------------")
# Ex3
def fun_country(country = "Norway"):
print("I am from " + countr... | true |
6f420493023c59e27f1acad40f1dd990e644a2f9 | Python | ginsstaahh/455-reactor-design-project | /37280147 30639141 Oregonator model for BZ reaction.py | UTF-8 | 8,464 | 3.25 | 3 | [] | no_license |
# coding: utf-8
# ## Introduction:
#
# BZ reaction was first discovered by a Russian scientist Belousov. In this reaction the system undergoes a reaction with an oscillatory change of color. For a long time his findings were dismissed, since people were uncomfortable with an idea that system may go back and forth fr... | true |
4f8857974fd9caa3744959d869bf866426b44c86 | Python | rachel-dev/minion_raspberry | /main.py | UTF-8 | 1,151 | 2.578125 | 3 | [] | no_license | from flask import Flask
from flask import Flask, render_template, request
import time
import serial
ser = serial.Serial('/dev/ttyS0', 9600, timeout=1)
ser.isOpen()
app = Flask(__name__)
@app.route("/")
def index():
# return "Hello, Rachel"
return render_template("robot.html")
@app.route('/left_side')
def left_side... | true |
2da44c450b21fb110506eae2d2e1258a8a9f2211 | Python | GerardoRodas/orto2 | /app/informacion/choices.py | UTF-8 | 121 | 2.671875 | 3 | [] | no_license |
genero_choices = (
(1, ("Masculino")),
(2, ("Femenino"))
)
YES_OR_NO = (
(True, 'Yes'),
(False, 'No')
) | true |
1f2cdb1e2b3394c5377c20cb2e9f16ff25691948 | Python | joshimiloni/Client-Server-Polling-System | /client.py | UTF-8 | 1,191 | 2.90625 | 3 | [] | no_license | import socket,pickle
from threading import Thread
import Tkinter as tk
def button_func():
sendname()
top.destroy()
def sendname():
global E1,E2,E3
string1 = E1.get()
string2 = E2.get()
string3 = E3.get()
data_array=[string1,string2,string3]
data_string = pickle.dumps(data_array)
... | true |
9d704a76d1f76a4e90b2875fb16bece2bea9e7a5 | Python | Aasthaengg/IBMdataset | /Python_codes/p02835/s408265612.py | UTF-8 | 72 | 2.640625 | 3 | [] | no_license | A = map(int, input().split())
print('bust' if(sum(A) >= 22) else 'win')
| true |
2d61dfbecee12199babb38e0ee068e4306c60c78 | Python | lujinda/pylot | /fileInput.py | UTF-8 | 208 | 2.640625 | 3 | [] | no_license | import fileinput
import re
#for line in fileinput.input(inplace=True):
# line=line.rstrip('\n')
# print '%s # %2d'%(line,fileinput.lineno())
for lines in fileinput.input(inplace=False):
print lines
| true |
6a69b377db4fd47122444bcb400900f23a62e920 | Python | HYUNAHSHIM/algorithmProblem | /BaekJoon18870.py | UTF-8 | 211 | 2.8125 | 3 | [] | no_license | # BaekJoon18870.py
N = int(input())
arr = list(map(int, input().split()))
sorted_arr = sorted(list(set(arr)))
dic = {sorted_arr[i] : i for i in range(len(sorted_arr))}
for i in arr:
print(dic[i], end = " ") | true |
762fa4b07a9ba430d371d99b0e41fc69f4ff1094 | Python | ChristianMeyndt/aicoe-osc-demo | /src/components/utils/nq_utils.py | UTF-8 | 647 | 3.1875 | 3 | [] | no_license | import re
def get_text_section(doc_tokens):
"""Return section of text from a whitespace separated document"""
return " ".join(doc_tokens[0].split(" ")[doc_tokens[1] : doc_tokens[2]])
def contains_table(text):
"""Returns True if a string contains an HTML table"""
if re.search(r"<Table>.*</Table>", te... | true |
29592e0a26d94d517e2c71cb0d0d5b41b587226e | Python | PNapi90/Fuzzy-Bayes-Tracking | /perm_list/test_fac.py | UTF-8 | 186 | 2.875 | 3 | [] | no_license | from numpy import *
def fac(a):
retval = 1
for i in range(1,a+1):
retval *= i
return retval
a = 0
for i in range(1,11):
a += fac(i)*i
print(a*4/(1024*1024)) | true |
85b895be148e24629795599152f956043375e9c9 | Python | brghena/appkit-statements | /cover_letters/build_script.py | UTF-8 | 495 | 2.59375 | 3 | [] | no_license | #! /usr/bin/env python3
import glob
import os
print("Building cover letters...")
letters = glob.glob("cover_letters/*.tex")
for letter in letters:
loc = letter.split('.')[0].split('_')[-1]
if loc == 'base':
print("Skipping base file")
continue
output = 'pdfs/brghena-cover-{}.pdf'.format(lo... | true |
8d002fbce20a3a5d47196a8414a02d9b3dabd62c | Python | timo-stoettner/cryptocompare-client | /cryptocompare_client/core.py | UTF-8 | 13,514 | 2.546875 | 3 | [
"BSD-2-Clause"
] | permissive | # -*- coding: utf-8 -*-
import logging
import time
from requests.exceptions import ConnectionError
from threading import Thread
import pymongo
import requests
import json
import sys
import socketIO_client
from . import masks
from . import customized_methods
from six import iteritems
from six import string_types as... | true |
68b61475a803d43befe2728b7c73c3d734453b6d | Python | bloomberg/phabricator-tools | /py/phl/phlsys_cppcheck.py | UTF-8 | 4,336 | 2.5625 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | """Run the external tool 'cppcheck' and process results."""
# =============================================================================
# CONTENTS
# -----------------------------------------------------------------------------
# phlsys_cppcheck
#
# Public Classes:
# Error
#
# Public Functions:
# run
# parse_o... | true |
fe70584166a4b4bf04447f8a5d5dbf166cb033e0 | Python | RounakChatterjee/New_Assignement | /adder3.py | UTF-8 | 172 | 3.265625 | 3 | [] | no_license | '''
This program depicts how to give default value to arguments
'''
def adder(good = 1,bad =2,ugly = 3):
return good + bad + ugly
print(adder(ugly = 1,good = 5)) | true |
27d11967a24dd415b926c4e0727f42ff4bb9632f | Python | MFC-GAN/mfc-gan | /symbols_MFCGAN.py | UTF-8 | 15,601 | 2.875 | 3 | [
"MIT"
] | permissive | import sys
sys.path.insert(0,'../')
from util import *
import numpy as np
#import cv2
import tensorflow as tf
from numpy import *
import matplotlib as mlp
mlp.use('Agg')
from skimage import color
from skimage import io
from collections import Counter
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridsp... | true |
13cd62e39489650d94a687cdd34cd8607521180d | Python | wonjun0901/WJ_Develop_Individually | /Lecture_note_ML/2_scikit-learn/1_knn/KNeighborsRegressor_01.py | UTF-8 | 3,096 | 3.203125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import numpy as np
# 최근접 이웃 알고리즘을 활용한 회귀분석
# 학습 데이터 X
# - 키와 성별에 대한 정보
X_train = np.array([
[158, 1],
[170, 1],
[183, 1],
[191, 1],
[155, 0],
[163, 0],
[180, 0],
[158, 0],
[170, 0]])
# 학습 데이터 y
# - 몸무게 정보
y_train = np.ar... | true |
0ab40eae06f1e58eb58a85be90440e9851d833f1 | Python | mauriciomd/hackerrank-solutions | /hash-tables-ice-cream-parlor.py | UTF-8 | 713 | 2.890625 | 3 | [] | no_license | #!/bin/python3
import math
import os
import random
import re
import sys
# Complete the whatFlavors function below.
def whatFlavors(cost, money):
diff_cost_table = {}
cost_arr_len = len(cost)
for i in range(1, cost_arr_len + 1):
diff = money - cost[i-1]
if diff not in diff_cost_table:
... | true |
d14562f5b7d54a833a8be8cc0f02604dc80d783c | Python | nikmalviya/Python | /Practical 1/current_datetime.py | UTF-8 | 96 | 3.171875 | 3 | [] | no_license | import datetime as dt
today = dt.datetime.today()
print('Current Date and Time : ')
print(today) | true |
76ab83da213dcde1fce71a4ecb95aafae07f9577 | Python | robertstephen/PyWeb-06 | /simple-mvc/model.py | UTF-8 | 310 | 3.359375 | 3 | [] | no_license |
class Widget(object):
"""
The Widget class shall present the class method:
get_widget(name)
which retrieves the widget of the given name.
Each widget instance shall present the methods:
get_value()
set_value(value)
which are self-explanatory.
"""
pass
| true |
962ec6ae70955f0d5dcfbfa33bf5fdd2217cf062 | Python | avanadia/hackathon_repo | /transformations/moduleParse.py | UTF-8 | 619 | 2.984375 | 3 | [] | no_license | import xml.etree.ElementTree as ET
from transformations.htmlParser import HtmlParse
#For all HTML in node, creates cummulative list of modules that appear in HTML.
def moduleParse(node):
root = node
#array of modules to return from the body text html
modules = []
for child in root:
name = chi... | true |
82524756448c14a9da784ca6f88425f702806597 | Python | vpegasus/dnc | /memory.py | UTF-8 | 9,113 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@author: Prince
@file: memory.py
@time: 2018-1-30 01: 42
@license: Apache License
@contact: pegasus.wenjia@foxmail.com
"""
import tensorflow as tf
class Memory:
def __init__(self, num_memory, word_size, num_read_heads, batch_size):
"""
memory a... | true |
69186bbc724c33bafdd4b08d19bca356797dd120 | Python | vybhav72954/Amazing-Python-Scripts | /ZIP-Function/transpose.py | UTF-8 | 947 | 4.6875 | 5 | [
"MIT"
] | permissive | #how to get transpose of a matrix.
# A normal coder may require some loops to get transpose but using ZIP function we can have it as one liner.
# Know the Basic Usage of the Zip Function
#The zip function aggregates items from different iterables, such as lists, tuples or sets, and returns an iterator.It works just lik... | true |
6896682b041713dff84ab145274b7858f3f3c7bc | Python | seo0/MLstudy | /adsa_2016/module13_graphs01/part02_basics02/graphs_etc.py | UTF-8 | 1,760 | 3.84375 | 4 | [] | no_license |
import networkx as nx
import matplotlib.pyplot as plt
from module13_graphs01.part01_basics.graphs_basics import print_graph, display_and_save
def modulo_digraph(N,M):
"""
This function returns a directed graph DiGraph) with the following properties (see also cheatsheet at: http://screencast... | true |
ca4986842e4243896a7b8e5cf8942465d8949874 | Python | Toruitas/MSc-Coding-2 | /w4/scrape_corona.py | UTF-8 | 7,389 | 3.25 | 3 | [] | no_license | from gensim.summarization import summarize
import pandas
import numpy as np
from bs4 import BeautifulSoup
import requests
import datetime
def get_link_response(url: str) -> requests.Response:
"""
get_link_response gets a URL and scrapes it, returning the object.
"""
return requests.get(url)
def choo... | true |
9698df740aed7bc1f553cb8d0da1bfb29e268343 | Python | Apocilyptica/Python_notes_school | /Functions/argument_unpacking.py | UTF-8 | 425 | 4.125 | 4 | [] | no_license | # Default unpacking is *args, it get returned as a Tuple
def greeting(*args):
print('Hi ' + ' '.join(args))
print(args)
greeting('Tiffany', 'Hudgens')
greeting('Kristine', 'M', 'Hudgens')
def greeting(time_of_day, *args):
print(f"Hi {'-'.join(args)}, I hope that you are having a good {time_of_day}")
... | true |
1540108abfa364caa94b20c920b19f1138cbbfbf | Python | shcgay/song-chun | /5day/6-new方法.py | UTF-8 | 210 | 2.9375 | 3 | [] | no_license | class A(object):
def __init__(self):
print(self)
print("这是init方法")
def __new__(cls):
print(cls)
print("这是new方法")
ret = object.__new__(cls)
return ret
a = A()
print(a)
print(id(A))
| true |
9b29f2cd6706ec692718de17cfc32d1bc62802e7 | Python | anotherjoshsmith/nonstick | /nonstick/pamm.py | UTF-8 | 5,913 | 2.8125 | 3 | [
"MIT"
] | permissive | import os.path as op
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from scipy.spatial import distance_matrix
from scipy.stats import multivariate_normal
def main():
np.random.seed(7)
... | true |
4a37cd673d92c7c37a8f38f605518cde15a86384 | Python | Luckyaxah/leetcode-python | /赎金信.py | UTF-8 | 619 | 3.015625 | 3 | [] | no_license | class Solution:
def canConstruct(self, ransomNote: str, magazine: str) -> bool:
if len(ransomNote) > len(magazine):
return False
d = {}
for i in magazine:
if i in d:
d[i] += 1
else:
d[i] = 1
for i in ransomNote:
... | true |
1f66fa8ba49593a5875e5e2e4fdb16ff1a157bf0 | Python | aixiu/myPythonWork | /OldBoy/冒泡排序-练习.py | UTF-8 | 281 | 3.359375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
data = [10, 4, 33, 21, 54, 3, 8, 11, 5, 22, 2, 1, 17, 13, 6]
for i in range(len(data)-1):
for j in range(len(data)-1-i):
if data[j] > data[j+1]:
data[j], data[j+1] = data[j+1], data[j]
print(data) | true |
69d5762d050e3c9b78f81e45aaf1aa2df3667df2 | Python | fedorzaytsev06/FirstProject | /9.168.py | UTF-8 | 165 | 3.40625 | 3 | [] | no_license | s = input().split() # [sdfsdf, sdfs, dsfs]
print(s)
r=0
for i in range(len(s)):
# if s[0] == "н":
word = s[i]
if word[0] == "n":
r+=1
print(r)
| true |
89e2d82a812d6114f631725656e8272cac8c5132 | Python | MvdB/Project-Euler-solutions | /python/p046.py | UTF-8 | 535 | 3.25 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | #
# Solution to Project Euler problem 46
# by Project Nayuki
#
# https://www.nayuki.io/page/project-euler-solutions
# https://github.com/nayuki/Project-Euler-solutions
#
import eulerlib, itertools
def compute():
for n in itertools.count(9, 2):
if not test_goldbach(n):
return str(n)
def test_goldbach(n):
... | true |
3fcba4ea71415ddeed1e5782241c3ed33bbb9385 | Python | LusineKamikyan/Purdue-Deep-Learning-BME595A | /Homework2/test.py | UTF-8 | 836 | 3.609375 | 4 | [] | no_license | from neural_network import NeuralNetwork
import torch
from logic_gates import AND
from logic_gates import OR
from logic_gates import XOR
from logic_gates import NOT
'''
##### PART A #####
model = NeuralNetwork([2,2,5,6,3])
input_tensor= torch.tensor([[1,2,3],[3,4,5]], dtype = torch.double)
output = model.forward(input... | true |
132a1ce2d7e65a827ba4bdaf7b50c0158522f345 | Python | KristinaUlicna/CellComp | /Movie_Analysis_Pipeline/Single_Movie_Processing/Server_Movies_Paths.py | UTF-8 | 5,549 | 3.140625 | 3 | [] | no_license | import os
import re
"""
def GetMovieFilesPaths(exp_type = "MDCK_WT_Pure"):
Get the absolute paths of all movies available for analysis.
Folders to iterate: "MDCK_WT_Pure" or "MDCK_Sc_Tet-_Pure"
Args:
exp_type (string, "MDCK_WT_Pure" by default) -> change if needed.
- option... | true |
48ad5a49aeeadada2e793a72d767cd1e75d9656f | Python | Muhos-wandia/TempCCalc | /Temperature Converter.py | UTF-8 | 449 | 3.796875 | 4 | [] | no_license | temp =input("Input the temperature to be converted:")
degree = int(temp[:-1])
i_convention = temp[-1]
if i_convention.upper() =="C":
result = int(round((9* degree) / 5+32))
o_convention = "Fanhereit"
elif i_convention.upper()== "F":
result = int(round((degree - 32)*5 / 9))
o_convention = "Celsiu... | true |
1cf10e6d036c2d87e81f80b7a9c35a9d8d65483d | Python | gladiopeace/ADIM_thesis | /Interest Management/Activity-Driven/lstm_adapter.py | UTF-8 | 1,483 | 2.90625 | 3 | [] | no_license | from rnn.config import Config
from rnn.load_data import load_X, load_Y
from rnn.lstm import init_lstm, classify
import numpy as np
class LSTM():
def __init__(self, player_ids):
self.player_ids = player_ids
self.X_samples = load_X(player_ids)
self.Y_samples = load_Y(player_ids)
self.nn_vars = init_lstm(self.X... | true |
bc7d064173742916b1fbc95646a1422851e016bf | Python | qybing/LeetCode | /22. 括号生成/generate_parenthesis.py | UTF-8 | 953 | 3.328125 | 3 | [] | no_license | #! python3
# _*_ coding: utf-8 _*_
# @Time : 2020/5/29 16:51
# @Author : Jovan
# @File : generate_parenthesis.py
# @desc :
def parenthess(sublist, reslut, leftnum, rightnum):
if leftnum == 0 and rightnum == 0:
reslut.append(sublist)
if rightnum > leftnum:
parenthess(sublist + ')', reslut, leftn... | true |
5ce5528a08ec2fcb96f9d47a65c69555f2b5dbdf | Python | WarrenWeckesser/eyediagram | /demo/mpl_demo.py | UTF-8 | 448 | 2.734375 | 3 | [
"BSD-2-Clause"
] | permissive | # Copyright (c) 2015, Warren Weckesser. All rights reserved.
# This software is licensed according to the "BSD 2-clause" license.
from eyediagram.demo_data import demo_data
from eyediagram.mpl import eyediagram
import matplotlib.pyplot as plt
# Get some data for the demonstration.
num_symbols = 5000
samples_per_sym... | true |
445fea7fd66ba82d218e3e410830428ab2eea35c | Python | johan--/seleniumTests | /tests/sketch/test_sketch.py | UTF-8 | 4,875 | 2.546875 | 3 | [] | no_license | import time
from selenium.common.exceptions import StaleElementReferenceException
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.select import Select
from selenium.webdriver.support.u... | true |