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
060b5e3af5133fcdd6c57be827fc23d36db6ee84
nicolaswalcker/MateriasFaculdade
/Ciência da Computação - Python/Exercícios Condicionais (Python)/ex11.py
UTF-8
278
3.890625
4
[ "MIT" ]
permissive
import math as m y=0 x=int(input('Digite um valor para "x" aqui: ')) if x <= 1 and x > 0: y=m.log(x) elif x>1 and x <=2: y= m.log(x, 10) + m.sqrt(x) elif x>2 and x <=5: y=x**2 + m.e**x elif x > 5: y=x**(x/2) + m.log(x, 2) print('Resultado: {:.2f}'. format(y))
true
648792626b544e74843cd27b5ea7dc23fb096b7c
furkankahvecii/klu_drive
/system/data/personal/KLU/NLP-ESG/FEB24/FEB24-NLP-2.py
UTF-8
3,840
2.953125
3
[]
no_license
# TF-IDF bazı sözcüklere daha çok önem atama. # Term frequency => Cümledeki kelime sayısı / Cümledeki toplam kelimesi # Sözcüklerin birbiri ardına gelmesi söz konusu -> n gram # Öbek bazlı. Markov Chains => olasılık, bir şeyin bir başka şeyin ardına gelme olasılığı, çevirme yapılmasında # Sözcük bazlı inceledik , n gra...
true
5f4f1219de3a52483bdb5e5f7313b4c8c5efb209
olivier-compilatio/uniseg-python
/uniseg/breaking.py
UTF-8
1,494
3.5
4
[ "MIT" ]
permissive
"""Breakable table and string tokenization """ from __future__ import (absolute_import, division, print_function, unicode_literals) __all__ = [ 'boundaries', 'break_units', ] def boundaries(breakables): """Iterate boundary in...
true
8629456e46ece974eeac46b732304ca584449994
FluTheFire/3-Minutes-Python
/Day-4 [List in Dictionary].py
UTF-8
633
4.625
5
[]
no_license
# Create dictionary car = {'Honda':['civic','accord','jazz'], 'Toyota':{1:'vios', '2': 'yaris'}} # print list in dictionary print(car['Honda']) # print list[index] in dictionary print(car['Honda'][1]) # print dictionary in dictionary print(car['Toyota']['2']) # print type of car (car type) print(type(car)) # print k...
true
987d5c31b0e38c388f78f4fcf3fddfaa95acf96c
alexavila150/CS2302
/Hashes/CHashTable.py
UTF-8
3,612
3.71875
4
[]
no_license
class HashTable: # Builds a hash table of size 'size' def __init__(self, size): self.table = [[] for i in range(size)] def hash(self, k): return k % len(self.table) # Inserts k in the appropriate bucket if k is not already there def insert(self, k): loc = self.hash(k) ...
true
b26780638da0293cd5981844b2801b7815394bbd
Aasthaengg/IBMdataset
/Python_codes/p02795/s724471596.py
UTF-8
190
3.515625
4
[]
no_license
ans = 100 H = int(input()) W = int(input()) N = int(input()) for i in range(H+1): for j in range(W+1): if i * W + j * H - i * j >= N: ans = min(ans, i+j) print(ans)
true
39d01cc309eafd8b42bb3a1abb34c257fbbd6ac9
danebista/LeetCode-Algorithms
/Algorithms-LeetCode/41-50/50. mypow.py
UTF-8
711
2.671875
3
[]
no_license
class Solution: def myPow(self, x: float, n: int) -> float: cache={} def powAf(xe,num): if (xe,num) in cache: return cache[(xe, num)] if num==0: return 1 elif num<0: ...
true
74c6c3235f8ae5e5f6aeafbed04e03b3a150cf95
lerovitch/coursera
/hackerrank/quadrant-queries/interval_tree_lazy_update_manualmerge.py
UTF-8
8,550
2.90625
3
[]
no_license
import sys import itertools import math from collections import namedtuple from interval import update, Query, intersect_update QUAD_1 = 0 QUAD_2 = 1 QUAD_3 = 2 QUAD_4 = 3 X = 0 Y = 1 BEGIN = 0 END = 1 class SegmentTree(object): def __init__(self, n): level = int(math.ceil(math.log(n, 2))) self.e...
true
86565a69ce88eea6be0a22ec97d104f79a2d45f2
jeffli678/MachOTool
/utils/commafy.py
UTF-8
273
3.875
4
[ "Apache-2.0" ]
permissive
def commafy(val): """ Add ',' every 3 decimal digits. :param val: A int or long :return: A string that represents the value in decimal with a comma separator every 3 digits. """ assert isinstance(val, (int, long, float)) return format(val, ',')
true
01288f1f4c4565e689bbfbc6870854ffd0b7e30e
liuqiaoping7/AutomaticModulationClassification
/Jetson/plot_sample.py
UTF-8
583
2.6875
3
[]
no_license
import sys #import struct import matplotlib.pyplot as plt import numpy as np import scipy if len(sys.argv) < 3: raise Exception ("needs file arg, len arg") filevec = sys.argv[1] file_len = int(sys.argv[2]) f = scipy.fromfile(open(filevec), dtype=scipy.complex64) mean = np.mean(f) print("mean: " + str(np.abs(mea...
true
fa46c04c592615deb7ddeb66cb4df75d8487d858
LiangShang/FinalProject
/selecting/time_cost_mapping.py~
UTF-8
2,566
2.984375
3
[]
no_license
__author__ = 'Sherlock' import csv class TimeCostMapping: """mapping is the tuple with format (cost, time, (cpu, memory))""" mapping = [] pareto_frontier = [] def __init__(self, cost_table, performance_table): for memory in cost_table.memory_range: for cpu in cost_table.cpu_range:...
true
0863b4b0d70047e0e752b540e5dafea1005319ce
xiaohexh/code_library
/zmq_sample/pull_push_mode/worker.py
UTF-8
544
2.5625
3
[]
no_license
import sys import time import zmq def worker(): ctx = zmq.Context() receiver = ctx.socket(zmq.PULL) receiver.connect("tcp://127.0.0.1:5557") sender = ctx.socket(zmq.PUSH) sender.connect("tcp://127.0.0.1:5558") try: while True: s = receiver.recv() # simple progress indicator for the viewer sys.std...
true
d7c64ffc56bf1c3b053cc1935caa8660af74d278
rid47/pymysql
/read.py
UTF-8
490
2.96875
3
[]
no_license
import pymysql db = pymysql.connect("localhost","","","test") cursor = db.cursor() sql = "SELECT * FROM EMPLOYEE WHERE INCOME > '%d'"%(1000) try: cursor.execute(sql) results = cursor.fetchall() for row in results: fname = row[0] lname = row[1] age = row[2] sex = row[3] income = row[4] print("fname = %...
true
db8e6f253d4490bd8a566bdebaf481cef02430b9
tharen/uuc-ke7fxl
/ceforms/src/gui.py
UTF-8
2,970
2.765625
3
[]
no_license
import os import Tkinter as tk import tkFont class GUI(tk.Toplevel): def __init__(self,root): self.root = root self.root.columnconfigure(0,weight=1) self.root.rowconfigure(0,weight=1) self._setSize() self.panel = tk.Frame(self.root) self.panel.gri...
true
de1e3d50abdeae8f909b6b1c0b1d62c7dc9717ea
lagrassa/learn_prim_skills
/scripts/control/pr2_ik.py
UTF-8
14,450
2.640625
3
[]
no_license
#!/usr/bin/env python # TODO: Rewrite this using poses # If these imports fail, check that you ran setup_ik.py # Instructions are in the comments of that file # Remember to move the .so files into this folder try: from ikLeft import leftIK, leftFK from ikRight import rightIK, rightFK except: # If these instructions...
true
8e3e380db6569a87081e995b3045579e6be69faa
2021202025/Programming
/Patterns.py
UTF-8
152
3.078125
3
[]
no_license
# n = int(input()) # i = 0 # while i<n+1: # print('*'*i) # i += 1 # n = 3 # Oxford = dict(input().split() for _ in range(n)) # print(Oxford)
true
75276d5e51a5ace7319b4784a49aa0a22bf64d53
sachinyadav3496/InternshipBatch2020
/Techno_Intern_Batch/mytkapps/im.py
UTF-8
1,116
2.90625
3
[]
no_license
import tkinter as tk from PIL.ImageTk import PhotoImage root = tk.Tk() def enlarge(event): lb.config(height=tkimg.height()+10, width=tkimg.width()+10) def normal(event): lb.config(height=tkimg.height(), width=tkimg.width()) #tkimg = tk.PhotoImage(file="images/one.gif") tkimg = PhotoImage(file="images/corona....
true
635f1b6e12c7b4ccb6ec4ef39065d377475a5a06
satwikkottur/VisualWord2Vec
/word2vecVisual/utils/text-ret/ImageRetriever.py
UTF-8
15,043
2.8125
3
[]
no_license
# Class to retrieve the image using text only import os import numpy as np import re import nltk from nltk.stem import WordNetLemmatizer from copy import deepcopy import sys import pdb class ImageRetriever: # Attributes # Word2vec embeddings embeds = {}; Rembeds = {}; Sembeds = {}; Pembeds = {}...
true
f9aa6fe326e362346660f2456299e576c81d754b
rmattier/my_project
/scripts/testing.py
UTF-8
3,711
2.84375
3
[]
no_license
#!/usr/bin/env python import json from pprint import pprint # If the file existed prior, it gets re-written. def dhcpd_template(dhcpdFileName, dhcpSubnet, dhcpNetmask, dhcpRangeStart, dhcpRangeEnd, router): with open('%s' % dhcpFileName, 'w') as f: f.write("subnet %s netmask %s {\n" % (dhcpSubnet, dhcp...
true
697c8c1c81bb4245ff80fef29c7f4f698135e83a
Vijayenthiran/MITx-6.00.1x
/Quiz/P7_McNuggests_2.py
UTF-8
484
3.453125
3
[]
no_license
#Solution to McNuggests problem with nested for loop.. Idea ny Nikita Nelson def McNuggets (n): #6a+9b+20c = 0 for a in range(n/6): for b in range(n/9): for c in range(n/20): #print "(6*a) + (9*b) + (20*c) :" + str((6*a) + (9*b) + (20*c)) if ((6*a) + (9*b) + ...
true
56fee9f0c94d01bf33a5261f201270241935bb60
vserraa/movies-bot
/wat.py
UTF-8
7,489
2.671875
3
[]
no_license
import ibm_watson from ibm_cloud_sdk_core.authenticators import IAMAuthenticator import json import requests import textwrap import random from telegram.ext import Updater from telegram.ext import CommandHandler from telegram.ext import MessageHandler, Filters aut_key = "---TMDB API KEY HERE---"; url = "https://api.t...
true
a990824e23703dd51983ba36734b9d58d53bfb74
andugu/credit-fraud
/credit_fraud_pipeline/feature_engenc.py
UTF-8
1,464
3.109375
3
[]
no_license
# Feature Engineering & Encoding import yaml import pandas as pd import pickle from sklearn.preprocessing import MinMaxScaler from typing import Tuple, Union def feature_transformation(data: pd.DataFrame, encoder=None) -> Union[pd.DataFrame, Tuple[pd.DataFrame, object]]: """ Performs scaling over the middle colum...
true
7a39fb58fe82c1490f6f7b1fca293f2fdd25616e
varadkulkarni11/web-page-monitoring
/notify.py
UTF-8
1,155
2.625
3
[]
no_license
import smtplib from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart from email.mime.base import MIMEBase import datetime import time def read_file(fileName): li = [] with open(fileName) as f: li = [line.rstrip() for line in f] return li def read_credentials_from_file(): credenti...
true
67dbaed2a61e845747c28a48b67aae0b7f4fbc98
John3290/python-challenge
/PyBank/OLD/FinancialAnalysisCode.py
UTF-8
2,930
3.34375
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[1]: #import modules needed import os import csv # In[2]: #set everything to 0 total = 0 avchange = 0 increaseprofits = 0 decreaseprofits = 0 PastRevenue = 0 RevenueChange = 0 #store the change in revenue avchangelist = [] #Store months list Monthslist = [] # In[3]: ...
true
a5704c42dc12bf677ac36a906a963006dd0206b0
b-steel/mastermind
/game.py
UTF-8
4,700
3.8125
4
[]
no_license
import strategy, random, secretcode, computer import colors as c class Game(): def __init__(self, mode=1): self._mode = mode self._round = 0 self._code = [] self._maxrounds = 10 self._computer = computer.Computer() def get_code(self): entered = False whi...
true
397dedf6e2b03db70141f402cb545a0403fc9e79
FoosTronics/Main_program
/Jetson/src/Backend/BeeldKoppeling.py
UTF-8
7,218
3.21875
3
[ "Zlib" ]
permissive
""" Omschrijving: Koppelt de beeldherkenning aan de simulatie. Vertaalt hierbij de bal coördinaten in pixel positie van de beeldherkenning naar coördinaten voor de simulatie. Wanneer debug_flag=True zal de bal bestuurd kunnen worden d.m.v. trackbars. Wanneer deze True is zal een vooraf gedefinieerde v...
true
31b6bbfc360bcd948dcaf62226b2b66ccce8b448
reflectometry/osrefl
/osrefl/model/omf_loader.py
UTF-8
15,503
2.640625
3
[]
no_license
# Copyright (C) # All rights reserved. # See LICENSE.txt for details. # Author: nwright, Brian Maranville # edited: Christopher Metting #Starting Date:7/14/2009 from numpy import array, arange, indices, zeros, reshape, float, sqrt, int from numpy import float64, fromfile, product, ma, isinf, isnan,inf,nan DEBUG = Tr...
true
6dad173882270d4ea9eae6556637d5b4abb67fea
adamlwgriffiths/OMGL
/omgl/dtypes.py
UTF-8
2,211
2.515625
3
[ "BSD-2-Clause-Views" ]
permissive
from __future__ import absolute_import, print_function from OpenGL import GL import numpy as np class DataType(object): def __init__(self, integer, signed, np_type, gl_type, gl_enum, basic_type, char_code=None): self._integer = integer self._signed = signed self._np_type = np_type s...
true
be5ee99ce63041803b4af3d1e2f76f5766c4a117
rebeccasedgwick/pym
/exception_handling.py
UTF-8
221
3.46875
3
[]
no_license
def holla_at_me(): word = int(input("Word UP! Give me a number: ")) return word while True: try: print(holla_at_me()) except ValueError: print("Nacht, I don't translate roman numerals.")
true
7987dbcfc6a1b47625a7e917c88542af5606d944
iwaaaaaaaaaaaaaaag/atCoder
/ABC187/C/main.py
UTF-8
331
3.21875
3
[]
no_license
import re N = int(input()) S_lists = list(set(input() for i in range(N))) a = set() b = set() for i in range(len(S_lists)): if re.search('^!',S_lists[i]): a.add(re.sub('^!','',S_lists[i])) else: b.add(S_lists[i]) a_and_b = list(a&b) if a_and_b == []: print('satisfiable') else: print(a_...
true
19fc413c0c90d5faa0f37dfe512d1f50719d6983
pypr/automan
/examples/tutorial/automate2.py
UTF-8
912
3.09375
3
[ "BSD-3-Clause" ]
permissive
from automan.api import Problem, Automator class Squares(Problem): def get_name(self): return 'squares' def get_commands(self): return [ ('1', 'python square.py 1', None), ('2', 'python square.py 2', None), ('3', 'python square.py 3', None), ('4...
true
b61e4304c6affea5088db525ee30cbeb0d929fc8
GeeklifeWang/gitworkspace
/tool for 360/download_fun.py
UTF-8
1,304
2.765625
3
[]
no_license
# -*- coding:utf8 -*- import os, sys import urllib, time, threading download_url = '' downlload_path = '' def download(url,path): urllib.urlretrieve(url,path) def sss(url,path): time.sleep(0.5) response = urllib.urlopen(url) Header = response.info() total_size = int(Header.getheaders("Content-Len...
true
1e0d6cab4ca4df02139bd8ad5483460c545d2f0b
rksam24/MCA
/Sem 1/oops/Class and obj/Import/Salary.py
UTF-8
5,237
4.46875
4
[]
no_license
'''Create a class employee with following attributes: 1. Name 2. EmpID 3. Designation: Worker/ Supervisor/Manager 4. Salary 5. Experience Define all getter and setter methods + show method+__str__() Calculate Salary according to Designation and experience BaseSalary+AddSal+HRA BaseSalary is {10000, 15000, 20000} for Wo...
true
b31991420c002ec86370ce52aa5c903d9898e13c
waleedgeo/CNN_FE
/LR.py
UTF-8
3,965
2.59375
3
[]
no_license
#coding=utf-8 #__future__ import numpy as np import pandas as pd from sklearn import metrics from common_func import evaluate_method from sklearn.metrics import confusion_matrix from sklearn import svm import csv from sklearn.linear_model import LogisticRegression from sklearn.ensemble import RandomForestClas...
true
3be7d3db58a541df5df0a453f2a5ba638f33f3dd
douglasfreire/aprendizagem_python
/estruturas_controle/for_3.py
UTF-8
359
3.25
3
[]
no_license
produto = {'nome': 'Caneta Chic', 'preco': 14.99, 'importada': True, 'estoque': 793} for key in produto: print(key) print('#########################################') for value in produto.values(): print(value) print('#########################################') for key, value in produto.items(): ...
true
caf762945f16043834569103117f2554eced7531
redtdt/smdh
/path_postgres.py
UTF-8
934
2.703125
3
[]
no_license
import os def path_postgres(): # possible paths mypaths = ["c:\\program files\\postgresql","c:\\archivos de programa\\postgresql"] myversions = ["8.3","9.0","9.1"] thepath = '' theversion = '' resultado = '' for thispath in mypaths: candidate = thispath #print "checking ", c...
true
333404eb6793755c69ced5c8b5dba6823ef02eb8
maheshalladi99/python-code-heat
/day_5_prog_2.py
UTF-8
669
3.703125
4
[]
no_license
import random announcedNumbers = [] def randNumGen(start,end): while(len(announcedNumbers) <= 89): num = random.randint(start,end) if num not in announcedNumbers: #input("PRESS TO CONTINUE....") #print ("ANNOUNCED NUMBER is \t %d"%(num)) announcedNumbers.append(num) begin = 1 stop =...
true
909027f4440a02063ab476db76948173d5871bd7
tahmid-tanzim/problem-solving
/itertools-combinations-with-replacement.py
UTF-8
218
2.9375
3
[]
no_license
from itertools import combinations_with_replacement if __name__ == '__main__': S, k = input().split() t = sorted([''.join(sorted(i)) for i in combinations_with_replacement(S, int(k))]) print(*t, sep="\n")
true
c838b1e0f6000bfc8b67d38f8f6eab279df414c5
Soongja/Konyang-Health-Datathon-2019
/models/resnet9.py
UTF-8
1,829
2.703125
3
[]
no_license
import torch def conv_bn(channels_in, channels_out, kernel_size=3, stride=1, padding=1, groups=1, bn=True, activation=True): op = [ torch.nn.Conv2d(channels_in, channels_out, kernel_size=kernel_size, stride=stride, padding=padding, groups=groups, bias=False), ] if bn: ...
true
fcd92ee4f083fbc06e561468ddaaebf62d2640fe
yibre/ComArch2
/HW03ver3.py
UTF-8
13,598
2.5625
3
[]
no_license
# coding: utf-8 # In[1]: # cmd line arg import sys # open input file with open(sys.argv[-1], 'rt') as fileobj: file_content = fileobj.read() address = 0 # if not 0, print the content in the address range of the memory d = False # if True, print registers after each instruction is executed p = False # if True,...
true
16a4ef9d3c7608166e9dcb734669d16d1188edfa
wellqin/USTC
/PythonBasic/base_pkg/python-06-stdlib-review/chapter-07-DataPersistenceExchange/7.1-pickle/py_03_pickleWorkWithStreams.py
UTF-8
963
2.96875
3
[]
no_license
import sys, pickle, pprint, io sys.path.append('.') from pkg.breaker import addBreaker class SimpleObj: def __init__(self, name): self.name = name self.name_backwards = name[::-1] return @addBreaker def pickle_stream(): data = [] data.append(SimpleObj('pickle')) data.append(Si...
true
0a5a34dc5f76bda8cf1edecd06e8040015a91989
katustrica/bot_certificates
/certificates.py
UTF-8
3,730
3.125
3
[ "MIT" ]
permissive
import uuid import configparser from pathlib import Path from datetime import datetime, timedelta from typing import Optional, Union from marshmallow import Schema, fields, post_load class Certificate(): def __init__(self, name: str, owner_name: str, creation_da...
true
bc8cf4794a248482af22d8ed66c4a8cbcd99f2e3
jjfallete/resilient-community-apps
/fn_codegen_test/fn_codegen_test/components/funct_utilities_extract_ssl_cert_from_url.py
UTF-8
2,097
2.859375
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- # pragma pylint: disable=unused-argument, no-self-use """Function implementation""" import logging from resilient_circuits import ResilientComponent, function, handler, StatusMessage, FunctionResult, FunctionError class FunctionComponent(ResilientComponent): """Component that implements R...
true
4dec3d35caccc82c5899f7167faea6c7f8efee5c
matheusoliveira23/python
/areacirculo.py
UTF-8
83
3.140625
3
[]
no_license
raio=int(input("digite o raio do circulo \t")) pi=3.14 area=pi*raio**2 print(area)
true
e050991e6fab0eb7bc9bd7b1660ba559b8a01562
hdajic/mpvi_lab-s
/MPVI_LAB_2/Data.py
UTF-8
567
3.296875
3
[]
no_license
import csv def GetIntegerDataFromCsvFile(fileName): data = [] with open(fileName) as csvfile: spamreader = csv.reader(csvfile, delimiter = ' ') for row in spamreader: data.append([int(row[0]), int(row[1])]) #print('Data', data) return data def GetFloatDataFromC...
true
0a90230cd4fcd4cc14f748ec5f591677b302209b
Xtercel/okexFuturesArbitrage
/cls/queue.py
UTF-8
759
3.890625
4
[ "MIT" ]
permissive
class Queue: def __init__(self): self.items = [] self.pointer = 0 def empty(self): return self.items == [] def enqueue(self, item): self.items.append(item) def dequeue(self): self.items.pop(-1) def pop(self, idx): return self.items.pop(idx) de...
true
1f3c67fe121a5292d1ae209c73ba00e1532e64b3
frankieliu/problems
/leetcode/python/337/sol.py
UTF-8
1,439
3.703125
4
[]
no_license
6-line simple Python solution using DFS https://leetcode.com/problems/house-robber-iii/discuss/79458 * Lang: python3 * Author: feather * Votes: 4 The dfs function returns an array, the first element means the maximum if we include the value of the current node, and the second element means the maximum if we...
true
70230177e3a73f3af6cd43fb87979a1be0a494c0
anderscui/Programming
/py3/concurrency/asyncio_book/ex3_2.py
UTF-8
773
3.1875
3
[]
no_license
# coding=utf-8 import asyncio import time async def main(): print(f'{time.ctime()} Hello!') await asyncio.sleep(1.0) print(f'{time.ctime()} Goodbye!') # 获取一个 loop,在 async def 函数内,使用 `get_running_loop` loop = asyncio.get_event_loop() # schedule the coroutine to be run on the loop task = loop.create_task(...
true
d95e6fdcb166beae3430f2fc4df49f413a0c3777
alexcarlos06/CEV_Python
/Mundo 3/Desafio 074.py
UTF-8
567
4.53125
5
[ "MIT" ]
permissive
'''Crie um progrma que vai gerar cinco números aleatórios e coloque em uma tupla. Depois disso, mostre a listagem de núumeros gerados e também indique o menor e o maior valor que estão dentro da tupla.''' from random import randint n1 = randint(0, 9) n2 = randint(0, 9) n3 = randint(0, 9) n4 = randint(0, 9) n5 = randi...
true
0a632a40700a7b8c4cf2356552e7909d90e72cde
jack20951948/Python-Learning
/ntut python/mnist.py
UTF-8
3,650
3.0625
3
[]
no_license
#%matplotlib inline import tensorflow as tf import numpy as np from tensorflow.examples.tutorials.mnist import input_data import matplotlib.pyplot as plt def samplemat(): dims = (15, 15) aa = np.zeros(dims) for i in range(min(dims)): aa[i, i] = i # Display matrix # plot a matrix or an array...
true
c77f955eb915d783ed78c04e080bb65d59830b1a
flakesns/python-example
/regular-expression.py
UTF-8
361
3.296875
3
[]
no_license
import re text= "UPDATE `my_table` SET `col1` = '' WHERE `col_id` = '123456'" searchObj = re.search( r"`col_id` = '\d+'",text, re.M|re.I) if searchObj: print "Result : ", searchObj.group() else: print "Nothing found!!" #Extract number from string string = "test 123 test test" mynumber = int(re.search...
true
a1b55a8a5144283879877e00ea97acb7a2b8c3a5
arvindgautam777/API-Search-Books
/run.py
UTF-8
231
2.53125
3
[]
no_license
import requests #Using the sample input for 2nd API data = {"authors":"Jesse Grant"} #Ensure the app.py is running on the localhost with port:5000 r = requests.post("localhost:5000/search", json = data) record = r.json() print(record)
true
b0a36688924985529e1fa4e9a1ee1c89cda175b4
Amenable-C/software-specialLectureForPython
/ch013.py
UTF-8
120
3.515625
4
[]
no_license
num = int(input("plz give me the under 20 number : ")) if(num >= 20): print("Too high") else: print("Thank you")
true
2b8c8b4c92459adaba45c429cbc7ef9d49accfda
whjzsy/gan-visual-tracking
/scripts/butil/__init__.py
UTF-8
338
2.984375
3
[]
no_license
import math import sys def d_to_f(x): return [round(float(o), 4) for o in x] def matlab_double_to_py_float(double): return list(map(d_to_f, double)) def ssd(x, y): if len(x) != len(y): sys.exit("cannot calculate ssd") s = 0 for i in range(len(x)): s += (x[i] - y[i]) ** 2 re...
true
1d6ea8adf265e797ff0a1d8ce8060c08b1f08b5c
vinodbellamkonda06/myPython
/project/project@1.2.py
UTF-8
299
3.109375
3
[]
no_license
primelist = [2] num = 3 while len(primelist) != 10001: for a in primelist: if num % a == 0: num += 1 break elif a == primelist[-1]: primelist.append(num) num += 1 break b = primelist[-1] print("Answer is {}".format(b))
true
e5da7f51dcd78243788184b7ec56a81cba48fdd2
alqamahjsr/InterviewBit-1
/05_Hashing/four_sum.py
UTF-8
1,750
3.796875
4
[ "MIT" ]
permissive
# 4 Sum # https://www.interviewbit.com/problems/4-sum/ # # Given an array S of n integers, are there elements a, b, c, and d in S such that # a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target. # # Note: # Elements in a quadruplet (a,b,c,d) must be in non-descending order. (...
true
072330b31283b37a82b4e8124425ba766b883b1f
bvillasen/cosmo_tools
/tools/get_cosmo_outputs_summit_2048.py
UTF-8
836
2.53125
3
[]
no_license
import sys, os, time import numpy as np import matplotlib.pyplot as plt n_per_range = [ 20, 20, 50, 40, 40 ] z_range_all = [ [100, 16], [16, 10], [10, 5], [5, 3], [3, 2] ] n_ranges = len( n_per_range ) a_range_all = [] delta_a_all = [] for i in range(n_ranges): n = n_per_range[i] z_range = z_range_all[i] z_sta...
true
1d5ba519b710cabac7ad8fd7b2e6f246c51e7977
pythoncanarias/PydayTF2017Ejemplos
/introduccion python/ejercicio.py
UTF-8
454
2.90625
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Script que muestra todas las imagenes de una carpeta @author: victor """ import fnmatch import os images = ['*.jpg', '*.jpeg', '*.png', '*.tif', '*.tiff'] matches = [] for root, dirnames, filenames in os.walk('/Users/Victor/Desktop'): for extensions in images: ...
true
105b9547cae23c67b7b19a7573a1c3a885354cd5
sharadhil/ml
/lp1.py
UTF-8
634
3.265625
3
[]
no_license
import csv # s find algorithm with open('data.csv','r') as f: reader = csv.reader(f) dlist = list(reader) h = [['0','0','0','0','0','0']] print("Data input is:") for l in dlist: print(l) print("Training Data:") for i in dlist: if i[-1] == "True": print(i) j = 0 for x in i: ...
true
2c031f06a6ffa0e8354e54176ced6268f41d7b7d
anj96/Practicals
/largenumber.py
UTF-8
241
3.078125
3
[]
no_license
import collections n=int(input()) str_arr=input().split() arr=[int(x) for x in str_arr] q=int(input()) d = {x: arr.count(x) for x in arr} print(d.keys()) print(d) #while q>0: # q-=1 # t,x=input().split(' ') # t=int(t) # x=int(x)
true
1914d77dc7d18db7a750c15209e890e6612a1dbc
AllenCellModeling/geneselection
/geneselection/utils/data.py
UTF-8
3,345
2.640625
3
[ "MIT" ]
permissive
import os import json import numpy as np import pandas as pd from tqdm import tqdm import requests from sklearn.model_selection import train_test_split import sklearn.preprocessing as preprocessing def download_file(url, loc="data_files", blocksize=1000000): if not os.path.exists(loc): os.makedirs(loc) ...
true
4515164008533b9bc6d6b49484b81c6fe8d6fad6
LewisPalaciosGonzales/t07_palacios_ruiz
/ruiz/rango02.py
UTF-8
121
3.390625
3
[]
no_license
# EJERCICIO 02 s = 0 for i in range (1000): if((i % 2)== 0): s = s + i #fin_if #fin_for print("Suma:",s)
true
4114a1f338b29a7ca9b642fc1de3901c3a8de90d
Greg-S-12/sentiment-analysis-of-recipe-reviews
/.ipynb_checkpoints/DataFunctions-checkpoint.py
UTF-8
5,111
2.875
3
[]
no_license
import pandas as pd import numpy as np import matplotlib.pyplot as plt from itertools import cycle from scipy import interp from sklearn import svm, datasets from sklearn.metrics import roc_curve, auc from sklearn.model_selection import train_test_split from sklearn.preprocessing import label_binarize from sklearn.prep...
true
2ed856c1995e94e3cca5d4f0ed8680995568a8aa
zhengquantao/SecondKill
/api/utils/rabbitmq_test/send1.py
UTF-8
394
2.96875
3
[]
no_license
""" hello world """ import pika # 建立连接对象 connection = pika.BlockingConnection( pika.ConnectionParameters(host="localhost") ) # 建立一个新通道 channel = connection.channel() # 要连接的队列 channel.queue_declare(queue="hello") # 发送数据 channel.basic_publish(exchange='', routing_key='hello', body="helloWorld") print("[x] Sent 'hello...
true
25e812082a409cb977297b4579c4d2f2df2374c2
gexinchen/PythonTools
/getGoogleInfo.py
UTF-8
1,633
3.046875
3
[]
no_license
#从谷歌地球kml文件中提取站点经纬度 #工具编写日期 2019.9.22 #作者:Star #第一版: 提取谷歌地球站点坐标经纬度 #第二版:更新提取规则 def getNum (kmlName): num = 0 with open(kmlName,'r') as f: for i in f: if '<Placemark>' in i: return (num) else: num += 1 def getGoogleInfo (kmlName,tabName): impo...
true
73af309e0a33f1a7942f573fefd3a93a4fb624c6
red-hat-storage/ocs-ci
/ocs_ci/templates/workloads/helper_scripts/fsync.py
UTF-8
271
2.75
3
[ "MIT" ]
permissive
import os def fsync(): while True: fd = os.open("/mnt/mydir/", os.O_DIRECTORY | os.O_RDONLY) print("type of fd: ", type(fd)) if fd < -1: raise Exception("create") os.fsync(fd) os.close(fd) return 9 fsync()
true
bfd0ac69f1dc6f1afc2d7431f47ed1a83165f25e
benraivel/EIT-DAQ-Code
/archive code dump/ContinuousAvg.py
UTF-8
5,484
2.6875
3
[]
no_license
''' - continuously acquire traces, averaging and displaying n traces - create tkinter window: - mostly Mathematica graphic(s) of avg'd data - number-of-runs-to-average ajustable - sample rate adjustable - use mathematica image() to create bitmap to transfer via client instead of saving - ImageData[Image...
true
98f0bb098e4fc5ec1becf0f9938c875a85b51b40
eugeniocarvalho/CursoEmVideoPython
/Python Exercicios/Mundo 2: Estruturas de Controle/3. Repetições em Python (while)/ex067.py
UTF-8
329
4.21875
4
[]
no_license
''' Faça um programa que mostre a tabuada de varios números, um de cada vez, para cada valor digitado pelo usuario. O programa sera interrmpido quando o numero solicitado for negativo ''' while True: n = int(input()) if n < 0: break for i in range(11): print(f'{n} x {i} = {i * n}') p...
true
83a8e7bb2804ea741b7325eee09385ec9f735bd9
abhisek08/Python-data-types-String-
/index of char.py
UTF-8
320
3.328125
3
[]
no_license
''' Write a Python program to print the index of the character in a string. Go to the editor Sample string: w3resource Expected output: Current character w position at 0 Current character 3 position at 1 Current character r position at 2 ''' string='w3resource' print('Current character w position at',string.index('w'))
true
55b372c162fd211ee8ab46635905d56f1ebae0c2
CalebRollins1/1433_final_project
/wikipedia_scraper.py
UTF-8
3,727
3.0625
3
[]
no_license
from bs4 import BeautifulSoup import pandas as pd import requests from selenium import webdriver from webdriver_manager.chrome import ChromeDriverManager from selenium.webdriver.common.by import By import numpy as np import re cities = pd.read_csv("uscities.csv") #get 500 largest cities city_list = list(zip(list(citie...
true
ac2b0b7b6219079a692a7dd8e46a2a10f01bc454
offurface/vthp
/vthp/apps/main/predict.py
UTF-8
1,740
2.96875
3
[]
no_license
import pandas as pd def get_excel(file): df = pd.read_excel(file) index = df.index columns = df.columns omiss = df[ columns[-1] ] ftrs = [] for i in range( len(index) ): ftrs.append( list( df.iloc[i, 1:( len(columns) - 1 )] ) ) return ftrs, omiss def match(predicted, omiss_p): ...
true
4ad2c09da7bdeac09d7099fb9f94af62fe73cec1
martinpovolny/audrey
/agent/src/audrey/user_data.py
UTF-8
6,505
2.5625
3
[ "Apache-2.0" ]
permissive
''' * * Copyright [2011] [Red Hat, Inc.] * * 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 applicable law or ag...
true
da68edcb670f4cbfd8359677a062c804fe8d7bcd
jvbustelo/time_series_grpc_server
/tests/test_data_points_creator.py
UTF-8
759
2.65625
3
[]
no_license
from server_app.data_points_creator import DataPointsCreator from server_app.generated.time_series_pb2 import TimeSeriesReply from server_app.models import MeterReading def test_data_points_creator(): meter_reading = MeterReading() meter_reading.time = '0000-00-00 00:00:00' meter_reading.meterusage = 1.0 ...
true
fb12db74d1dc537bb909a0ef587198b44fdc4534
gradyk/DEV_RtoX
/Contents/Utilities/languages_to_dict.py
UTF-8
778
2.828125
3
[]
no_license
import csv import json import os import sys def languages_to_dict(): base_script_dir = os.path.dirname(os.path.abspath(sys.argv[0])) language_source = os.path.join(base_script_dir, "languages.csv") language_dict = os.path.join(base_script_dir, "language_dict.json") lang_new = {} with open(language...
true
488954a9be698489559bb2de9b8c0788c565f168
radudilirici/FMI
/Year 2/Sem 1/TAP/lab4_nr_minim_cuv_01/main.py
UTF-8
652
2.75
3
[]
no_license
with open("date.in", "r") as fin: d = {} n = int(next(fin)) for i in range(n): d[next(fin).split()[0]] = 1 with open("cod.in", "r") as fin: S = next(fin).split()[0] n = len(S) D = [0] * (n + 1) D[n - 1] = 1 urm = [-1] * (n + 1) urm[n - 1] = n for i in range(n - 2, -1, -1): mn ...
true
da245e319718d72b38ad5ff69ef527bc0de4dab8
basheGG/CSLD
/Projects_csld/api/product_csld.py
UTF-8
1,892
2.53125
3
[]
no_license
import tornado.web import tornado.ioloop import json from models.product_model import ProductModel class ProductApi(tornado.web.RequestHandler): def get(self): datas = self.request.body data_dict = json.loads(datas) critern = set() if "productnames" in data_dict: crite...
true
6aaf99911ee707027b5e48dc286bbd8b9208ec5e
AlexHoa/LearningPython_functions
/dict_inverse_unittest.py
UTF-8
861
3.953125
4
[]
no_license
#!usr/local/bin/python3.6 ''' write a python function that assumes a dict as argument. Create a dict where the values are the keys. In case of multiple values, make a list of the keys that had the value. Return the dictionnary''' import unittest def dict_inverse(d): newDict = {} for key,value in d.items(): newDic...
true
b6fc59488e00d11e154e42bdb7fa19bffa8a9fd3
khancyr/sphinxcontrib.vimeo
/sphinxcontrib/vimeo/vimeo.py
UTF-8
1,297
2.609375
3
[]
no_license
#-*- coding:utf-8 -*- import re from docutils import nodes from docutils.parsers import rst class vimeo(nodes.General, nodes.Element): pass def visit(self, node): video_id = node.video_id height = node.height width = node.width tag = ( '<iframe src="https://player.vimeo.com/video/{vi...
true
642e8571348550eaf8ef4df25b2f662f21e0eecf
rscai/java-collections
/curriculum/02.List/ArrayList.plot.py
UTF-8
381
2.953125
3
[]
no_license
# -*- coding: utf-8 -*- import matplotlib.pyplot as plt import numpy as np def plotBenchmark(x,y,title): plt.plot(x,y) plt.xlabel("(n)") plt.ylabel("ops/s") plt.title(title) return plt seq = [10000,100000,1000000,10000000] add_scores = [133096.896,93916.433,15222.869,543.267] add_plot = plotBench...
true
fbf919705b9f6cb7cc50a570ff7e699390ade88a
alu0100828955/prct04
/src/ej24.py
UTF-8
573
3.625
4
[]
no_license
#! /usr/bin/python #! encoding: UTF-8 from math import sqrt a= float(raw_input("Valor de a: ")) b= float(raw_input("Valor de b: ")) c= float(raw_input("Valor de c: ")) if a != 0: x1 = (-b + sqrt(b**2 - 4*a*c)) / (2 * a) x2 = (-b - sqrt(b**2 - 4*a*c)) / (2 * a) print "Las soluciones de las ecuaciones son: x1=%4.3...
true
334d4191049b6c8533e016c386e1e064053ee18e
Wangzheyu978/retail
/appendix/code/Task_4/Task_4_1.py
ISO-8859-7
993
2.515625
3
[]
no_license
# coding=gbk import pandas as pd import matplotlib.pyplot as plt import csv import numpy as np from pyecharts import Geo ,Map df=pd.read_csv('C:/Users/csh/Desktop/douban/aaa.csv',encoding='utf-8') arr = df['location'] key = np.unique(arr) result =[] result1=[] data=[] for k in key: if '\u4e00' <= k <= ...
true
e6992a4f095da4925ea04f0aabb4c567a6d8f31f
bereRadeck/nia_final_project
/Evaluator.py
UTF-8
1,547
3.34375
3
[]
no_license
import numpy as np from copy import deepcopy import logging import sys logging.basicConfig(stream=sys.stdout, level=logging.INFO) LOG = logging.getLogger(__name__) class Evaluator: def evaluate(self, pop, task): """ evaluates each individual of a population and return the population with updated...
true
82b9aed368519149e5a94ee3c2af49bb2f7e0edb
HandH1998/easy-scrape
/3-2-download.py
UTF-8
1,125
3
3
[]
no_license
from urllib.request import urlretrieve import os import requests # 前2种方法都是把文件整个先下载到内存,然后写到本地磁盘 # 第3中流式下载可以一边下一边存 # 使用urlretrieve下载 # makedirs可以创建多重目录 # exist_ok:是否在目录存在时触发异常。如果exist_ok为False(默认值),则在目标目录已存在的情况下触发FileExistsError异常; # 如果exist_ok为True,则在目标目录已存在的情况下不会触发FileExistsError异常。 os.makedirs('./img',exist_ok=True...
true
530ae2dc347efab327efd27482c31eae842a74cd
ArturMkrt/advanced_python-
/Lesson 1/factorial.py
UTF-8
213
3.9375
4
[]
no_license
def factorial(n): factorial = 1 while n > 1: factorial *= n n -= 1 print(factorial(5)) def factorial(n): if n == 0: return 1 return factorial(n - 1) * n print(factorial(5))
true
5836bf927cfec761ee39ba042c8328b4c123b723
shx2/merethread
/tests/base.py
UTF-8
5,351
2.625
3
[ "MIT" ]
permissive
""" Common unit-tests definitions for the various test in this package. """ import time import unittest from concurrent.futures import CancelledError from merethread import ThreadStatus ################################################################################ class BaseThreadTest(unittest.TestCase): S...
true
7264d3a5d6eac40d7da3fdba52b6c46779148422
zenoss/zenoss-prodbin
/bin/buildEnterpriseOids.py
UTF-8
3,297
2.546875
3
[]
no_license
#!/usr/bin/env python ############################################################################## # # Copyright (C) Zenoss, Inc. 2007, all rights reserved. # # This content is made available according to terms specified in # License.zenoss under the directory where your Zenoss product is installed. # ############...
true
652f598139996cbb33f87fedc15363aba5bfc9e6
HiggsBugson/ED-RoutePlanner-Boilerplate
/manual.py
UTF-8
4,359
2.53125
3
[]
no_license
import os import networkx as nx #USES NVIDIA NUMBA CUDA JIT COMPILER FOR NUMERIC CALCULATIONS from numba import jit from pandas import read_csv from scipy.spatial import distance from shortpath import (array_to_graph, extract_path_info) import itertools from itertools import islice import math import _pickle as cPick...
true
71fb0f2acebfc868583566bc92d45b3f6e31cfd0
henrymwestfall/course-scheduler
/classes/individual.py
UTF-8
3,434
2.90625
3
[]
no_license
from __future__ import annotations from typing import TYPE_CHECKING, List from pulp import LpVariable, LpAffineExpression, value from .schedule import Schedule from .course import CourseType, Section from utils import summation if TYPE_CHECKING: from .course import Course # Base class Individual and inheriting cla...
true
278c25747787a08c7741fa4242cd20153f8dba4b
YinanWangAI/genome_editing
/score_sgrna/scc_gr2015.py
UTF-8
2,155
2.765625
3
[]
no_license
"""Compute SCC score from GR2015""" import os import pandas as pd import subprocess import tempfile def compute_scc(seqs, scc_path='/Users/yinan/PycharmProjects/genome_editing/score_sgrna/SSC0.1/bin/SSC', mat_path='/Users/yinan/PycharmProjects/genome_editing/score_sgrna/SSC0.1/matrix/...
true
2b2eef2014f9550c9fe579e172843cb1fe57e108
taalua/x-vector-pytorch
/make_dataset.py
UTF-8
2,185
2.921875
3
[ "MIT" ]
permissive
import os import glob class_ids = {'et': 0, 'ru': 1, 'fi': 2} def create_meta(files_list, store_loc, mode='train'): if not os.path.exists(store_loc): os.makedirs(store_loc) if mode == 'train': meta_store = store_loc + '/training.txt' fid = open(meta_store, 'w') for filepath i...
true
caf83ced1a9b12aa981cbca8dc5eec88bc52b35a
phaustin/a448hub
/notebooks/parse_toc.py
UTF-8
864
3.09375
3
[ "BSD-3-Clause" ]
permissive
import yaml from pathlib import Path def dict_generator(indict, pre=None): pre = pre[:] if pre else [] if isinstance(indict, dict): for key, value in indict.items(): if isinstance(value, dict): for d in dict_generator(value, pre + [key]): yield d ...
true
1105895e8740f91b69d809678a4ea51c65ed815b
lajbaker/COM404
/2-GUIs/4-images/1-loading/gui.py
UTF-8
3,165
3
3
[]
no_license
from tkinter import * from tkinter import messagebox class Gui(Tk): def __init__(self): super().__init__() # set window attributes self.title("Gui") self.ambo_image = PhotoImage(file="//pclures01/home/4bakel36/Documents/Problem Solving Through Programming/Week 7/COM404/2-GUIs/...
true
f9ca14ea46f1faa380dec4da070f1ad88785c305
747-diego/holbertonschool-interview
/0x06-log_parsing/0-stats.py
UTF-8
1,140
3.328125
3
[]
no_license
#!/usr/bin/python3 """0. Log parsing.""" import sys """Write a script that reads stdin line by line and computes metrics.""" if __name__ == "__main__": status = {"200": 0, "301": 0, "400": 0, "401": 0, "403": 0, "404": 0, "405": 0, "500": 0} FileSize = 0 counter = 1 def getLog(line): ...
true
4b366a6f3f8b4458044627357ffb442f0c147e6a
kammitama5/Distracting_KATAS
/hex_to_decimal.py
UTF-8
63
2.6875
3
[]
no_license
def hex_to_dec(s): dec = int(s, 16) return dec
true
bfbef7571fe4b4f61fc57f61cb9a066b84724dd9
TonyPythoneer/data-structures-and-algorithms-in-python
/ch01-python-primer/reinforcement/r7_cmd_sum_odds.py
UTF-8
700
3.796875
4
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # @first_date 20160801 # @date 20160801 '''R-1.7 Give a single command that computes the sum from Exercise R-1.6, relying on Python’s comprehension syntax and the built-in sum function ''' from sys import argv from r6_sum_odds import func_with_sum as func def inp...
true
27c1dea728baf032108b3b2b04bae5a87a37665b
Virginia-Fan/socs
/agents/pfeiffer_tpg366/pfeiffer_tpg366_agent.py
UTF-8
5,753
2.53125
3
[ "BSD-2-Clause" ]
permissive
# Script to log and readout pfeiffer TPG 366 gauge contoller # via Ethernet connection # Zhilei Xu, Tanay Bhandarkar import socket import numpy as np from ocs import ocs_agent, site_config from ocs.ocs_twisted import TimeoutLock import time BUFF_SIZE = 128 ENQ = '\x05' class Pfeiffer: """CLASS to control and re...
true
978b74a1a869a01a7bd1226af73d3656b0ee12f8
rl-23/sorting-algorithms
/code-examples/insertionsortexample.py
UTF-8
265
3.671875
4
[]
no_license
import random a = [] for i in range(0,10): randnum = random.randint(1,50) a.append(randnum) print(a) for i in range(1, len(a)): tosort = a[i] while a[i-1] > tosort and i > 0: a[i],a[i-1] = a[i-1], a[i] i = i-1 print('Sorted Array:') print(a)
true
d946a4c8e9f1bd7f0e3cc7a6818ce708b3f829fc
may2991/HW_python1
/lesson4_5.py
UTF-8
649
3.671875
4
[]
no_license
# Реализовать формирование списка, используя функцию range() и возможности генератора. # В список должны войти четные числа от 100 до 1000 (включая границы). # Необходимо получить результат вычисления произведения всех элементов списка. # Подсказка: использовать функцию reduce(). from functools import reduce ...
true
cf9fcbcad23d70ed863af3f74cbfac22543b5671
Vaspe/Coursera_Python_3_Programming_Michigan
/Python_Basics_Mod1/Mutability_ch9.py
UTF-8
4,943
4.1875
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu Apr 2 22:32:44 2020 @author: Vasilis """ #%% Theory # List are mutable we can add, remove or reassign elements # Strings and tuples are immutable we can only reassign or create a new variable to change them #%% Basics # replacing elements alist = ['a', 'b', 'c', 'd', 'e',...
true
c482d6504713f448811ba639cb56cea9dbb82ee5
KatanaGraph/katana
/python/katana/__init__.py
UTF-8
3,624
2.703125
3
[ "BSD-3-Clause", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
""" Galois Python is a Python library designed to simplify parallel programming. It is especially focused on computations that are difficult to parallelize efficiently, such as loops with * irregular amount of work per iteration * irregular memory accesses and branching patterns * dependencies between iterations * dyn...
true