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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
8fa36463760516e60b1d87a1c52ccbc3419b06ff | Python | fetchai/ledger-api-py | /fetchai/ledger/bitvector.py | UTF-8 | 2,403 | 3.40625 | 3 | [
"Apache-2.0"
] | permissive | class BitVector:
@staticmethod
def from_bytes(data: bytes, bit_size: int):
# ensure the bit size matches the expectation
min_size = max((len(data) - 1) * 8, 1)
max_size = len(data) * 8
assert min_size <= bit_size <= max_size
bits = BitVector()
bits._size = bit_... | true |
744a3b59bb1425354b01f6b040f6f74ca42cc72d | Python | Aasthaengg/IBMdataset | /Python_codes/p03436/s202671165.py | UTF-8 | 865 | 3.09375 | 3 | [] | no_license | from collections import deque
import itertools
def bfs(G,visited,sy,sx):
queue=deque([[sy,sx]])
visited[sy][sx]=0
while queue:
y,x=queue.popleft()
if (y,x)== (H-1,W-1):
return visited[y][x]
for j,k in ([1,0],[0,1],[-1,0],[0,-1]):
tmp_y,tmp_x = y+j,x+k
... | true |
8e3b13fe178c8b5f7bca8dea504e2e4fc9d34165 | Python | suspendisse02/Scientific_Computing_with_Python | /074_tuples_are_comparable.py | UTF-8 | 160 | 3.078125 | 3 | [] | no_license | sttos = ('Spock', 'Kirk', 'McCoy', 'Scotty')
stvoyager = ('Janeway', 'Seven of Nine', 'Chakotay', "B'Elanna")
print(sttos > stvoyager)
print(sttos < stvoyager)
| true |
eb049dcfca28d7b1d0444d5b433de7dbf8e017c6 | Python | NicholasRasi/SelfAdaptive-FedML | /federate_learning/orchestrator/control_strategy/dynamic_quadratic_rounds.py | UTF-8 | 2,525 | 2.515625 | 3 | [] | no_license | from scipy import interpolate
import numpy as np
from federate_learning.orchestrator.control_strategy import ControlStrategy
"""
Compute the target speed with a quadratic function
"""
class DynamicQuadraticRounds(ControlStrategy):
def apply_strategy(self, num_round: int = None):
# control parameters
... | true |
51671bc11dde9451a54dc8d4c218bf8116bcb88d | Python | bjosor/mapgenerator | /olsennoise.py | UTF-8 | 4,090 | 2.828125 | 3 | [] | no_license | #Copyright Tatarize 2014
#MIT License.
import math,pygame
def paint(seedx,seedy,width,height,iterations):
onmap = fieldOlsenNoise(seedx, seedy, seedx+width, seedy+height, iterations)
onmap = arrayblur(onmap)
surface = pygame.Surface((width,height))
for j in range(len(onmap)):
for k in range(len... | true |
121bdbd4e2165ca4336d2831c91262db4038b630 | Python | JiaYingDong/learngit | /bullet.py | UTF-8 | 1,301 | 3.515625 | 4 | [] | no_license | import pygame
from pygame.sprite import Sprite
class Bullet(Sprite):
"""一个对飞船发射的子弹进行管理的类"""
def __init__(self,ai_settings,screen,ship):
"""在飞船所处位置创建一个子弹对象"""
super().__init__()
self.screen = screen
#self.ai_settings = ai_settings
#获取子弹图像,及它的外接矩形
self.image = py... | true |
c2b91c2c25a9a8c4dbfe4ba89239a318abd9c7e2 | Python | THolley63/csc121 | /lab5.py | UTF-8 | 2,895 | 3.875 | 4 | [
"CC0-1.0"
] | permissive | import random
def print_intro():
print(
"Welcome to Camel!")
print()
print(
"In your desperation, you have stolen a camel"
" to make your way"
)
print(
"across the great Mobi desert."
)
print(
"The locals want their camel"
"back ... | true |
039badf106c334b5bd1810743880fa76588b0391 | Python | jalvarado91/school-archive | /netcentric/practice/algo_practice/problem1.py | UTF-8 | 1,328 | 4.09375 | 4 | [] | no_license | ##
# Problem: Compress a string such that 'AAABCCDDDD' becomes 'A3BC2D4'.
# Only compress the string if it saves space.
#
from nose.tools import assert_equal
class CompressString(object):
def compress(self, string):
if string is None or not string:
return string
compressed... | true |
5c55081952e1c459f552a2e94d555a6c41bdfc5d | Python | alexandraback/datacollection | /solutions_5636311922769920_1/Python/Grzesiu/D-source.py | UTF-8 | 1,052 | 2.625 | 3 | [] | no_license | import imp, sys
sys.modules["utils"] = __mod = imp.new_module("utils")
exec """#!/usr/bin/python
from itertools import chain, repeat, izip
def line(*args):
L = raw_input().strip().split()
L = izip( L, chain( args, repeat(str) ) )
return [ type(data) for data, type in L ]
def iline(): return map( int, ... | true |
7506d3ad6e96cb399d0967ece990f419f8fda612 | Python | Smallergamer/bravo | /bravo/plugins/recipes.py | UTF-8 | 20,887 | 2.5625 | 3 | [
"MIT"
] | permissive | from zope.interface import implements
from bravo.blocks import blocks, items
from bravo.ibravo import IRecipe
class Recipe(object):
"""
Base class for recipes.
Just holds the implements() incantation; this is a space savings by
itself.
"""
implements(IRecipe)
#Basics
class OneBlock(Recipe):... | true |
9ae4931e5ff9ce27c2509feb96db6a92a41c7f88 | Python | gbb365/leetcode | /Problemset/insertion-sort-list/insertion-sort-list.py | UTF-8 | 1,121 | 3.84375 | 4 | [] | no_license |
# @Title: 对链表进行插入排序 (Insertion Sort List)
# @Author: 15218859676
# @Date: 2020-08-24 21:21:59
# @Runtime: 2144 ms
# @Memory: 15.4 MB
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def insertionSortList(self, he... | true |
b0ea94ac4294e7b8e6dcc2fa4461b2425cb84117 | Python | jiangyoudang/python3 | /algorithm/other/remove comments.py | UTF-8 | 1,023 | 2.90625 | 3 | [] | no_license |
def rm_cmnts(i_file):
#open file
with open(i_file) as text:
#match /* and the first */, ignore any /* between
# left indicates if there is */ ongoing
left = False
for line in text:
# repeatedly check
while True:
# no comment so far
... | true |
0a5cd27c34e5619675c797283390d806455935e7 | Python | ssk8/CamBot | /containerize.py | UTF-8 | 508 | 2.625 | 3 | [] | no_license | #!/usr/bin/python3
from pathlib import Path
from subprocess import run
def containerize(path_str: str):
path = Path(path_str)
videos = list(path.glob('*.h264'))
for vid in videos:
print(vid)
if f"{vid}.mp4" in [str(x) for x in path.glob('*.mp4')]:
continue
sub = f"{vi... | true |
6df8713484f07e86d646b4fd70131caacc53935e | Python | idrissrhe/Projet-Ann | /Python_Test/Test_Kmeans.py | UTF-8 | 853 | 2.734375 | 3 | [] | no_license | from dll_load import get_Kmeans, flatten
import matplotlib.pyplot as plt
from sklearn.datasets import make_moons
# generate 2d classification dataset
Xx, Y = make_moons(n_samples=100, noise=0)
Xy = list(flatten(Xx))
X = []
Y = []
Xk = []
Yk = []
K = 3
XTrain = [
0,
0,
0.3,
1,
0.5,
0.5,
0,
... | true |
c3ccb328fd8ee0ee93bc216124ec40f4fe501543 | Python | Veldhoen/thesis | /old/trainingNew.py | UTF-8 | 3,868 | 2.8125 | 3 | [] | no_license | def setParameters(hyperParameters,nCores = 1, ada = True):
global hyperParams
hyperParams = hyperparameters
global cores
cores = nCores
global adagrad
adagrad = ada
print 'Training hyperparameters are set.'
'''
Epoch:
- Divide the training data (examples['TRAIN']) into minibatches
- Run each m... | true |
66118d1fbac305e2d57488f711ded9b265f542c3 | Python | husanpy/Kata-Solutions | /Python/6-kyu/ipv4_parser.py | UTF-8 | 2,146 | 4.34375 | 4 | [] | no_license | """
Kata: IPv4 Parser (6 kyu)
Description:
Problem Statement
Write a function that takes two string parameters, an IP (v4) address and a subnet mask, and returns two strings: the network block, and the host identifier.
The function does not need to support CIDR notation.
Description
A single IP address with subnet ... | true |
85eeb44d87fd5ff4f40d914a5878a770c5fb5a09 | Python | sambursanjana/Navigation | /Navigation.py | UTF-8 | 6,799 | 2.703125 | 3 | [] | no_license | import matplotlib.pyplot as mb
import smbus
import numpy as np
from numpy import dot
from numpy.linalg import inv
from time import sleep
import math
#Prompt for time interval.
deltaT=0.25
def getState(X,Pk1,a):
#Initialize the A matrix.
#This matrix generally deals with the position of the object.
A=np.i... | true |
029cb0d760c71380ed72fc8a5a0f650e75c7929e | Python | shrutileena/Web-Scraper | /urllinks.py | UTF-8 | 786 | 2.53125 | 3 | [] | no_license | import urllib.request, urllib.parse, urllib.error
import requests
from bs4 import BeautifulSoup
import ssl
import pandas as pd
# Ignore SSL certificate errors
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
url = 'http://dtemaharashtra.gov.in/frmInstituteList.aspx?RegionI... | true |
e61ad959114bf3ea09f8b16a26a314b57322d74f | Python | dimeks777/python-labs | /src/lab1-2/main.py | UTF-8 | 877 | 3.765625 | 4 | [] | no_license | # This is a sample Python script.
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
import math
from cmath import sin
def calculate_expression(alpha):
return 1 / 4 - 1 / 4 * sin(5 / 2 * math.pi - 8 * al... | true |
2837053e85100f48aadef1f15ee26c3a1cca35aa | Python | JetSimon/Advent-of-Code-2017 | /Day 17/day17.py | UTF-8 | 445 | 3.015625 | 3 | [] | no_license | arr = [0]
pos = 0
steps = 394
""" for n in range(1,50000000):
pos += steps
pos = pos % len(arr)
i = pos + 1
arr.insert(i,n)
pos = i
per = (n / 50000000) * 100
print( arr[arr.index(0) + 1] )
#print(arr) """
steps = 394
# Part 2
curl = 1
pos = 0
out = 0
for i in range(50000000):
to_ins =... | true |
cbdf0e1aa45257af52625aded71461a07741b5f7 | Python | amirghx/optdataclt | /main.py | UTF-8 | 7,279 | 2.53125 | 3 | [] | no_license | import json
import requests
import os
import time
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import shutil
import xlwings as xw
import pandas as pd
def tzm(pct, date):
tzm_list = []
for i in range(len(pct)):
temp = (30 / date[i]) * pct[i]
tzm_list.appe... | true |
7550cecb5e3f5ee3165ec746c18aeb0678116245 | Python | mglerner/IntroToStatMechAndThermal | /OtherMonteCarlo/Ising/Schroeder_2d_ising.py | UTF-8 | 3,116 | 2.96875 | 3 | [] | no_license | #!/usr/bin/env python
from __future__ import division
import numpy as np
import pylab
from matplotlib import pyplot as plt
from numpy.random import random #import only one function from somewhere
from numpy.random import randint
import scipy
from time import sleep
size = 100 # lattice length
T = 2.5 # in units of epsi... | true |
eca64da5db20e922e245d843e81357724b1257bd | Python | mnshr/Udacity-DA | /Other/ML/explore_enron_data.py | UTF-8 | 1,612 | 3.265625 | 3 | [] | no_license | #!/usr/bin/python
"""
Starter code for exploring the Enron dataset (emails + finances);
loads up the dataset (pickled dict of dicts).
The dataset has the form:
enron_data["LASTNAME FIRSTNAME MIDDLEINITIAL"] = { features_dict }
{features_dict} is a dictionary of features associated with that perso... | true |
7075217d8b0c3e024e0e1db5af054697d32b6065 | Python | mieszkosluzewski/currency | /feed_parser/parser.py | UTF-8 | 2,220 | 2.96875 | 3 | [] | no_license | import feedparser
import logging
import requests
import settings
logger = logging.getLogger(__name__)
def get_url(currency):
"""
Build url for rss.
:param str currency:
:rtype: str
:return: url
"""
return f'{settings.FEED_URL_PREFIX}{currency.lower()}{settings.FEED_URL_SUFFIX}'
def... | true |
fe6f095a6741589383d085e3e18667ec5cce4261 | Python | Adnn/GTD_Tasks | /common_model.py | UTF-8 | 634 | 4 | 4 | [
"MIT"
] | permissive | ##
## Composite pattern
##
class Item(object):
def __init__(self):
self.children = []
def add_child(self, child):
self.children.append(child)
def iterate(self, function):
for child in self:
function(child)
def traverse(self, visitor):
self.iterate(visitor.... | true |
55cfba5d9af21d93b623f0c85ee92875bbe4607a | Python | dgobbi/VTK | /Rendering/Annotation/Testing/Python/cubeAxes3.py | UTF-8 | 2,768 | 2.609375 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
# This example illustrates how one may explicitly specify the range of each
# axes that's used to define the prop, while displaying data with a different
# set of bounds (unlike cubeAxes2.tcl). This example allows you to separate
# the notion of extent of the axes in physical space (bounds) and t... | true |
d823daff3509c01a60dc6da88b5d780d6d484a96 | Python | YasirHabib/modern_deep_learning_in_python | /Section3/utility.py | UTF-8 | 1,554 | 3.015625 | 3 | [] | no_license | # Section 2, Lecture 4
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.decomposition import PCA
from sklearn.linear_model import LogisticRegression
def get_transformed_data():
df = pd.read_csv("train.csv")
data = df.values.astype(np.float32)
np.random.shuffle(data)
X = data[:... | true |
77cefea39a9eda1e8b21fd3e7b1f0d8172c90989 | Python | ucl-exoplanets/TauREx3_public | /taurex/cache/ktablecache.py | UTF-8 | 8,306 | 2.78125 | 3 | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | """
Contains caching class for Molecular cross section files
"""
from .singleton import Singleton
from taurex.log import Logger
from . import GlobalCache
from taurex.util.util import sanitize_molecule_string
class KTableCache(Singleton):
"""
Implements a lazy load of opacities. A singleton that
loads and... | true |
a3fb7e606f77539d626c835b0e26ebd92fbfdb58 | Python | julianfrancor/holbertonschool-higher_level_programming | /0x0B-python-input_output/10-class_to_json.py | UTF-8 | 365 | 3.171875 | 3 | [] | no_license | #!/usr/bin/python3
"""
function that returns the dictionary description with
simple data structure (list, dictionary, string, integer and boolean)
for JSON serialization of an object
"""
def class_to_json(obj):
"""
obj.__dict__ gives the dictionary description
shows all the attributes defined for the obj... | true |
3e0ebd9b9b1d6fcf858e895ce3d88ef1c0b2218f | Python | juandaniel0419/trabajo-nro5 | /boleta1.py | UTF-8 | 575 | 3.390625 | 3 | [] | no_license | # input
cliente=input("ingrese el nombre del cliente:")
kg=int(input("ingrese Nro kg de manzana:"))
Pu=float(input("ingrese precio unitario:"))
#processing
total=(Pu*kg)
#verificador
comprador_complusivo=(total>200)
#output
print("##############################")
print("# Boleta de ventas")
print("##################... | true |
e375004e1e8a850a1a7d96c3eb8c876828d92774 | Python | jdvala/butterfree | /tests/unit/butterfree/dataframe_service/test_incremental_srategy.py | UTF-8 | 2,410 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | from butterfree.dataframe_service import IncrementalStrategy
class TestIncrementalStrategy:
def test_from_milliseconds(self):
# arrange
incremental_strategy = IncrementalStrategy().from_milliseconds("ts")
target_expression = "date(from_unixtime(ts/ 1000.0)) >= date('2020-01-01')"
... | true |
88b78320aa8318353002b3fb7b12c917baed5ed2 | Python | winofsql/subject-0929-python-basic | /sample04.py | UTF-8 | 262 | 3.265625 | 3 | [] | no_license | print(35 > 35) # False(偽) : 0
print(35 >= 35) # True(真) : 1
print(35 < 40) # True(真) : 1
print(35 <= 40) # True(真) : 1
print(40 == 40) # True(真) : 1
print(40 != 40) # False(偽) : 0
# True(1)/False(0) => 論理型、bool型、boolean型 | true |
3c786dd907f0beb9059e367e6c87ca92e4b86796 | Python | draphick/pyATCSup | /pyATCSup.py | UTF-8 | 2,600 | 2.71875 | 3 | [] | no_license | #!/usr/bin/python
# https://www.crummy.com/software/BeautifulSoup/
from bs4 import BeautifulSoup as bs
# https://www.tutorialspoint.com/python/python_command_line_arguments.htm
import sys, getopt
import requests
def main(argv):
# Creating and accepting URL argument
URL = ''
# URL = "http://www.supremene... | true |
4f64de441778428da50e0541b0e11b939e8fe811 | Python | WangDongDong1234/python_code | /part2/05.py | UTF-8 | 966 | 4.34375 | 4 | [] | no_license | # class Animal:
# breath="有呼吸"
# def __init__(self,name,sex,age):
# self.name=name
# self.sex=sex
# self.age=age
#
# def eat(self):
# print("进食")
#
# class Person(Animal):
# pass
#继承的子类
#1 子类的类名可以访问父类的所有内容
# print(Person.breath)
# Person.eat(11)
#2 子类实例化的对象可以访问父类的所有内容
#... | true |
b81f9e0c3487fd8d1a9ddf3b6425a7442f9910ae | Python | juuso22/robobats2019 | /main.py | UTF-8 | 476 | 2.859375 | 3 | [] | no_license | import asyncio
import sys
import select
#import test1
@asyncio.coroutine
def main():
while True:
mode = input("Enter mode: ")
print(mode)
type(mode)
if mode == '1':
print("Here I do stuff")
#test1.do_stuff()
else:
print("I don't know what ... | true |
99bdb5ba0f77d9132a4f1388e97ee5d03814cc28 | Python | smautner/EGO | /ego/utils/timeout_utils.py | UTF-8 | 464 | 2.578125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
"""Provides scikit interface."""
import signal
def assign_timeout(func, timeout):
"""assign_timeout."""
def handler(signum, frame):
raise Exception("end of timeout")
def timed_func(*args, **kargs):
signal.signal(signal.SIGALRM, handler)
signal.alarm(timeout)... | true |
576bb7b347cc474693068b326ca59ef01633d8f9 | Python | Nguyen379/PycharmProjects-master | /Data Mining - Training/Data_Mining_Training_V6_Week1/ngram_bow_tfidf.py | UTF-8 | 10,308 | 3.390625 | 3 | [] | no_license | # n-gram: sequece of n words
# Bow (Bag of words): turn into a dictionary with the keys are the words and the values are the words' frequencies
# bow has no order and grammar. Because the highest frequency words are often meaningless like "the", "a", we can
# weight a term by the inverse of document frequency, or Tf-id... | true |
73aec23ffe9cee83a844cdb763433018cedd3a5b | Python | SymphonyPy/Mask_RCNN | /train.py | UTF-8 | 10,709 | 2.78125 | 3 | [
"MIT"
] | permissive | # coding: utf-8
# # Mask R-CNN - Train on Shapes Dataset
#
#
# This notebook shows how to train Mask R-CNN on your own dataset. To keep things simple we use a synthetic dataset of shapes (squares, triangles, and circles) which enables fast training. You'd still need a GPU, though, because the network backbone is a Res... | true |
8ab7c35b5ecd7417be2427aedcf20740a601566d | Python | tsm121/TDT4113 | /Øving 2/simpleGame.py | UTF-8 | 3,427 | 3.765625 | 4 | [] | no_license | #from randomPlayer import RandomPlayer
#from sequentialPlayer import SequentialPlayer
#from mostCommonPlayer import MostCommonPlayer
#from historianPlayer import HistorianPlayer
#from player import Player
import matplotlib.pyplot as plt
import numpy as npy
class SimpleGame:
def __init__(self, player1,... | true |
d0336a1c595d14e92481beaa0383290901645c1d | Python | LargeLlama/softdev | /26_rrreeesssttt/util/words.py | UTF-8 | 772 | 2.96875 | 3 | [] | no_license | import json, urllib.request
API_LINK = "https://www.dictionaryapi.com/api/v3/references/collegiate/json/"
API_KEY = "?key=4a0b1649-f508-4aae-a17b-03407ea06b6f"
def get_entry(word):
try:
response = urllib.request.urlopen(API_LINK + word + API_KEY)
data = json.loads(response.read())
return d... | true |
699625c1cf5973e40210c3b72086d14041f299bd | Python | EastcoastPhys/nhl-stats-crawler | /spiders/player_spider.py | UTF-8 | 4,622 | 2.8125 | 3 | [] | no_license | import re
import string
import re
from urlparse import urlparse
from nhl_stats_crawler.items import TupleItem
from scrapy.spider import Spider
from scrapy.selector import Selector
from scrapy.http import Request
from scrapy import log
from scrapy.selector import Selector
def urls(sel, base, x):
return map(lambda ur... | true |
a7132abf49b225cfbb7eb6b0402ed6cd7d4fdd17 | Python | osa10928/Udacity_FullStack_Proj1 | /media.py | UTF-8 | 635 | 3.25 | 3 | [] | no_license | # import webbroweser to open the youtube url for an instance of class Movie
import webbrowser
class Movie():
""" This class provides a way to store movie related information """
# Initializes instance with a title, storyline, image, and youtube url
def __init__(
self, movie_title, movie_story... | true |
7a92fbaabb2646deab8c2f8d66c0a63cde50181d | Python | Grayder0152/FakeCSV | /main/services.py | UTF-8 | 1,802 | 2.953125 | 3 | [] | no_license | import csv
from faker import Faker
from django.conf import settings
class CSVFile:
PATH = f'{settings.MEDIA_ROOT}/csv-files'
def __init__(self, rows: int, filename: str, column_separated: str,
string_separated: str, columns_headers: list,
columns_types: list, columns_ranges... | true |
ee5b7a959b261166f289e284aa8c935f954c00a5 | Python | gadm21/AI | /Attention/modules.py | UTF-8 | 5,364 | 2.53125 | 3 | [] | no_license |
from utils import *
import torch
from torch import nn
import torch.nn.functional as F
import numpy as np
import random
import math
class SelfAttentionWide(nn.Module):
def __init__(self, emb, heads = 8, mask = False):
super().__init__()
self.emb = emb
self.heads = heads
se... | true |
b78926ad73770e95ee7647b09a74a693c5265c16 | Python | JonL13/DnD | /utils/diceRoller.py | UTF-8 | 1,661 | 3.40625 | 3 | [] | no_license | import random, sys
class DiceRoller:
def __init__(self):
self.operators = ["+", "-"]
def getTotalRollValue(self, parsedCommand, isOutput = True):
total = 0
operation = "+"
for token in parsedCommand:
if token in self.operators:
operation = token
if isOutput is True:
... | true |
76fd98b618ac2cafdbc79e67358ec4db248240ae | Python | siikamiika/scripts | /vn/reibun_server.py | UTF-8 | 2,046 | 2.515625 | 3 | [] | no_license | #!/usr/bin/env python3
import os
import sys
import json
from http.server import BaseHTTPRequestHandler, HTTPServer
from urllib.parse import urlparse, parse_qs
from reibun import find_example_sentences
os.chdir(os.path.dirname(os.path.abspath(__file__)))
class ReibunServer(HTTPServer):
def set_path(self, path):... | true |
3e41e2676e38bea4d34c607c75e20dd8ba513c31 | Python | XXXalice/twitter_mischief | /etc/driver.py | UTF-8 | 285 | 2.53125 | 3 | [] | no_license | from .logger import Logger
log = Logger()
def read_yaml(yaml_path):
import yaml
try:
with open(yaml_path) as f:
param = yaml.load(f)
except Exception as e:
log.error(msg="can't read yaml file.", errmsg=str(e))
return e
return param | true |
d2e691724625ff9f17f9ed204ea54ebb881db1de | Python | fariz-amiraliyev/DevOps--Roadmap | /DevOps-Engineer-Roadmap/Automation/Python/Functions/functions.py | UTF-8 | 736 | 3.765625 | 4 | [] | no_license | 1. # an IP address and print the IP
# function to remove leading zeros
def removeZeros(ip):
# splits the ip by "."
# converts the words to integeres to remove leading removeZe
# convert back the integer to string and join them back to a string
new_ip = ".".join([str(int(i)) for i in ip.split(".")])
... | true |
245b99a2b59e9555e6b26e36c9662a29af4c9bd0 | Python | gosch/Katas-in-python | /2018/august/codesignal/sum_up_digits.py | UTF-8 | 937 | 3.578125 | 4 | [] | no_license | def sumUpDigits(inputString):
res = 0
number = ''
flag = False
i = 0
while i < len(inputString):
while i < len(inputString) and inputString[i].isdigit():
number += inputString[i]
i+=1
if number.isdigit():
res += int(number)
number = ''
... | true |
908ddf4d1599632e7db0bcb87b8cb2309ec1366d | Python | mathslinux/vman | /list.py | UTF-8 | 1,733 | 2.625 | 3 | [] | no_license | from ConfigParser import ConfigParser
from manager import VMManager
vman_config = 'vman.cfg'
def get_mac(cfg):
p = ConfigParser()
p.read(cfg)
mac = []
for s in p.sections():
if s.startswith('net'):
mac.append(p.get(s, 'mac'))
return mac
def list(args):
p = ConfigParser(... | true |
82d52794829500909fc30344633ba69c67359b9e | Python | ai-kmu/etc | /algorithm/2022/0329_1054_Distant_Barcodes/Jongchan.py | UTF-8 | 1,084 | 3.328125 | 3 | [] | no_license | class Solution:
def rearrangeBarcodes(self, barcodes: List[int]) -> List[int]:
n=len(barcodes)
ans=[0]*n
ts=Counter(barcodes).most_common() # 가장 많은 수와 그 수의 개수를 튜플로 반환
a=[]
for t in ts:
a.extend([t[0]]*t[1]) # 가장 많은 수 부터 순서대로 재배치
if n%2==0: # 짝수일 때... | true |
9186358a94391bc54bd9b2757ed8d571d6b1b061 | Python | poilvert/toy-problems | /ricci-flow1d/codes/generate_random_closed_curve.py | UTF-8 | 1,138 | 3.71875 | 4 | [] | no_license | #!/usr/bin/env python
from math import pi
import numpy as np
def random_closed_curve(theta_step=0.01, a=1., b=1.2, c= 0.5, d=0.6):
"""A simple program that generates a simple closed planar curve
using polar coordinates. The program returns the x and y coordinates
of points along the curve. The points are... | true |
dd8b829e1f6e3ca024c17991376556b29188c2ff | Python | sajimgomez/Space-Invaders | /SpcInvSpaceShip.py | UTF-8 | 686 | 3.3125 | 3 | [] | no_license | import pygame
class SpaceShip(pygame.sprite.Sprite) :
def __init__(self, Width, Length) :
pygame.sprite.Sprite.__init__(self)
self.image = pygame.image.load('space-invaders.png')
self.rect = self.image.get_rect()
self.rect.midbottom = (Width / 2, Length)
self.speed = ... | true |
ac37f07b582e2e4e1eda729f4199279ae0c39e18 | Python | ZosoV/WebServerHungrYT | /user/models.py | UTF-8 | 1,049 | 2.703125 | 3 | [] | no_license | from django.db import models
# Create your models here.
class Usuario(models.Model):
name = models.CharField(max_length=30, verbose_name='Nombre ')
last_name = models.CharField(max_length=30, verbose_name='Apellido ')
email = models.CharField(max_length=50, verbose_name='Email ')
user_name= models.Cha... | true |
56915b7918eb6f622ea3a2ad2ca681efaa02f545 | Python | HigasaOR/mitoSNV-patho-predictor | /src_preprocessing/do_gnomAD.py | UTF-8 | 783 | 2.578125 | 3 | [] | no_license | import re
import json
import pandas as pd
def extract_gnomad_freq():
read_path = "../download/gnomad.genomes.v3.1.sites.chrM.reduced_annotations.tsv"
gnomad_df = pd.read_table(read_path, sep="\t", dtype=str)
freq_dict = {}
reg = re.compile(r'^[A-Z]$')
for _, row in gnomad_df.iterrows():
... | true |
983cb3fea1a5338fa47f5721f1c9ae3593653679 | Python | scheung38/nhs | /src/part1_news_search.py | UTF-8 | 1,005 | 2.734375 | 3 | [] | no_license | import os
import re
regex1 = re.compile('Care|Quality|Commission') # 0,1,2,3,4,5,6 PASSED
# regex1 = re.compile('September|2004') # 9 PASSED
# regex1 = re.compile('general|population|generally') # 6,8 PASSED
# regex1 = re.compile('Care Quality Commission|admission') # 1
# regex1 = re.compile('general population|... | true |
286e2f60b1f39282f153e59d8b2d4904f44a1cc8 | Python | Rydez/SpaceGame | /hud.py | UTF-8 | 953 | 3.03125 | 3 | [] | no_license | from environment import *
class Hud:
def __init__(self):
# Bool for fps switch
self.fps_toggle = False
def drawHud(self, player_money, player_name):
# Make labels
fps_label = FPSFONT.render('fps: ' + str(clock.get_fps()), 1, (255, 255, 255))
name_label = NAMEFONT.rend... | true |
b7f8fb16f74704e8977001650ae1e6fa02b1ae28 | Python | 0xsakthi/Hacker-Rank-Solutions | /(6)write-a-function.py | UTF-8 | 188 | 3.46875 | 3 | [] | no_license | #!/usr/bin/python3
def leap(year):
leap = False
if year%400 == 0:
leap = True
elif year%4 == 0 and year%100 != 0:
leap = True
return leap
answer = leap(int(input()))
print(answer) | true |
4ee685e3d0d22b3ccfd6b2ce7f39b92f68898611 | Python | kishirasuku/atcoder | /abc/125/a.py | UTF-8 | 87 | 2.828125 | 3 | [] | no_license | a,b,t=map(int,raw_input().split())
sums=0
for i in range(t/a):
sums+=b
print sums
| true |
d54698420f3fa94f696041901e0a4e8e0c9a9328 | Python | karelrenaldi/supremoKrCrypt | /supremoKrCrypt.py | UTF-8 | 410 | 3.515625 | 4 | [] | no_license | def encrypt(password):
encPassword = ""
for char in password:
num = str(ord(char) ** 4 + 200) + "#"
encPassword += num
return(encPassword)
def decrypt(res):
decPassword = ""
resArray = res.split("#")[:-1]
for num in resArray:
char = int((int(num)-200)**(0.25))
c... | true |
cc6ff713005c148a34da05d52adc49422ef1e309 | Python | chetandg123/cQube | /SAR_validations/District_block_clicks.py | UTF-8 | 1,396 | 2.84375 | 3 | [] | no_license | import time
import unittest
from selenium import webdriver
from selenium.webdriver import ActionChains
from Data.Paramters import Data
class Districts(unittest.TestCase):
@classmethod
def setUp(self):
self.driver = webdriver.Chrome(Data.Path)
self.driver.maximize_window()
self.drive... | true |
e9198bd58b484b30bacc7afe16d84fd232854203 | Python | JLCarveth/project_euler | /2.py | UTF-8 | 616 | 3.9375 | 4 | [] | no_license | class Problem():
def solve(self):
'''
By considering the terms in the Fibonacci sequence whose values
do not exceed four million, find the sum of the even-valued terms.
'''
fib1 = 1
fib2 = 1
result = 0
_sum = 0
while result < 4000000:
... | true |
ca990c4213052deaec146172aad09faab9a3ce69 | Python | densminger/pyNes | /Bus.py | UTF-8 | 1,717 | 2.578125 | 3 | [] | no_license | import Nes6502
import Nes2C02
import Cartridge
class Bus:
def __init__(self):
self.cpu = Nes6502.Nes6502()
self.ppu = Nes2C02.Nes2C02()
#self.cpuRam = [0 for i in range(2048)]
self.cpuRam = [0 for i in range(0xFFFF)]
self.cart = None
self.systemClockCounter = 0
... | true |
551802ea6d5fc411c7fb81a2aff257834a624777 | Python | harpreets652/genetic-algorithms | /twitter-subset-selection/src/PlotData.py | UTF-8 | 7,418 | 2.765625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import csv
from collections import namedtuple
NsgaIndividual = namedtuple("NsgaIndividual", "Id Chrom Accur NumBits Time")
def plot_gen_vs_fitness(file_name, title, fig_text):
data = np.loadtxt(file_name)
gen, min_val, avg_val, max_val = data[:, 0], data[:, ... | true |
a580208e9f09b388c90c44f3072f06f3cd7153a3 | Python | ahpraveen/python-selenium-demo | /tests/selenium-chrome-demo.py | UTF-8 | 1,225 | 2.71875 | 3 | [] | no_license | import unittest
from pages import seleniumhq_home_page
# Python demo - chrome driver
class SeleniumChromeTest(unittest.TestCase):
def setUp(self):
self.driver = seleniumhq_home_page.launch_browser("chrome")
def test_selenium_homepage(self):
self.assertEqual("Selenium - Web Browser Automation"... | true |
a7e765d782f12a3ec57b3708dfa11aaad4f307f6 | Python | JiangHongSh/TestGit | /2018-03-18/html_outper.py | UTF-8 | 996 | 2.65625 | 3 | [
"MIT"
] | permissive | #导入包转换链接中的中文字符
import urllib.parse
import os
import pymongo
class HtmlOutputer(object):
def __init__(self):
self.datas = []
self.names = []
def collect_data(self,data,name):
if data is None:
return
self.datas=data
self.names=name
def output_html(self... | true |
7541cb4dac023cb9756624b19e42ec0c580e9f21 | Python | asifraza-sonu/Filter-and-Wrapper-based-methods | /Recursive Feature Elimination_2018AIML551_ass2.py | UTF-8 | 1,767 | 3.390625 | 3 | [] | no_license | from sklearn.neighbors import KNeighborsClassifier
from mlxtend.feature_selection import SequentialFeatureSelector as SFS
import pandas as pd
from sklearn.metrics import mean_squared_error
import math
import warnings
warnings.filterwarnings('ignore')
print("\n\nWrapper-based Method (using K-Nearest Neighbor classifier... | true |
02d1cb28ead37545495540e68d083be6049aa90d | Python | saiharsh976/sai4 | /51.py | UTF-8 | 53 | 3.234375 | 3 | [] | no_license | th1=input()
for i in list(th1):
print(i,end=" ")
| true |
af7236b0a6e0e69f9c92f933395ba2bb491977d6 | Python | Bidur-Khanal/Raspberry-Pi-zero-camera-motion-detection-and-home-surveillance | /Experiment Codes/json_operation.py | UTF-8 | 472 | 2.578125 | 3 | [] | no_license | import json
class configuration:
def __init__(self):
self.a=0
def read_data(self):
with open("Data/configuration.json", "r") as jsonFile:
data = json.load(jsonFile)
return data
def write_data(self,data):
threshold =data["Devices_Settings"]["Camera"][0]... | true |
ec0f61134b93fe5ecf49f12c17774e28398e819f | Python | jysandy/chestify | /chestify/filetree.py | UTF-8 | 1,087 | 3.375 | 3 | [] | no_license | class FileTree:
""" Represents the user's filesystem as a nested dict structure.
"""
def __init__(self):
self.fs = { 'folders' : dict(), 'files' : dict() }
def add_path(self, path, meta={}):
""" Adds a complete file path to the filesystem.
Empty directo... | true |
64cb7a927c0d980a76fb1371a016cd30eada743f | Python | remirobert/metasearch-engine | /metaEngine/search/printDebug.py | UTF-8 | 451 | 2.625 | 3 | [
"MIT"
] | permissive | from data import DataResult
def printResult(resultData):
for currentData in resultData:
print "\033[31m", currentData.title, " \033[32m", currentData.url, \
" \033[33m", currentData.content, "\033[0m\n"
def printVideo(resultData):
for currentData in resultData:
print "\033[31m", cu... | true |
d296071618d4f1e12c683971bd268b83a1f00a0a | Python | SmogySlayer69/Calculator | /myMath/geometric.py | UTF-8 | 157 | 2.90625 | 3 | [] | no_license | class Geometric:
#Multiply
def Multiplication(self, x, y):
return x * y
#Divide
def Division(self, x, y):
return x/y
| true |
5974969c655dfa587a51aca028abde3ae2104458 | Python | romikps/nlp | /project-improved-direct-translation/ngram.py | UTF-8 | 2,130 | 3.171875 | 3 | [] | no_license | import csv
from nltk import FreqDist
from nltk.corpus import brown
class NGramDictionary:
def __init__(self, n=1):
self.dictionary = {}
self.n = n
if n == 1:
self.load_unigrams()
elif n == 2:
self.load_bigrams()
elif n == 3:
self.load_trig... | true |
91d28bca963965bd388900ebbd7e13d34f508895 | Python | BhagyashreeU/Big-data-projects | /task1.py | UTF-8 | 1,958 | 2.84375 | 3 | [] | no_license | from pyspark import SparkContext
import re
import string
from pyspark import SparkConf
import nltk
from nltk.corpus import stopwords
nltk
from nltk.tokenize import word_tokenize
import matplotlib.pyplot as plt
from wordcloud import WordCloud
sc = SparkContext("local", "program app")
def wordcloud(counts)... | true |
41a40ff19e320ea919059e3b3166f837cbefda5a | Python | baptiste-pajot/adventure_of_code | /day_02/day02_1.py | UTF-8 | 465 | 3 | 3 | [] | no_license | import math
def main():
f = open("input.txt", "r")
for x in f:
tab = list(map(int, x.split(",")))
print(tab)
i = 0
while 1:
if tab[i] == 99:
break
elif tab[i] == 1:
tab[tab[i + 3]] = tab[tab[i + 1]] + tab[tab[i + 2]]
elif tab[i] == 2:
... | true |
243a23e4066ac39542e4353d6053577e1c0fd841 | Python | hgy9709/p2_20161118 | /W10main.py | UTF-8 | 2,975 | 3.09375 | 3 | [] | no_license | def Milk():
allData=list()
allData=[ ["Coffee","Weter","Milk","Icecream"],
["Espresso","No","No","No"],
["Long Black","Yes","No","No"],
["Flat white","No","Yes","No"],
["Cappuccino","NO","Yes - Frothy","No"],
["Affogato",'No','No','Yes']]
data= allData[1:]
a=0
for i in... | true |
7c89c9688e9fba6e9a4462369976bde07f56f580 | Python | zhaoweisonake/turbulence_spectra | /src/data/integrity_check.py | UTF-8 | 3,494 | 3.046875 | 3 | [
"MIT"
] | permissive | """CLI script to verify integrity of matlab files and re-download corrupt files"""
from pathlib import Path
from scipy.io import loadmat
from scipy.io.matlab.miobase import MatReadError
from tqdm import tqdm
from multiprocessing import Pool
from typing import List, Sequence, Optional
import logging
import typer
import... | true |
c6d1bfb96c0660f6288f32adbd79325cba8f15a1 | Python | LucianoAlbanes/AyEDII | /TP8/P2_E7.py | UTF-8 | 2,813 | 3.84375 | 4 | [] | no_license | # Part 2 of 'Análisis y Diseño de Algoritmos'
# Greedy
from lib.algo1 import *
from lib import linkedlist as LL
# Exercise 7
def mochila(maxWeight, cansArray):
'''
Explanation:
Finds the best arraignments of cans to reach the maximum possible profit
without sobrepassing a given ... | true |
1b7cf94006a00aa15ab6259de167fc83e9a4a0f2 | Python | apache/beam | /sdks/python/apache_beam/examples/per_entity_training.py | UTF-8 | 5,265 | 2.609375 | 3 | [
"BSD-3-Clause",
"MIT",
"LicenseRef-scancode-protobuf",
"Apache-2.0",
"Python-2.0"
] | permissive | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | true |
b4874d671c60f592001cce43b157fae7cbe3ead0 | Python | rasql/turtle-tutorial | /docs/2_var/var4.py | UTF-8 | 181 | 2.953125 | 3 | [
"MIT"
] | permissive | # draw a parallelogram
from turtle import *
a = 200
b = 150
angle = 60
forward(a)
left(angle)
forward(b)
left(180-angle)
forward(a)
left(angle)
forward(b)
left(180-angle)
done()
| true |
e3bfce40ae1bd94cf7c52d9fad67157c13b3fb50 | Python | YangChuan80/Routine | /Plots/Rectangle.py | UTF-8 | 417 | 2.734375 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import math
from matplotlib.patches import Rectangle
#Create the figure object
fig=plt.figure()
plt.axis([-0.7,20,30,-0.7])
#Subplot ax
ax0=fig.add_subplot(1,1,1)
#currentAxis = plt.gca()
ax0.add_patch(Rectangle((1, 2), 10, 10, linewidth=0, face... | true |
5c3e4cf97da211b7ff2f419449a2ff3d07edbeb0 | Python | MarkusPaulsen/HiTMAV | /models/Model/Image.py | UTF-8 | 931 | 3.171875 | 3 | [] | no_license | # <editor-fold desc="Import Numpy">
from numpy.core.multiarray import ndarray
# </editor-fold>
class Image:
# <editor-fold desc="Constructor">
def __init__(self, image_name: str, image_height: int, image_width: int, image_bw: bool, image_data: ndarray):
self._image_name: str = image_name
self... | true |
00ec7b42ee1df8b8d3797be908077a50bd87e56e | Python | pawelszopa/air_reservation_system | /__main__.py | UTF-8 | 485 | 2.609375 | 3 | [] | no_license | from pprint import pprint
from flight import Flight
from planes import *
from helpers import *
def make_flights():
b = Boeing737()
f = Flight('BA123', b)
f.allocate_passenger('Test_passenger 2', '1B')
f.allocate_passenger('Test_passsenger 1', '1A')
f.allocate_passenger('Test_passeng... | true |
bbda9159df6d000ff55c54b50e2bc43fe4debcb1 | Python | DingYinghui/summer_project | /shaokai_jiashen/GrangerCausality/Code/QM_GC/covariance.py | UTF-8 | 223 | 2.765625 | 3 | [] | no_license | import numpy as np
def covariance(X,Y,n):
x_bar = np.mean(X,axis=0)
y_bar = np.mean(X,axis=0)
cov_value=0;
for i in range(1,n+1):
cov_value = cov_value+X[i]*Y[i]
return cov_value/n - x_bar*y_bar | true |
b1a24583d7da13359a663ef2ecc06fe11ef8f460 | Python | AidanTek/PiNoons | /PythonBasics/Scripts/udlr.py | UTF-8 | 288 | 3.796875 | 4 | [] | no_license | move = input("Type 'up', 'down', 'left', or 'right': ")
if move == 'up':
print("You typed up")
elif move == 'down':
print("You typed down")
elif move == 'left':
print("You typed left")
elif move == 'right':
print("You typed right")
else:
print("Input not recognised") | true |
69d45d0393c869949657d18f7e50ed9b6c45c682 | Python | TarunDabhi27/LearningPython | /01-language-fundamentals/input_from_keyboard.py | UTF-8 | 290 | 3.671875 | 4 | [] | no_license | '''
Created on Dec 7, 2019
@author: tarun.dabhi
'''
from builtins import input
if __name__ == '__main__':
num1 = float(input("Enter first number : "))
num2 = int(input("Enter second number : "))
num3 = num1+num2
print("Sum of {} and {} is {}".format(num1, num2, num3))
| true |
cbb0eb7ac265951e687724e6a54fcc350b281ec2 | Python | ziqic119/phonetic_focus | /label.py | UTF-8 | 2,556 | 2.921875 | 3 | [] | no_license | import re
# # input files
with open('C:/Users/RA12/PycharmProjects/focus/sub12_3d.csv', 'r', encoding="utf-8") as f:
lines = f.readlines()
print('csv lines: ' + str(len(lines)))
with open('C:/Users/RA12/PycharmProjects/focus/sub12_3d.TextGrid', 'r', encoding="utf-8") as f1:
lines1 = f1.readlines()
... | true |
a424216dea697642a4dbd391ae9761207492b266 | Python | alfmat/HackNC_2018 | /Advanced_Web_Dev/app1.py | UTF-8 | 580 | 3.078125 | 3 | [] | no_license | from flask import Flask, render_template, request
app = Flask(__name__)
x = 0
@app.route("/")
def root():
return "hello world"
@app.route("/show/")
def show():
return "x is "+str(x)
@app.route("/incr/")
def incr():
global x
x = x+1
return "X has been incremented"
@app.route("/incr_by/<int:n>/")
... | true |
819ac31df31dd00e4a781354f86b5f878d4d46c5 | Python | yuhlearn/project_euler | /problem_115/problem_115.py | UTF-8 | 301 | 2.671875 | 3 | [] | no_license | from time import time
start_t = time()
m = 50
n = m
res = [0] * (200 + 1)
while res[n] + 1 <= 10**6:
n += 1
d = n - m
res[n] += (d + 1) * (d + 2) / 2
res[n] += sum([a * b for a, b in zip(res[1 : d], range(d - 1, 0, -1))])
res = [r + 1 for r in res]
print time() - start_t
print n
| true |
502cc4775280981d8e3c2c807c88d4e2169fd801 | Python | jhaip/lovelace | /new-backend/populate.py | UTF-8 | 2,510 | 3.0625 | 3 | [] | no_license | import sqlite3
conn = sqlite3.connect('example.db') # ':memory:'
c = conn.cursor()
def init_table(conn, c):
c.execute('''CREATE TABLE IF NOT EXISTS facts (
id INTEGER PRIMARY KEY,
factid INTEGER,
position INTEGER,
value,
type TEXT
)''')
conn.commit()
def populate(conn, c):... | true |
da8d7780e8d124e0cbad42f603d18940b6d8c08b | Python | backtothefuture3030/algorithms | /TheKnightsOfTheRound.py | UTF-8 | 378 | 3.6875 | 4 | [] | no_license | import math
a=float(input("삼각형 한변의 첫번째 길이를 입력하세요 : "))
b=float(input("삼각형 한변의 두번째 길이를 입력하세요 : "))
c=float(input("삼각형 한변의 세번째 길이를 입력하세요 : "))
s=float((a+b+c)/2)
A = (s*(s-a)*(s-b)*(s-c))**(1/2)
r = 2*A/(a+b+c)
print("The radius of the round table is : {}".format(round(r,3))) | true |
a3eaa5fe7510ab90ea97ffe5c4e5015a3d897871 | Python | reynardasis/code-sample | /letterspyramid.py | UTF-8 | 485 | 2.59375 | 3 | [] | no_license | letter = '0abcdefghijklmnopqrstuvwxz'
n = int(input())
center = letter[n]
left = ''
for i in xrange(n,0,-1):
print '-' * ((i*2)-2) + center +left+'-' * ((i*2)-2)
# print center[::-1]
center += '-'+letter[i-1]
left = '-' + letter[i] + left
# print center, lef
center = center[0:2*n-1]
for... | true |
3dacd427c20487eac04ca25e19aec70fbf1f66c2 | Python | harmanaujla1823/Python2021 | /assngnmnt.py | UTF-8 | 741 | 3.203125 | 3 | [] | no_license | import pandas as pd
from sklearn.tree import DecisionTreeClassifier
from sklearn.model_selection import train_test_split
from sklearn import metrics
diabetesDataSet = pd.read_csv("pima-indians-diabetes.csv")
print(diabetesDataSet)
featureColumns = ['pregnant', 'glucose', 'bp', 'skin', 'insulin', 'bmi', 'pedigree', 'ag... | true |
2252d737befe04996ce740561450f3549466b428 | Python | krzychuwr1/old-python-projects | /wronakrzysztof_hw6/utils/compilation.py | UTF-8 | 751 | 2.515625 | 3 | [] | no_license | import subprocess
def do():
"""
Compiles c++ and java sources.
:return:none
"""
try:
subprocess.check_call(["javac", "java/IO1.java"])
subprocess.check_call(["javac", "java/IO2.java"])
subprocess.check_call(["javac", "java/CPU1.java"])
subprocess.check_call(["javac"... | true |
b04c3cb8bac5f7554186d7190ef912d3b0e0176d | Python | cassiandrei/AutomatonGenerator | /main.py | UTF-8 | 2,530 | 3.1875 | 3 | [] | no_license | import sys
from antlr4 import *
from antlr.AutomatonGrammarLexer import AutomatonGrammarLexer
from antlr.AutomatonGrammarParser import AutomatonGrammarParser
from antlr.AutomatonGrammarListener import AutomatonGrammarListener
from automato import Automato
class Listener(AutomatonGrammarListener):
alfabeto = []
... | true |
70a35af6f571c0168770097795aab03ca93ca6ff | Python | jaiswati/SiT-pytorch | /sit.py | UTF-8 | 3,656 | 2.546875 | 3 | [
"MIT"
] | permissive | import torch
from torch import nn
import numpy as np
from einops import repeat
from einops.layers.torch import Rearrange
from module import Attention, PreNorm, FeedForward
class Transformer(nn.Module):
def __init__(self, dim, depth, heads, dim_head, mlp_dim, dropout = 0.):
super().__init__()
self... | true |
4aecaa77d59d153edb8b6a938baa5d5647231974 | Python | aguinaldolorandi/Python_exercicios_oficial | /Lista de Exercícios nº 05 Python Oficial/Ex.01-lista05.py | UTF-8 | 310 | 3.765625 | 4 | [] | no_license | # EXERCÍCIO Nº 01- LISTA 05 - LISTAS
print('\n Impresão')
print('#########\n')
def impressaoI(n):
for i in range(1,n+1):
print('-',end=" ")
for z in range (0,i):
print(i,end=' ')
print()
n=int(input('Informe um número inteiro: '))
impressaoI(n)
| true |
6b4fa9121f27fda35e3da6255c6c50e44adaefca | Python | Honry/webpnp-test-automation | /chromium-builder/build_server_chrome_x64.py | UTF-8 | 1,885 | 2.5625 | 3 | [] | no_license | #!/usr/bin/python3
import socket
import json, time
import utils
import builders
LISTEN_ADDRESS = "0.0.0.0"
LISTEN_PORT = 8790
ERROR_LOG_FILE = "C:\\logs\\build_server_error.log"
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((LISTEN_ADDRESS, LISTEN_PORT))
s.listen(5)
def build(rev=None):
# Set of... | true |
e4201aa6021eff5de07bb4aae6dfe4a650d24129 | Python | otisgbangba/python-lessons | /Harder/fibonacci.py | UTF-8 | 102 | 3.203125 | 3 | [
"MIT"
] | permissive | current, next = 0, 1
for n in range(10):
print(current)
current, next = next, current + next
| true |
adbfc45062d7abe16d8bfc83231f7be69f6affb3 | Python | Markczy/Leecode | /分类/双指针/1.两数之和(2次).py | UTF-8 | 2,097 | 3.8125 | 4 | [] | no_license | """
给定一个整数数组 nums 和一个整数目标值 target,请你在该数组中找出 和为目标值 的那 两个 整数,并返回它们的数组下标。
你可以假设每种输入只会对应一个答案。但是,数组中同一个元素不能使用两遍。
你可以按任意顺序返回答案。
示例 1:
输入:nums = [2,7,11,15], target = 9
输出:[0,1]
解释:因为 nums[0] + nums[1] == 9 ,返回 [0, 1] 。
示例 2:
输入:nums = [3,2,4], target = 6
输出:[1,2]
示例 3:
输入:nums = [3,3], target = 6
输出:[0,1]
来源:力扣(Lee... | true |