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 |
|---|---|---|---|---|---|---|---|---|---|---|
75c06b5ec8b83fc5a5b1817eddbb357a9167cc1b | GabrielEValenzuela/CursoIntensivoPython | /Segunda clase/Código fuente/if_elif_else.py | UTF-8 | 332 | 3.421875 | 3 | [
"MIT"
] | permissive | temperatura = 10
if (temperatura > 30): #Las sentencias if SIEMPRE terminan con :
print("Que calor que hace en el balc\u00F3n de Paul \U0001F3B5")
elif (temperatura > 20): #elif DEBE evaluar una condición
print("Coffee time !")
else: #De nuevo, SIEMPRE terminar con :
print("Libre soy, libre soy \U0001F3B5 \... | true |
8c50c04a57a7bb8fb7d5264925b554bffe8b8d29 | LostKe/python-study | /demo/Demo25.py | UTF-8 | 590 | 3.453125 | 3 | [] | no_license | # coding=utf-8
'''
python: json 转换
'''
import json
d = dict(name='zsq', age=20, adress='sz futian')
val = json.dumps(d)
print(val)
print("==========================")
class Student(object):
def __init__(self, name, age, address, score):
self.name = name
self.age = age
self.addres... | true |
62d730f633a665a4e55ea23d8359def6eb14a82d | mplitnikas/tdd_py | /functional_tests.py | UTF-8 | 2,037 | 3.296875 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import unittest
class NewVisitorTest(unittest.TestCase):
def setUp(self):
self.browser = webdriver.Firefox()
self.browser.implicitly_wait(3)
def tearDown(self):
self.browser.quit()
def check_for_row_in_list_table(self, row_text)... | true |
0d8cd937dd49a53eaba05e460e6c68250ea54802 | bilakhiyaasif/Algorithms | /HackerEarth Algo Problem/Basics of InputOutput/7-Toggle String/TestClass.py | UTF-8 | 1,664 | 2.984375 | 3 | [] | no_license | #include<stdio.h>
#include<string.h>
int main()
{
String data=sc.nextLine();
char data[100];
gets(data);
// System.out.println(data);
// String out="";
char out[100];
//String temp="";
char temp[]=out;
for(int i=0;i<strlen(data);i++)
{
if... | true |
1d207dd96c2776d38cfd7b1b7149ad13fb3427b6 | vicamo/python-gerritclient | /gerritclient/common/utils.py | UTF-8 | 4,629 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | #
# Copyright 2017 Vitalii Kulanov
#
# 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 ... | true |
2e7e6e84cf6b65bba27c4c933741ed2673342fd9 | Armenak87/login_reg | /apps/first_app/models.py | UTF-8 | 2,307 | 2.71875 | 3 | [] | no_license | from __future__ import unicode_literals
from django.db import models
import re
import bcrypt
EMAIL_REGEX = re.compile(r'^[a-zA-Z0-9\.\+_-]+@[a-zA-Z0-9\._-]+\.[a-zA-Z]*$')
# Create your models here.
class UserManager(models.Manager):
def validator(self, postData):
errors = []
if len(postData['firs... | true |
a80d7f19935ce5ad459cfd9d1cce37bd694010f7 | rackerlabs/openstack-usage-report | /usage/licensing/windows.py | UTF-8 | 5,916 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive | from common import CountLicenser as BaseCountLicenser
from common import HourLicenser as BaseHourLicenser
from common import INDENTSIZE
from common import MAXLINESIZE
from usage.log import logging
logger = logging.getLogger('usage.licensing.windows')
_DISTRO_KEY = 'image:OS Distro'
_VERSION_KEY = 'image:OS Version'
_... | true |
9d3f585ea4107557013662d05205e5d69c6de156 | JavierIH/maus | /code/python/control/octosnake/octosnake.py | UTF-8 | 1,219 | 3.265625 | 3 | [] | no_license | import time
import math
from scipy import signal
class Oscillator(object):
def __init__(self, signal=math.sin, period=2000, amplitude=50, phase=0, offset=0):
self.period = period
self.amplitude = amplitude
self.phase = phase
self.offset = offset
self.stop = False
self.ref_time = time.time()*1000
self.... | true |
01067fe1e73431b4857f4346bca5dd5501e44dc5 | WheatZhang/ThermoFitting | /binary/bicubic_composition.py | UTF-8 | 7,100 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python
#-*- coding:utf-8 -*-
import pandas
import numpy as np
import matplotlib.pyplot as plt
thermo_data = pandas.read_csv("data/thin_data.txt", sep=',', header = None)
for i in range(21):
for j in range(21):
thermo_data.iloc[i*21+j,1] = j
thermo_mean = thermo_data.mean()
thermo_max = therm... | true |
c099779cc05d022f8a616417a3c2bb28dbf82f43 | leelasd/torch-dftd | /torch_dftd/functions/edge_extraction.py | UTF-8 | 2,072 | 2.671875 | 3 | [
"MIT"
] | permissive | from typing import Optional, Tuple
import numpy as np
import torch
from ase.neighborlist import primitive_neighbor_list
from ase.units import Bohr
from torch import Tensor
def calc_edge_index(
pos: Tensor,
cell: Optional[Tensor] = None,
pbc: Optional[Tensor] = None,
cutoff: float = 95.0 * Bohr,
b... | true |
df9bd0ba2be55c326d1aa5c09ec7cdfaed07f0f7 | amzyang/mycli | /test/test_config.py | UTF-8 | 5,922 | 2.59375 | 3 | [
"MIT",
"BSD-3-Clause"
] | permissive | """Unit tests for the mycli.config module."""
from io import BytesIO, StringIO, TextIOWrapper
import os
import struct
import sys
import tempfile
import pytest
from mycli.config import (get_mylogin_cnf_path, open_mylogin_cnf,
read_and_decrypt_mylogin_cnf, read_config_file,
... | true |
b6a22eb18cdaef304166b4f486a199902b678f60 | architek/yggscr | /src/yggscr/stats.py | UTF-8 | 1,615 | 3.25 | 3 | [
"ISC"
] | permissive | # -*- coding: utf-8 -*-
import time
class Stats():
def __init__(self):
self.first = {"time": None,
"up": None, "down": None}
self.last = {"time": None,
"up": None, "down": None}
def upd_speed(self):
GiB = 1024*1024
ctime = time.time(... | true |
5ad57e5a27f57a1e6cb718dab154f7cc8bd03b59 | MuhammedMusharaf007/Python-Estimation-Webapp | /estimators.py | UTF-8 | 347 | 2.859375 | 3 | [] | no_license | import random
def estimate_mc(iters=10000):
inside = 0.0
for _ in range(iters):
x=random.random()
y=random.random()
if (x**2 + y**2) <=1:
inside += 1
estimate = 4*(inside/iters)
return estimate
def estimate_wallis(iters=10000):
acc = 1.0
for n in range(1, iters+1):
acc = acc* (4*(n**2))/(4*(n**2)-1... | true |
d72a66f2484c6847a3b5d79b3aa7bbae83a9a2ba | AloneGu/web_crawler | /topit_web_crawler.py | UTF-8 | 1,224 | 2.703125 | 3 | [] | no_license | #@PydevCodeAnalysisIgnore
#Auto download first n=10 pages thumbnails of topit.me, do not use this program maliciously
import urllib
import re,os
from urllib import urlretrieve
def get_href_list(urlStr):
hrefCmp = re.compile("""[src|date-original]="(http://[f|i][\w|\d]\d*.to.*?jpg)\"""") #ok
return hrefCmp.find... | true |
e5afad2bcd2982cbbf328b2eb131b40c7ca80813 | daphnejwang/skills2 | /skills2.py | UTF-8 | 3,097 | 3.6875 | 4 | [] | no_license | string1 = "I do not like green eggs and ham."
list1 = [2, 5, 12, 6, 1, -5, 8, 5, 6, -2, 2, 27]
list2 = [-5, 6, 4, 8, 15, 16, 23, 42, 2, 7]
words = ["I", "do", "not", "like", "green", "eggs", "and", "ham", "I", "do", "not", "like", "them", "San", "I", "am"]
"""
Write a function that takes a string and produces a dictio... | true |
14807862ec5d2b2719799138339b08e250d06049 | vodena/BlackFoxPython | /blackfox/log_writer.py | UTF-8 | 2,583 | 2.65625 | 3 | [] | no_license | from datetime import datetime
import sys
class LogWriter(object):
"""LogWriter provides logging capabilities for an ongoing Black Fox optimization.
Parameters
----------
file : str
Optional file or sys.stdout used for logging
"""
def __init__(self, file=sys.stdout):
self.log_... | true |
a9d9f110cf28753bf9bdbacebaacf6324623fd62 | zipinel/Selenium_and_BeautifulSoup | /Locators/webDriverSetup.py | UTF-8 | 1,255 | 2.671875 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
import os
def seleniumAction(source):
print("Phase 1: Selenium scroll down started (estimated a minimum of 10 seconds)")
cwd = os.getcwd()
pathToChromeDriver = os.path.join(cwd, "Drivers\\chromedriver.exe")... | true |
fe30212a087b29873f891bb0b3fd28204e9aa8e0 | yifan-hou/contact_modes | /python/src/contact_modes/viewer/orthonormal.py | UTF-8 | 1,526 | 3.171875 | 3 | [] | no_license | import glm
import math
import numpy as np
class OrthoCamera(object):
def __init__(self, aspect_ratio=800./600.):
self.aspect_ratio = aspect_ratio
self.height = 2.0
self.center = np.array([0.0, 0.0])
self.last_x = 0.0
self.last_y = 0.0
def resize(self):
pass
... | true |
a862c3f8db4ba8309527fff8c33d8bf21c7049af | zanjaprogrammer/dnd-sekolah-atau-tidur | /main.py | UTF-8 | 3,614 | 3.1875 | 3 | [] | no_license | judul = 'Game DnD: Sekolah atau Tidur?'
author = 'Programmer Kahfi & Eko'
tanggal = 'Juni 2018'
print(judul)
print(author)
print(tanggal)
tokoh = input('Namamu? ')
tokoh = tokoh.capitalize()
nilai = 0
print('Ketik help untuk mendapatkan bantuan')
print('--' * 20)
running = True
while running:
print('Seorang anak... | true |
879018f398dbb1de9a00998ceecf7ade0771ee89 | complynx/pilot-2.0 | /lib/minipilot/job.py | UTF-8 | 17,151 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | import urllib
import os
import json
import shlex
import pipes
import logging
import copy
from utility import Utility, touch
# TODO: Switch from external Rucio calls to internal ones. (Should consult with Mario)
# Before: fix platform dependencies in Rucio
# TODO: Rework queuedata overriding. Current version is a comp... | true |
d5291279ba0fc1c8caf10090f58078269545c645 | giwa/taskserver | /workers/text_filter.py | UTF-8 | 2,321 | 3 | 3 | [] | no_license | #! encoding=utf-8
import re
import codecs
import sys
import os
if sys.version_info >= (3, 0):
unicode = str
def is_japanese(text):
"""
Return True if text is Japanese
>>> is_japanese(u"daf")
False
"""
m = re.match(u'[ぁ-んァ-ヴ一-龠]', text)
if m:
return True
else:
ret... | true |
0ae22a34bf8c1232e6ca600545156d2ab154a952 | xiaoruijiang/algorithm | /trie.py | UTF-8 | 3,215 | 3.78125 | 4 | [] | no_license | __author__ = 'yangbin1729'
class TrieByDict:
"""
用嵌套词典模拟字典树的树状结构
- 实现插入、搜索、及自动补全功能
>>> {'bad', 'bar'}
{'b':
{'a':
{'d': {'#': '#'},
'r': {'#': '#'}}}}
"""
def __init__(self):
self.lookup = {}
self.end_flag = '#'
def insert... | true |
d505076d7fcc8fbabf8f14ae5a28da3b3c1ddbc3 | wmillar/ProjectEuler | /044.py | UTF-8 | 1,997 | 3.921875 | 4 | [] | no_license | '''
Pentagonal numbers are generated by the formula, P_n = n*(3*n-1)/2.
The first ten pentagonal numbers are:
1, 5, 12, 22, 35, 51, 70, 92, 117, 145, ...
It can be seen that P_4 + P_7 = 22 + 70 = 92 = P_8.
However, their difference, 70 - 22 = 48, is not pentagonal.
Find the pair of pentagonal numbers, P_j and P_... | true |
b1459aadee699c5676a3c4d7b974d889ed541590 | mlisicki/MuyGPyS | /MuyGPyS/optimize/objective.py | UTF-8 | 5,535 | 2.984375 | 3 | [
"MIT",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | # Copyright 2021 Lawrence Livermore National Security, LLC and other MuyGPyS
# Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: MIT
"""Objective and Loss Function Handling
MuyGPyS includes predefined loss functions and convenience functions for
indicating them to optimiz... | true |
5eeacc577ec2080b48fbca04f0abda8aaf3435e1 | ryanvilbrandt/personal | /aobrd_customer_check.py | UTF-8 | 904 | 2.75 | 3 | [] | no_license | import csv
import os
import re
from collections import defaultdict
from glob import glob
def dict_readers(wildcard_path, reverse_csv=False):
for path in glob(wildcard_path):
print(path)
with open(path, "r") as f:
reader = csv.DictReader(f)
if reverse_csv:
re... | true |
a1d422d4af56c8e29c1e15fb0d167de065aa1d02 | gkalidas/python-django-bundle | /dict_ex.py | UTF-8 | 247 | 3.71875 | 4 | [] | no_license | test = {'name': 'Ganesh', 'age': 24}
print(test)
# adding element to the dictionary
test['speed'] = 80
print(test)
# deleting element from the list
del test['age']
print(test)
# overriding elements in dictionary
test['speed'] = 90
print(test)
| true |
59c174cb321cddda4071031ec1edca3a395563ab | Talmage94/blackjack | /blackjack.py | UTF-8 | 8,924 | 3.78125 | 4 | [] | no_license | import random
suits = ['Spades', 'Hearts', 'Diamonds', 'Clubs']
ranks = ['Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten', 'Jack', 'Queen', 'King', 'Ace']
key = {'Two':2, 'Three':3, 'Four':4, 'Five':5, 'Six':6, 'Seven':7, 'Eight':8, 'Nine':9, 'Ten':10, 'Jack':10, 'Queen':10, 'King':10, 'Ace':11}... | true |
1c2a34ecd7d512165bfaf44084b8f7051700df6b | Aldammers/Programmeerproject | /Code/python/Military2json.py | UTF-8 | 442 | 3.203125 | 3 | [] | no_license | import csv
import json
# open files and create empty file
csvfile = open('military.csv', 'r')
jsonfile = open('data/military.json', 'w')
data = []
fieldnames = ("Country", "2008", "2009", "2010", "2011", "2012", "2013", "2014", "2015", "2016")
# read csv
reader = csv.DictReader(csvfile, fieldnames)
# get data array... | true |
691b53db11f74ffbe4d56903aaafd216571400ac | ruizewang/SimpleCF | /Code/UserCF_main.py | UTF-8 | 1,655 | 2.625 | 3 | [] | no_license | """
Created on Jan 25, 2021
A simple start of UserCF
@author: Gengziyao(zggzy1996@163.com)
"""
import os
import pickle
from time import time
from UserCF import *
from evaluate import *
from utils import *
def main():
# ========================= Hyper Parameters =======================
file = '../dataset/ml... | true |
456fefaa6f7c8dc40037390bbd465307db90baad | anu-bioinfo/rosalind-4 | /ini2.py | UTF-8 | 273 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python
from __future__ import print_function
import os
if __name__ == "__main__":
with open(os.path.join('data', 'rosalind_ini2.txt')) as dataset:
a, b = [int(r) for r in dataset.readline().rstrip().split()]
print((a ** 2) + (b ** 2))
| true |
e8e29f47834fbddfc75b8f245477c15656d9d6c8 | saltstack/salt | /tests/pytests/unit/utils/test_win_runas.py | UTF-8 | 713 | 2.84375 | 3 | [
"Apache-2.0",
"MIT",
"BSD-2-Clause"
] | permissive | import pytest
from salt.utils import win_runas
@pytest.mark.parametrize(
"input_value, expected",
[
("test_user", ("test_user", ".")), # Simple system name
("domain\\test_user", ("test_user", "domain")), # Sam name
("domain.com\\test_user", ("test_user", "domain.com")), # Sam name ... | true |
f7e426d7b3813a2fcde7126e2031ff7e661c5441 | Hong-Xiang/dxfunction | /src/python/dxl/function/control.py | UTF-8 | 641 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | from typing import Callable
from functools import singledispatch
from dxl.data import Functor
FunctorB = Union[List, Tuple, Dict, Functor[a]]
def fmap(f: Callable, fct: FunctorB) -> FunctorB:
return _fmap(fct, f)
@singledispatch
def _fmap(fct, f):
raise TypeError(
f"Can't {type(f)} is not Functor o... | true |
00a469d1a4f86f48e9fa6de493493840fe97a294 | Fbabsail/Learning-Python | /19.py | UTF-8 | 126 | 3.296875 | 3 | [] | no_license | numbers = [1, 1, 1, 1, 6]
for x_count in numbers:
f =''
for x_count in range(x_count):
f += "x"
print(f)
| true |
e56dff2922a841e1c0cd7a2ebcf2ec164f146118 | Sushmita-08june/cat | /str_continued.py | UTF-8 | 234 | 3.6875 | 4 | [] | no_license | """str = 'cold'
# enumerate()
list_enumerate = list(enumerate(str))
print('list(enumerate(str) = ', list_enumerate)
#character count
print('len(str) = ', len(str))
"""
a = 'Python world!!'
a.replace("!!" , "$")
print(a)
| true |
17c21f3625f0674ffd6d906586870e1a8004c49d | skyyi1126/leetcode | /525.contiguous-array.py | UTF-8 | 590 | 2.796875 | 3 | [] | no_license | #
# @lc app=leetcode id=525 lang=python3
#
# [525] Contiguous Array
#
# @lc code=start
class Solution:
def findMaxLength(self, nums: List[int]) -> int:
if not nums:
return 0
diff2index = {0:-1}
diff = 0
max_len = 0
for i, num in enumerate(nums):
if n... | true |
5c9049c879f11f5f30dd8e4f2d75370da9c9c485 | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_95/1595.py | UTF-8 | 535 | 2.59375 | 3 | [] | no_license | sample="ejp mysljylc kd kxveddknmc re jsicpdrysi rbcpc ypc rtcsra dkh wyfrepkym veddknkmkrkcd de kr kd eoya kw aej tysr re ujdr lkgc jv"
samp_ans = "our language is impossible to understand there are twenty six factorial possibilities so it is okay if you want to just give up"
dict = {}
dict['q'] = 'z'
dict['z'] = 'q'
... | true |
42846d6de2508d57d3b9a6f6012d26915249167a | zsz00/single-shot-detector | /src/anchor_generator.py | UTF-8 | 7,293 | 2.875 | 3 | [
"MIT"
] | permissive | import tensorflow as tf
import math
class AnchorGenerator:
def __init__(self, scales=None, min_scale=0.2, max_scale=0.9,
aspect_ratios=(1.0, 2.0, 3.0, 0.5, 0.333),
interpolated_scale_aspect_ratio=1.0,
reduce_boxes_in_lowest_layer=True):
"""Creates SSD anc... | true |
c3aaf942cb58cd6fce092dc0fb1be010ca9ee57f | Kamal28/learning | /functions_returns.py | UTF-8 | 192 | 3.265625 | 3 | [] | no_license | def calculate_numbers(number, number2):
calculations = number + number2
return calculations
calculation_2 = calculate_numbers(23, 23)
number3 = 1000
print(calculation_2 + number3)
| true |
eff937c809c9fbee881b24cfa4c522ba58181e64 | leonl42/MLinPractice | /scripts/feature_extraction/feature_timedeltas.py | UTF-8 | 915 | 2.921875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Oct 24 21:34:55 2021
@author: leonl42
Feature extracting for converting the already calculated timedeltas into a feature
"""
import numpy as np
from scripts.feature_extraction.feature_extractor import FeatureExtractor
from ast import literal_eval
cl... | true |
19c90667b0d80cf579af23aabce63456fca5a7ba | junaidali/flashcards | /webapp/flashcards/models.py | UTF-8 | 1,001 | 2.515625 | 3 | [
"MIT"
] | permissive | from django.db import models
# Create your models here.
class Category(models.Model):
name_primary = models.CharField(max_length=512)
name_secondary = models.CharField(max_length=512)
description_primary = models.TextField(max_length=1024, blank=True)
description_secondary = models.TextField(max_length... | true |
8056c907c6cce3d8a7c9d5c495503b0548f43b9d | traveling-soul/python | /design_pattern/create_pattern/abstract_factory_v3.py | UTF-8 | 2,649 | 3.234375 | 3 | [] | no_license | class User:
_id = 0
_name = ''
def set_id(self, id):
self._id = id
def get_id(self):
return self._id
def set_name(self, name):
self._name = name
def get_name(self):
return self._name
class IUser:
def insert(self, user):
pass
... | true |
8355b97b38920be912d74bee03986ea26eb1fa6c | Chesterrific/Unit-Testing | /Genera Unit Testing Examples/hw1.py | UTF-8 | 1,276 | 3.40625 | 3 | [] | no_license | # A couple Blackjack-related functions -- hw1 updated to provide exceptions
# for some error cases
# card value element constants
ACE = 1
MAX_NUM_CARD = 10
JACK = 11
QUEEN = 12
KING = 13
# score-related constants
ALT_ACE_VALUE = 11
FACE_CARD_VALUE = 10
BLACKJACK = 21
# hand-related constants
CARDS_PER_HAND = 2
clas... | true |
d1af20d9d6b5cab02f3987215a009f7c6cfb9b00 | summu2000/Codeforces | /George-and-Accommodation.py | UTF-8 | 157 | 2.828125 | 3 | [] | no_license | a=int(raw_input())
j=0
for i in range(a):
b=raw_input()
c=[]
c=b.split(' ')
d=[]
d=map(int, c)
if (d[1]-d[0])>1:
j+=1
print j | true |
b9c70712f548c9258c8990ac9391a395e801f82a | AlexWufan/leetcode-python | /127. Word Ladder.py | UTF-8 | 1,778 | 3.359375 | 3 | [] | no_license | class Solution(object):
def ladderLength(self, beginWord, endWord, wordList):
"""
:type beginWord: str
:type endWord: str
:type wordList: List[str]
:rtype: int
"""
dq = collections.deque()
visited = {word:False for word in wordList}
dq.append((... | true |
9f01c432f8115adff3f4a9a3c375325249bf1741 | lascardua/applied_EA_book | /assessment_performance_GAc_noiseless.py | UTF-8 | 2,425 | 2.96875 | 3 | [] | no_license | # --------------------------------------------------------------
# Performance assessment on the minimization of a noiseless
# function. The samples are assumed to be Gaussian with unknown
# variance.
# --------------------------------------------------------------
# file: assessment_performance_GAc_noiseless.py
... | true |
a01f0ffc89e4008d2f7174a457929c190b04edbf | Beksultan25/Analog-clock-using-python | /analog clock.py | UTF-8 | 1,354 | 3.09375 | 3 | [] | no_license |
import pygame as p
from datetime import *
from math import *
p.init()
black=(0,0,0)
white=(255,255,255)
red=(255,0,0)
green=(0,150,0)
scn=p.display.set_mode([400,400])
clock=p.time.Clock()
p.display.set_caption('analog clock')
clockexit=False
img=p.image.load('clock.jpeg')
click_sound=p.m... | true |
945f1b671b14e455dca305937bce256e314defef | GRIFFINCollaboration/beamCompanionExplorer | /data/test-parse.py | UTF-8 | 1,528 | 2.96875 | 3 | [
"MIT"
] | permissive | import parseMass
class TestClass():
def setUp(self):
self.massTable = parseMass.generateMassTable()
def tearDown(self):
return 0
def test_n(self):
'''
spot check mass of n - 1st element
'''
assert isclose(self.massTable[0]['1'], 1.00866491585)
... | true |
489eded1957ec074bd21a9c0dd9e42bd2724458f | TzviRonen/PlaylistBoss | /PlaylistBoss/PlaylistInterfaces/Clients/SpotifyClient.py | UTF-8 | 2,537 | 2.609375 | 3 | [] | no_license | import requests
import json
import consts
import time
import hashlib
class SpotifyClient:
def __init__(self):
headers = {
"accept": "application/json",
"accept-language": "he",
"app-platform": "WebPlayer",
"cache-control": "no-cache",
"pragma": "n... | true |
b9b7d64a5984d9835d8df8625dfb9fd1aa87ead4 | ejhumphrey/harmonic-cnn | /hcnn/evaluate/model_selection.py | UTF-8 | 9,325 | 2.75 | 3 | [
"ISC"
] | permissive | import logging
import numpy as np
import pandas
import sklearn.metrics
import hcnn.common.utils as utils
import hcnn.train.models
from . import predict
logger = logging.getLogger(__name__)
class ModelSelector(object):
"""Class to choose a model given a list of model parameters."""
def __init__(self, param_l... | true |
048baaa94312905ba46d16f2bf05a2d0efb09d9f | LadnerLab/Miscellaneous | /protein_disorder/enr_unr_compare.py | UTF-8 | 7,553 | 2.515625 | 3 | [] | no_license | #!/usr/bin/env python3
import re
import argparse
import scipy.stats
import pandas as pd
import numpy as np
def main():
argp = argparse.ArgumentParser( description = "Compare the " )
argp.add_argument( '--deconv','-d', help = "Output file produced by PepSIRF's species deconvolution "
"mo... | true |
6ad9673c701006689b01bea3ba05975952eae858 | Kathir1/python-programming | /beginner/factorial.py | UTF-8 | 250 | 4.0625 | 4 | [] | no_license | def main():
num = int(input("enter the number"))
factorial = 1
if num == 0:
print("The factorial of 0 is 1")
elif num>0:
for i in range(1,num + 1):
factorial = factorial*i
print(factorial)
if __name__ == '__main__':
main()
| true |
f7639ff7c67ee41bd5a29bc51730a7ff51e564a3 | wangyijie11/pypractice | /base/socket通信client.py | UTF-8 | 466 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import socket
ip_port = ('127.0.0.1', 9999)
sk = socket.socket()
sk.connect(ip_port)
sk.settimeout(5)
data = sk.recv(1024).decode()
print('服务器', data)
while True:
inp = input('你:').strip()
if not inp:
continue
sk.sendall(inp.encode())
if inp == '... | true |
345964b6698bf337924a83737d26294b15390da1 | DgrinderHZ/Competitive-Programming | /Codeforces/Newcomers Training/Sheet #3 (Arrays)/N.py | UTF-8 | 294 | 3.078125 | 3 | [] | no_license | def solve(arr, n):
f = 0
for i in range(n):
for j in range(i+1,n):
if arr[i]*arr[j] in arr:
continue
else:
f = 1
break
if f:
print("no")
else:
print("yes")
t = int(input())
for _ in range(t):
n = int(input())
arr = list(map(int, input().split()))
solve(arr, n)
| true |
61652db760728f44f4307de5d832dce8684fe35f | fengmingshan/python | /网优日常/中兴3G网管参数修改/合并3G配置数据.py | UTF-8 | 578 | 2.53125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Jul 17 12:50:42 2018
@author: Administrator
"""
import pandas as pd
import os
data_path = r'D:\_python小程序\3G配置数据合并' + '\\'
files = os.listdir(data_path)
df_content = pd.DataFrame()
for file in files:
if 'BSS' in file:
df_tmp = pd.read_excel(data_path + file ,... | true |
2e0b19b14c37da93093259f4ca5b805b19b32b5f | SwarupKarmokar/Loan_eligible-nonEligible | /app.py | UTF-8 | 977 | 3 | 3 | [] | no_license | from flask import Flask, render_template, request
import pandas
import numpy as np
import pickle
app = Flask(__name__)
model = pickle.load(open("Loan(Y,N).pkl", 'rb'))
@app.route('/')
def home():
return render_template('index.html')
@app.route('/predict', methods = ['POST'])
def predict():
temp_array= list... | true |
6c45809cb27c62ace106aee7a28edd5fdd4422f2 | bharanim11598/code-kata | /alphabetornumber.py | UTF-8 | 98 | 3.265625 | 3 | [] | no_license | c=input()
if((c>='a'and c<='z')or(c>='A'and c<='Z')):
print("alphabet")
else:
print("number")
| true |
3a16ae80b842b03959ef8b5b1435eb4d8acec727 | ViFLara/Python-Course | /Python-Classes/class10_customize_exception.py | UTF-8 | 833 | 3.90625 | 4 | [
"Apache-2.0"
] | permissive | class Error(Exception):
pass
class InputError(Error):
def __init__(self, message):
self.message = message
while True:
try:
x = int(input('Enter a grade from 0 to 10'))
print(x)
if x > 10:
raise InputError('Grade can not be upper then 10')
elif x < 0:
... | true |
a41a38a367107c69c5de396036780f1ae508f9f6 | HLNN/leetcode | /src/0910-nth-magical-number/nth-magical-number.py | UTF-8 | 877 | 3.515625 | 4 | [] | no_license | # A positive integer is magical if it is divisible by either a or b.
#
# Given the three integers n, a, and b, return the nth magical number. Since the answer may be very large, return it modulo 109 + 7.
#
#
# Example 1:
#
#
# Input: n = 1, a = 2, b = 3
# Output: 2
#
#
# Example 2:
#
#
# Input: n = 4, a = 2, b = 3
# ... | true |
84e1d51d67609b0ccd697e3bde7eda85596bcf79 | AvinWangZH/Personal-Website | /images/Publication/PatientKind/ParseXML.py | UTF-8 | 5,205 | 2.78125 | 3 | [] | no_license | import logging
import xml.etree.ElementTree as ET
import pickle
import json
import glob
def maybe_get_text(node):
if node is None:
return node
else:
return node.text
def parse_article(filename):
tree = ET.parse(filename)
root = tree.getroot()
articles = {}
for ... | true |
847814e2df5b720372704561519d88e640177075 | dtcenter/METplus | /manage_externals/manic/utils.py | UTF-8 | 9,884 | 2.953125 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #!/usr/bin/env python
"""
Common public utilities for manic package
"""
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import print_function
import logging
import os
import subprocess
import sys
from threading import Timer
from .global_constants import LOCAL_PATH_INDI... | true |
bfa2a9b11331fe584afc711f14549e6dab3ee0dc | henry-kr/sqlfluff | /test/chunks_test.py | UTF-8 | 1,156 | 2.953125 | 3 | [
"MIT"
] | permissive | """ The Test file for Chunks """
import pytest
from sqlfluff.chunks import PositionedChunk, ChunkString
# ############## Chunks
def test__chunk__split():
c = PositionedChunk('foobarbar', 10, 20, None)
a, b = c.split_at(3)
assert a == PositionedChunk('foo', 10, 20, None)
assert b == PositionedChunk('... | true |
e8a7e98aa75a0e8e2ce1cabda5fb98732803e990 | yzziqiu/python-class | /notes/week2-notes.py | UTF-8 | 1,644 | 4.03125 | 4 | [] | no_license | # week2-notes
# python week2-notes.py
# array index print
test_string = "hello world"
print(test_string)
# hell
print('"{0}"'.format(test_string[0:4]))
#hell
print('"{0}"'.format(test_string[:4]))
#hello world
print('"{0}"'.format(test_string[0:]))
#hello world
print('"{0}"'.format(test_string[:]))
#ello worl
print('... | true |
cb5505fb0d461759b594bd02102c9b1dfa4df044 | zerorax/pydungeon2 | /main.py | UTF-8 | 1,517 | 2.609375 | 3 | [] | no_license | #!/usr/bin/python3
import time
import interface
import resize
STATE_MENU = 0
STATE_NAME = 1
STATE_CLASS = 2
STATE_STATS = 3
STATE_INTRO = 4
STATE_INGAME = 5
TICK_SECONDS = 1.0
START_RNUM = 1
class Character:
def __init__(self, name, shortdesc, longdesc, location=START_RNUM, gold=0, inventory=[]):
self.... | true |
0a854339d20b462e3601f09909a2cc1ca14971f0 | danielmarri/Optimization-of-Hyperparameters-in-a-Convolution-Neural-Network | /Hyperparameter_Optimization/tests/test_Running_HO_on_CNN.py | UTF-8 | 2,159 | 2.671875 | 3 | [
"MIT"
] | permissive | """ This code is used to test the script: project_csme802_2_2.py. """
#!/usr/bin/env python
# coding: utf-8
import unittest
import numpy as np
from typing import Dict, List
from Hyperparameter_Optimization import Running_HO_on_CNN_unittest
class Parameters:
""" Parameters used to test the code """
parameter... | true |
e7edf41ec353ba13a445d5b307a1fb8c31509d81 | ISMHinoLab/geodesical_skew_divergence | /gs_divergence/alpha_geodesic.py | UTF-8 | 687 | 3.296875 | 3 | [
"MIT"
] | permissive | import torch
def alpha_geodesic(
a: torch.Tensor,
b: torch.Tensor,
alpha: float,
lmd: float
) -> torch.Tensor:
r"""
$\alpha$-geodesic between two probability distributions
"""
a_ = a + 1e-12
b_ = b + 1e-12
if alpha == 1:
return torch.exp((1 - lmd) * torch.log(a_) + lmd... | true |
ea052ab23eda3ae9dfdfd50bd24ddf896464b152 | doyoubi/undermoon | /scripts/mem_store_v1_to_v2.py | UTF-8 | 847 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | import sys
import json
def upgrade_store_to_v2(v1_json):
if v1_json['version'] != 'mem-broker-0.1':
raise Exception('unexpected version: {}'.format(v1_json['version']))
new_json = v1_json
new_json['version'] = 'mem-broker-0.2'
new_json['enable_ordered_proxy'] = False
for proxy_resource in ... | true |
fa46cb84558453456737a88a4b2fbaf10afe241e | jpdallas/booking-python-scraper | /booking.py | UTF-8 | 15,774 | 2.578125 | 3 | [] | no_license | import os
import json
import socket
import time
import random
from chrome_useragents import chrome
from pprint import pprint
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
# timeout in seconds
timeout = 60
socket.setdefaulttimeout(timeout)
headers = {}
headers['User-Agent'... | true |
38c59421ef564cae0dfbed0c4042b9bfaf149d1d | drebars/Parsing-Telegram-bot | /parsing.py | UTF-8 | 1,383 | 2.96875 | 3 | [] | no_license | # import telebot
# from mytoken import token
from typing import KeysView
import requests
from bs4 import BeautifulSoup
import csv
# def start_message(message):
# chat_id = message.chat.id
# user_info = f'{message.from_user.first_name} {message.from_user.username}'
# bot.send_message(chat_id, "В... | true |
5d3f6df7c23be2ba6c0dec70ebee6be4cf48ee7c | linyang59685689/OpenCvAssignment | /professional/week_2/ClassroomPractice.py | UTF-8 | 1,454 | 2.5625 | 3 | [] | no_license | import cv2
import numpy as np
img = cv2.imread("../res/lena512color.tiff")
# 一阶x方向导数的kernel
kernel1 = np.float32([[-1, 0, 1], [-1, 0, 1], [-1, 0, 1]])
kernel2 = np.float32([[-1, 0, 1], [-2, 0, 2], [-1, 0, 1]])
# 一阶y方向导数的kernel
kernel3 = np.float32([[-1, -1, -1], [0, 0, 0], [1, 1, 1]])
kernel4 = np.float32([[-1, -2, -... | true |
c7d85875c544569ff86d69c3ee5e3198347faf20 | kokorozaci/algorithms | /task_1/task_1_4.py | UTF-8 | 612 | 4.09375 | 4 | [] | no_license | """Пользователь вводит две буквы. Определить,
на каких местах алфавита они стоят, и сколько между ними находится букв."""
abc = 'a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z'
abc = abc.split(',')
start = input('Введите первую букву: ')
stop = input('Введите вторую букву: ')
a_i = abc.index(start)+1
b_i = abc.in... | true |
87ee7ff92c7e3de351d7ff645c9881895d222351 | yangdilang/AID2011__lzy | /log/homework01_client.py | UTF-8 | 983 | 3.28125 | 3 | [] | no_license | from socket import *
# 服务器地址
ADDR = ("127.0.0.1",55556)
# while True:
# msg = input(">>")
# if not msg:
# break
# tcp_socket = socket()
# tcp_socket.connect(ADDR)
# tcp_socket.send(msg.encode())
# data = tcp_socket.recv(1024)
# print("From server:",data.decode())
# tcp_socket.cl... | true |
cc50e83cd4ee88f3b058d9e6c782201c316a515c | xiongxianhong/xiongxianhong | /rpsls_template.py | GB18030 | 1,331 | 3.90625 | 4 | [] | no_license | #coding:gbk
"""
Ŀ:RPSLSϷ
:Ⱥ
2019/11/20
"""
import random
def name_to_number(name):
if name=="ʯͷ":
return 0
if name=="ʷ":
return 1
if name=="":
return 2
if name=="":
return 3
if name=="":
return 4
if name!="ʯͷ" or "ʷ" or "" or "" or "":
return 233
def number_to_name(number):... | true |
1d70d5c7a7ba1c555db186a7372e85894b79b619 | moekidu/cv | /scripts/user-flags.py | UTF-8 | 1,800 | 2.5625 | 3 | [] | no_license | from netmiko import ConnectHandler
from getpass import getpass
import argparse
def connect_to_device(hostname, username, password, device_type):
message = "Connecting to device"
print_logger(message, hostname)
net_d = ConnectHandler(host=hostname, username=username, password=password, device_type=device_ty... | true |
e0633116d1f9019b4f9c32048bc0c58c793c7e25 | darshanbangera/aps-2020 | /Code Library/kprimesform_x_factors.py | UTF-8 | 359 | 2.78125 | 3 | [] | no_license | import math
t = int(input())
for _ in range(t):
x,k = map(int,input().split())
ct = 0
i = 2
while(1):
if x%i==0:
x=x//i
ct+=1
i=2
else:
i+=1
if x==1 or i>math.sqrt(x):
break
if x!=1:
ct+=1
if ct<k:
... | true |
74e7fa293c0242e178f3a32677d67f5654d231a3 | kartikwar/programming_practice | /stack_queue/balanced_brackets.py | UTF-8 | 912 | 3.578125 | 4 | [] | no_license | import math
class Solution:
"""
returns true if balanced, else false
"""
def solve(self, A):
balanced_status = False
possible_starting = ['(', '{', '[']
possible_closing = [')', '}', ']']
relations = {
'(' : ')',
'{' : '}',
'[' : ']'
}
starting_brackets = []
closing_brackets = []
... | true |
ccdbba9c1ad3809ac32a4d43f54073c608ab91eb | OsnovaDT/-projecteuler.net | /task10.py | UTF-8 | 288 | 3.625 | 4 | [] | no_license | def SimpleNumber(number):
t_or_f = False
if number == 2:
t_or_f = True
else:
for i in range(2, number):
if number % i == 0:
t_or_f = False
break
else:
t_or_f = True
return t_or_f
summa = 0
for i in range(1,20000):
if SimpleNumber(i):
summa+=i
print(summa)
| true |
2b73464802d88f0c1354cc470c5434bf4c80051f | vodena/BlackFoxPythonExtras | /blackfox_extras/input_extras.py | UTF-8 | 635 | 2.96875 | 3 | [] | no_license |
def remove_not_used_inputs(data, metadata):
"""
Remove insignificant columns from data, if model has feature selection
Parameters
----------
data : numpy.array
Data as numpy array
metadata : dict
Model metadata
Returns
-------
... | true |
c2940aa62a3eb26116ee73a065a0c0586da11a21 | HarikrishnaRayam/Data-Structure-and-algorithm-python | /Generic Trees/lectures/Generic tree node.py | UTF-8 | 434 | 3.078125 | 3 | [] | no_license | class GenericTreeNode:
def __init__(self,data):
self.data = data
self.children = []
n1 = GenericTreeNode(10)
n2 = GenericTreeNode(1)
n3 = GenericTreeNode(2)
n4 = GenericTreeNode(3)
n5 = GenericTreeNode(4)
n6 = GenericTreeNode(5)
n7 = GenericTreeNode(6)
n1.children.append(n2)
n1.child... | true |
d5a99e5b2ab1725b90cc623b5d65a73bffae29a4 | rigdenlab/conkit | /conkit/io/tests/test_freecontact.py | UTF-8 | 2,687 | 2.640625 | 3 | [
"BSD-3-Clause"
] | permissive | """Testing facility for conkit.io.FreeContactIO"""
__author__ = "Felix Simkovic"
__date__ = "26 Oct 2016"
import os
import unittest
from conkit.core.contact import Contact
from conkit.core.contactfile import ContactFile
from conkit.core.contactmap import ContactMap
from conkit.core.sequence import Sequence
from conk... | true |
d94c05a0bb300f311a3536969e1bd9d409541e3e | jlucasldm/ufbaBCC | /2021.2/linguagens_formais_e_automatos/listas/semana_5/criptografia.py | UTF-8 | 550 | 3.109375 | 3 | [] | no_license | def solucao(message):
aux = ""
code = ""
for i in range(len(message)):
if message[i].isalpha():
aux += chr(ord(message[i]) + 3)
else:
aux += message[i]
for i in range(len(aux)-1, -1, -1):
code += aux[i]
half = len(code)//2
aux = ... | true |
07134e55b4175362995353007609daeea4f05795 | dpm76/Microvacbot | /testing/mpy_dummy/pyb.py | UTF-8 | 1,361 | 2.6875 | 3 | [
"MIT"
] | permissive |
class Board(object):
def __init__(self):
self.D0 = Pin()
self.D1 = Pin()
self.D2 = Pin()
self.D3 = Pin()
self.D4 = Pin()
self.D5 = Pin()
self.D6 = Pin()
self.D7 = Pin()
self.D8 = Pin()
self.D9 = Pin()
self.D10 = Pin()... | true |
01a0d5aa588402a1bc71b5a2d550dde47f5ffb76 | dbradf/disaster-tweets | /src/disaster_tweets/spacy_model.py | UTF-8 | 2,286 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | from enum import Enum
import random
from time import perf_counter
import pandas as pd
import click
from sklearn.model_selection import train_test_split
import spacy
from spacy.util import minibatch
import torch
from tqdm import tqdm
is_using_gpu = spacy.prefer_gpu()
if is_using_gpu:
print("gpu")
torch.set_def... | true |
c6031208079dbd8e43205ae9dc03bfdc6d8e7ab3 | rudra0008/python | /battelship.py | UTF-8 | 1,843 | 4.09375 | 4 | [] | no_license | #!/usr/bin/python -tt
# Command: python battelship.py
# Description: battelship game. you have to guess the location of ship
# Author: Rudra
# Maintainer: rudra0008
# Project: https://github.com/rudra0008/python
# Dependencies:
from random import randint
board = []
for x in range(0, 5):
board.ap... | true |
3586efd3b40441a70c5b3dd0a61aeaacd59f15a7 | cabbiepete/fabtools | /fabtools/require/deb.py | UTF-8 | 1,178 | 2.515625 | 3 | [
"BSD-2-Clause"
] | permissive | """
Idempotent API for managing Debian/Ubuntu packages
"""
from fabtools.files import is_file
from fabtools.deb import *
def ppa(name):
"""
Require a PPA
"""
assert name.startswith('ppa:')
user, repo = name[4:].split('/', 2)
distrib = distrib_codename()
source = '%(user)s-%(repo)s-%(distri... | true |
a634f74ba033983e5e60332f03bf573c1c4e523d | samadabbagh/sama-mft | /mft-seven-section/triangle.py | UTF-8 | 1,034 | 3.5625 | 4 | [] | no_license | import random
fw = open('inp.txt', mode='w')
triangle_count = 0
triangle_same = 0
triangle_saghein = 0
triangle_ghaem = 0
for i in range(1000):
max1 = 0
numbers = []
for j in range(3):
s = random.randint(1, 20)
fw.write(str(s))
fw.write(',')
if s > max1:
max1 = s... | true |
8a485fcdb54b794803a422dcd9fbf83f32021bf3 | radiant107/text | /t2.py | UTF-8 | 202 | 3.140625 | 3 | [] | no_license | with open('reviews.txt', 'r') as R:
data = [d for d in R] # 讀入檔案字串的簡寫法
print(len(data))
print(data[0])
best1 = [a for a in data if 'best' in a]
print(len(best1))
print(best1[1]) | true |
ee946fc6f990dc8980f84fab69ecbb5c61e7077b | ZhuJiaYou/Interview_Preparation | /leetcode/212_word_search2.py | UTF-8 | 2,090 | 3.75 | 4 | [] | no_license | from collections import defaultdict
class TrieNode:
def __init__(self, exits=False):
self.exits = exits
self.children = defaultdict(TrieNode)
class Trie:
def __init__(self):
self.root = TrieNode()
def insert(self, word):
self.search_root(word, False).exits = True
de... | true |
0a171ff66192ac447c3f592a28a47cf75a3eabfb | sunda-y/UsingPythontoAccessWebData | /week03/socket_request_response.py | UTF-8 | 658 | 3.421875 | 3 | [] | no_license | """In this assignment you write a Python program to retrieve a web page over a socket and display the headers from the web server.
http://www.pythonlearn.com/code/intro-short.txt HTTP/1.0
"""
import socket
mySocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
mySocket.connect(("www.pythonlearn.com", 80))
"""A... | true |
81262b95d1d7e2a3bbe3411ac1b96ab6b6f7c851 | jonycse/pythonSampleCode | /spoj/11_Factorial.py | UTF-8 | 376 | 3.296875 | 3 | [] | no_license | '''
Problem set: https://www.spoj.com/problems/FCTRL/
Status: TLE
'''
def zero(number,factor):
if number==5:
return 1
rt =0;
deno =factor
while deno<number:
rt += int(number/deno)
deno *= factor
return rt;
def solution(k):
return min(zero(k,2), zero(k,5))
n = input()
w... | true |
4118d081646df77a5e906463404e72063c26fa67 | swcp333/CMD- | /5.show.py | UTF-8 | 895 | 2.640625 | 3 | [] | no_license | import ctypes, sys
import os, pickle, time
STD_OUTPUT_HANDLE = ctypes.windll.kernel32.GetStdHandle(-11)
class COORD(ctypes.Structure):
_fields_ = [("X", ctypes.c_short), ("Y", ctypes.c_short)]
def printcolor(x, y, str, color):
print_xy = COORD()
print_xy.X = x
print_xy.Y = y
ctypes.windll.kernel32... | true |
a05ddcff4e66e53a9bfa7e0dceb1c029a65bbb5a | Nate-weeks/python-tutorial | /chapter-10/deck.py | UTF-8 | 769 | 3.421875 | 3 | [] | no_license | '''
deck.py
A program to initiate a deck of playing cards
Nate Weeks, april 2018
'''
from card import *
from random import shuffle
SUITS = ["s", "d", "h", "c"]
VALUES = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
class Deck(object):
'''generates a unique deck of 52 playing cards'''
def __init__(self):
... | true |
cd3cfe8547a42103a54c8d1927741509c3ab046b | martinroad/Notes | /python/操作数据库/Python操作MySQL数据库/mysql_util.py | UTF-8 | 1,363 | 2.984375 | 3 | [] | no_license |
import pymysql
from pymysql import Error
host_name = 'localhost'
user_name = 'root'
passwd = '123456'
database_name = 'python_db'
# 简历一个数据库连接
def create_connection():
try:
connection = pymysql.connect(host=host_name,
user=user_name,
... | true |
b04579aec5c8b848ac7fae4cc41b14a7cb77a571 | hyemin-han/BayesFactorFMRI | /V1.0.0/Correction_UI/bayes_correction_split.py | UTF-8 | 1,813 | 2.6875 | 3 | [
"MIT"
] | permissive | # BayesFactorFMRI: This is a GUI-aided tool to perform Bayesian meta-analysis of fMRI data and Bayesian second-level analysis of fMRI contrast files (one-sample t-test) with multiprocessing.
# author: Hyemin Han, University of Alabama (hyemin.han@ua.edu)
# BayesFactorFMRI is licensed under MIT License.
# Citations
# I... | true |
b5172fcfc29b77b963c455924ba8ec0e14f6e80f | Ry-C123/Freefall | /freefall/forces.py | UTF-8 | 4,761 | 2.65625 | 3 | [
"MIT"
] | permissive | import math
import numpy as np
from CONFIG import *
###Forces
def PR_drag(x, y, z, r_e, m_e, vx, vy, vz, TEMP, dt, R):
"""
Ry Cutter 2020
Poyting-Robertson drag as descibed in:
Burns, Lamy, and Soter (1979)
"""
Q = 1.0 #Scattering efficiency
SB = 5.670374419e-8
d = math.sqrt((x**2... | true |
173daea4aeb7b842f584a54e5dc0690236c7b5d2 | robmcmullen/dinoteeth | /dinoteeth/clients/mplayerlib.py | UTF-8 | 5,990 | 2.703125 | 3 | [] | no_license | """MPlayer slave mode interface by Fabien Devaux
Found at http://code.activestate.com/recipes/542195/
Modifications by Rob McMullen
"""
import os, os.path, select, time, subprocess
class MPlayer(object):
""" A class to access a slave mplayer process
you may want to use command(name, args*) directly
or c... | true |
d07140ee79ba8b2776426c3d606fd0d7c1c197b2 | aksharanigam1112/MachineLearningIITK | /packageML04/ML13(h).py | UTF-8 | 527 | 3.46875 | 3 | [
"MIT"
] | permissive | import matplotlib.pyplot as plt
plt.plot( [1,2,3,4] , [1,4,9,16] , 'bo-') # b- means blue silid line
# ro means red circle dot
plt.xlabel("Some Nos------>")
plt.ylabel("Squared values------>")
plt.axis([0,5,0,17]) # first 2 values rep the range of x-axi... | true |
121b01603f9d353a43b6ab47bba5cfa595ce3604 | meadewaking/Hello-World | /WebCrawler/WebCrawler/yield.py | UTF-8 | 439 | 3.15625 | 3 | [] | no_license | def test():
for i in range(5):
yield i**2 #yield为生成器关键字,生成器会在被调用时冻结当前进程,并返回当前值。生成器的遍历可以由返回全部值的集合实现
#但生成器可以实时返回所需要的值在返回数据巨大时可以提高效率
#使用生成器时可以当返回值为列表使用
for i in test():
print(i) | true |
3745ba4042502701aaf6dd68124a842105476795 | Primary-Aaron/CS_362-HW4 | /name_full.py | UTF-8 | 188 | 3.203125 | 3 | [] | no_license | import random
def fullName(first, last):
mNames = ["Bill", "Ted", "Jerry", "Michael", "Franklin", "Oliver"]
return first + " " + mNames[int(random.randrange(len(mNames)))]+ " " +last
| true |
af1c1ae9ca94ef33079177a2ffb9e7829966835c | djcomidi/projecteuler | /problem091.py | UTF-8 | 502 | 3.140625 | 3 | [] | no_license | N = 50
right_angles = 0
for p in range(1, (N + 1) ** 2):
py, px = divmod(p, N + 1)
OP2 = px ** 2 + py ** 2
for q in range(p + 1, (N + 1) ** 2):
qy, qx = divmod(q, N + 1)
OQ2, PQ2 = qx ** 2 + qy ** 2, (px - qx) ** 2 + (py - qy) ** 2
is_right_angled = False
is_right_angled |= O... | true |
ecdc407a2a74e0c1b5810da2ec58667ed18a4af2 | tsainez/examples | /python/integer-classification.py | UTF-8 | 1,484 | 4.25 | 4 | [
"MIT"
] | permissive | #
# integer-classification.py
#
# Created by Anthony Sainez on 11 October 2019
# Copyright © 2020 Anthony Sainez. All rights reserved.
#
# problem 1, modified hello world
print("Problem #1\n")
name = input("What's your name?\n")
print("Hello, " + name)
#problem 2, integer classification
print("\n------------------... | true |