seq_id
stringlengths
4
11
text
stringlengths
113
2.92M
repo_name
stringlengths
4
125
sub_path
stringlengths
3
214
file_name
stringlengths
3
160
file_ext
stringclasses
18 values
file_size_in_byte
int64
113
2.92M
program_lang
stringclasses
1 value
lang
stringclasses
93 values
doc_type
stringclasses
1 value
stars
int64
0
179k
dataset
stringclasses
3 values
pt
stringclasses
78 values
224210271
"""To print stars in a fashion""" row = int(input("Enter the no. of base row stars : ")) l1 = list(range(1,row + 1,2)) # [1,3,5,7,9] print(l1) length = len(l1) tabLen = (row - 1)//2 # 4 print (tabLen) for ele in l1: i = 1 while( i <= tabLen): print(" ",end="") i += 1 j = 1 ...
null
python-programs/assignments/loopexer/patstar.py
patstar.py
py
425
python
en
code
null
code-starcoder2
51
78292174
from flask import Flask, render_template, request, session from forms import SupaPlayaMaka import requests, json, os from ftplib import FTP app = Flask(__name__) app.secret_key = "TEST" @app.route('/', methods=['GET', 'POST'] ) def index(): return render_template('index.html') ########### #controller gets th...
null
routes.py
routes.py
py
7,795
python
en
code
null
code-starcoder2
51
495429195
import os.path import re import collections import logging logger = logging.getLogger(os.path.basename(__file__)) try: from utils.jobs.runners import runner from utils.files import copy_always, encode_lines_to_file, decode_lines_from_file from utils.errors import ProcessingError from utils.config impo...
null
utils/transformations.py
transformations.py
py
4,510
python
en
code
null
code-starcoder2
51
442050945
import numpy as np from cs231n.layers import * from cs231n.fast_layers import * from cs231n.layer_utils import * class ThreeLayerConvNet(object): """ A three-layer convolutional network with the following architecture: conv - relu - 2x2 max pool - affine - relu - affine - softmax The network operates o...
null
cs231n/classifiers/cnn.py
cnn.py
py
14,550
python
en
code
null
code-starcoder2
51
313139169
import pandas from tkinter import * import random BACKGROUND_COLOR = "#B1DDC6" current_card = {} to_learn = {} try: data = pandas.read_csv('data/word_to_learn.csv') except FileNotFoundError: orginal_data = pandas.read_csv('data/french_words.csv') to_learn = orginal_data.to_dict(orient='records') else: ...
null
main.py
main.py
py
2,159
python
en
code
null
code-starcoder2
51
356521252
#!/usr/bin/env python import sys spicefile = sys.argv[1] newspicefile = sys.argv[2] spicelist = [] with open (spicefile) as f: for line in f: spice = line.split("\t") spicelist.append(spice) newspicelist = [] with open (newspicefile) as f: for line in f: spice = line.split("\t") ...
null
Listbuilder.py
Listbuilder.py
py
798
python
en
code
null
code-starcoder2
51
632311924
# -*- coding: utf-8 -*- """ TI CC2650 SensorTag ------------------- Adapted by Ashwin from the following sources: - https://github.com/IanHarvey/bluepy/blob/a7f5db1a31dba50f77454e036b5ee05c3b7e2d6e/bluepy/sensortag.py - https://github.com/hbldh/bleak/blob/develop/examples/sensortag.py """ import os import asyncio i...
null
read_sensor/gesture_reader.py
gesture_reader.py
py
6,681
python
en
code
null
code-starcoder2
51
209474267
import logging from roomserver.media.element import MediaElement from roomserver.media.pipeline import MediaPipeline from roomserver.media.session import KurentoSession logger = logging.getLogger(__name__) class WebRTCEndPoint(MediaElement): def __init__(self, pipeline: MediaPipeline, session: KurentoSession): ...
null
roomserver/media/web_rtc_endpoint.py
web_rtc_endpoint.py
py
1,077
python
en
code
null
code-starcoder2
51
151922715
def primes(number): #if isinstance(number, int) == False: # print("This is not an integer, please set another number!") # return 0 if number > 1: for i in range(2,number): if (number % i) == 0: return 0 break else: ...
null
Zadanie_Domowe_1_Tomasz_Tuszynski.py
Zadanie_Domowe_1_Tomasz_Tuszynski.py
py
649
python
en
code
null
code-starcoder2
51
599753961
import unittest import torch from tc_composer.func.merge import Sum, Concat from ...torch_test_case import TorchTestCase class TestSum(TorchTestCase): def setUp(self): self.size = tuple(range(1, 4)) self.t0 = torch.randn(*self.size) self.t1 = torch.randn(*self.size) def test_sum(sel...
null
tests/unittests/tc_composer/func/merge.py
merge.py
py
1,539
python
en
code
null
code-starcoder2
51
606972502
import socket import time class Client: def __init__(self, host, port, timeout=None): self.host = host self.port = port self.timeout = timeout try: self.connection = socket.create_connection((host, port), timeout) except socket.error as err: raise Cl...
null
src/5week/client.py
client.py
py
1,650
python
en
code
null
code-starcoder2
51
536430286
def calculate(N, case_num): global aout seen = set() if N == 0: aout.write('Case #{}: INSOMNIA\n'.format(case_num)) return i = 1 while len(seen) < 10: number = i * N for digit in str(number): seen.add(digit) i += 1 aout.write('Case #{}: {}\n'.format(case_num, number)) return if __name__ == "__...
null
codes/CodeJamCrawler/16_0_1/Astrix/answer.py
answer.py
py
508
python
en
code
null
code-starcoder2
51
653305119
import textblob from polyglot.detect import Detector hello_dict = {"english": "hello", "french": "bonjour", "spanish": "hola" } def polygot_detection(): for key in hello_dict: p = Detector(hello_dict[key]).languages[0] print("{} - {} - confidence: {}".for...
null
python/language/language_detect.py
language_detect.py
py
561
python
en
code
null
code-starcoder2
51
562630615
import cocos from inventory import inv, MessageBox, ItemInv from pyglet.window import mouse # Объяевление кисоты как глобальной переменной global acid # Объявление словаря барьеров barr = {"acid" : 1, "door" : 1, "key":1, "safe":1} class StaticImage(cocos.sprite.Sprite): """Установка статического изображения по ...
null
texture_tools.py
texture_tools.py
py
4,644
python
en
code
null
code-starcoder2
51
63775064
import json, sys, time # const device_keys = ['name', 'brand', 'codename', 'specs'] team_keys = ['full_name', 'country', 'github_username'] try: devices = json.loads(open('../../devices.json').read()) except: print('Cannot load devices.json properly, Try again after correcting the format.') time.sleep(5) ...
null
.github/scripts/validator.py
validator.py
py
1,368
python
en
code
null
code-starcoder2
51
177655583
import os import seaborn as sns import pandas as pd import matplotlib.pyplot as plt import numpy as np def txt_to_csv(file_name): new_f = open(file_name + '.csv', 'w') with open(file_name + '.txt', 'r') as f: for i in range(360): line_str = f.readline() inserted_str = ','.join(...
null
data_clean.py
data_clean.py
py
5,310
python
en
code
null
code-starcoder2
50
465233663
__author__ = 'Jake Barter' # Student Id: 780104 # Python Programming Coursework from graphics import * def main(): colours, size = patchSetup() # Initiate patch setup win, patches = drawPatchwork(size, colours) # Draw the patches swapPatch(win, size, patches) # Initiate swapping patches def patchSe...
null
Uni Work/Jake/Coursework - Finished.py
Coursework - Finished.py
py
6,302
python
en
code
null
code-starcoder2
50
509924868
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'greboreda' import tkRAD from countries import CountriesBox from projects import ProjectsBox from databases import DatabasesBox from extra_data import ExtraData from data import Commands from data import Ids import resources class MainWindow(tkRAD.RADXMLMa...
null
main.py
main.py
py
1,900
python
en
code
null
code-starcoder2
50
616318136
#!/usr/bin/env python import http.client, json, threading from html.parser import HTMLParser ind_lock = threading.Lock() class OBDCodeParser(HTMLParser): def __init__(self, code_c): self.codes = [] self.file = code_c + "_codes.json" self.scans = 0 super().__init__() def save...
null
obdcodes.py
obdcodes.py
py
4,989
python
en
code
null
code-starcoder2
50
476996928
# generic code used from flask documentation for application factory functionality # source link: https://flask.palletsprojects.com/en/1.1.x/tutorial/factory/ import os from flask import Flask from . import db import app.api as api from flask_cors import CORS def create_app(test_config=None): # create and configure ...
null
app/__init__.py
__init__.py
py
931
python
en
code
null
code-starcoder2
50
62595296
# --- module import. import time import nasco_controller con = nasco_controller.controller() # --- freq params. freq_1st_100ghz = 17.4452003333 freq_2nd_upper_100ghz = 9.5 freq_2nd_lower_100ghz = 4.0 freq_1st_200ghz = 18.764 freq_2nd_upper_200ghz = 4.0 freq_2nd_lower_200ghz = 6.6 # --- power params. power_1st_100gh...
null
scripts/set_sg_v2.py
set_sg_v2.py
py
1,614
python
en
code
null
code-starcoder2
50
488265656
import pathlib from textwrap import dedent import os import shutil import tempfile import pytest from click.testing import CliRunner from git import Repo, Actor import wily.__main__ as main @pytest.fixture def gitdir(tmpdir): """ Create a project and add code to it """ repo = Repo.init(path=tmpdir) tmppa...
null
test/conftest.py
conftest.py
py
2,285
python
en
code
null
code-starcoder2
50
607126115
import multiprocessing import pandas as pd from joblib import Parallel, delayed import numpy as np import time from tabulate import tabulate from sklearn.decomposition import TruncatedSVD from KNN import k_nn def knn(train_X, train_y, test_X, distance, p=0): return k_nn(train_X, train_y, test_X, distance, p) de...
null
main.py
main.py
py
6,761
python
en
code
null
code-starcoder2
51
529952836
from .base import * # noqa: F403 MIDDLEWARE.append("api.middleware.RangesMiddleware") # noqa: F405 CORS_ORIGIN_WHITELIST = ("http://127.0.0.1:3000", "http://0.0.0.0:3000", "http://localhost:3000") CSRF_TRUSTED_ORIGINS = CORS_ORIGIN_WHITELIST # LOGGING = { # 'version': 1, # 'handlers': { # 'console': ...
null
backend/config/settings/development.py
development.py
py
572
python
en
code
null
code-starcoder2
51
396152164
import ex2 def get_num_of_transmitters(Lazer_transm_tuple): [x_y_trans, x_z_tran, y_z_tran] = Lazer_transm_tuple num_of_transmitters = len(x_y_trans) + len(x_z_tran) + len(y_z_tran) return num_of_transmitters def check_solution(problem, lazer_locations, print_single_results=False): controller = ex2....
null
Project-2/ex2_checker_local.py
ex2_checker_local.py
py
5,038
python
en
code
null
code-starcoder2
51
79436778
#!/usr/bin/env python3 # Write a program that creates random fasta files # Create a function that makes random DNA sequences # Parameters include length and frequencies for A, C, G, T # Command line: # python3 rand_fasta.py <count> <min> <max> <a> <c> <g> <t> import gzip import sys import math import random def rand...
null
MCB 185 (Korf Course)/Week 5/rand_fasta.py
rand_fasta.py
py
1,078
python
en
code
null
code-starcoder2
51
345887132
# -*- coding: utf-8 -*- # @Author: miana1 # @Description: File for doing the training and testing for the Riemannian knn # and mdm which cannot be saved using pickle. # @Date: 2020-02-14 13:15:18 # @E-mail: ammar.mian@aalto.fi # @Last Modified by: miana1 # @Last Modified time: 2020-02-14 15:12:08 # --...
null
pedestrian_detection/Scripts/compute_train_test_knn_mdm_riemannian.py
compute_train_test_knn_mdm_riemannian.py
py
7,544
python
en
code
null
code-starcoder2
51
270420066
class Solution(object): def uniquePathsWithObstacles(self, obstacleGrid): """ :type obstacleGrid: List[List[int]] :rtype: int """ # second round # 2016-07-18 r = len(obstacleGrid) c = len(obstacleGrid[0]) res = [[0] * c for i in range(r)] ...
null
63-unique_pathes_ii/solution.py
solution.py
py
1,009
python
en
code
null
code-starcoder2
51
459066734
import requests import asyncio from rest_framework.views import APIView from rest_framework.viewsets import ViewSet, ModelViewSet from rest_framework.response import Response from rest_framework.exceptions import PermissionDenied, NotAcceptable from rest_framework import status from api.models import MegaPlanCredenti...
null
api/views.py
views.py
py
8,289
python
en
code
null
code-starcoder2
51
206270646
import matplotlib.pyplot as plt def segment(xa, ya, xb, yb): return ((xa, ya), (xb, yb)) def plot_segments(plot, segments): for s in segments: a, b = s xa, ya = a xb, yb = b plot.plot([xa, xb], [ya, yb], c="g") def read_from(filename): segments = [] with open(filename,...
null
20201/decision-support-systems/refs/Cuoi ky/Code/example2/draw.py
draw.py
py
732
python
en
code
null
code-starcoder2
51
382320276
import httplib import re from django.utils.safestring import mark_safe from django.utils.translation import ugettext_lazy as _ import logging log = logging.getLogger(__name__) # we accept the long URLs shown in the location bar or the short versions # produced by the Share button YOUTUBE_URL_RE = re.compile(r'^https...
null
src/cpi/apps/attachments/util.py
util.py
py
2,968
python
en
code
null
code-starcoder2
51
282770244
#!/usr/bin/python3 import unittest from python.common.baseunittest import BaseUnitTest from python.eapi.methods.heartbeats.heartbeat import Heartbeat class TestHeartbeats(BaseUnitTest): """Runs Heartbeat test scenarios.""" @BaseUnitTest.log_try_except def test_01_get_heartbeat(self): """ ...
null
python/eapi/tests/test_heartbeats.py
test_heartbeats.py
py
653
python
en
code
null
code-starcoder2
51
475561533
#!/bin/bash env python3 #multicolored_lines.py #Tim Tyree #5.10.2021 # forked fromhttps://matplotlib.org/3.1.1/gallery/lines_bars_and_markers/multicolored_line.html import numpy as np import matplotlib.pyplot as plt from matplotlib.collections import LineCollection from matplotlib.colors import ListedColormap, Bounda...
null
notebooks/lib/viewer/multicolored_lines.py
multicolored_lines.py
py
3,566
python
en
code
null
code-starcoder2
51
305791096
import cv2 import numpy as np from time import perf_counter cap = cv2.VideoCapture(0) fps = cap.get(cv2.CAP_PROP_FPS) height = cap.get(cv2.CAP_PROP_FRAME_HEIGHT) scale_fact = 1; segment_count = fps*3 segment_height = int(height*scale_fact/segment_count) print("segment count:", segment_count, "\nscaling f...
null
noodle_dance.py
noodle_dance.py
py
1,331
python
en
code
null
code-starcoder2
51
296780257
from conans import ConanFile, tools, AutoToolsBuildEnvironment from conans.errors import ConanException, ConanInvalidConfiguration import os required_conan_version = ">=1.29.1" class GccConan(ConanFile): name = "gcc" description = "The GNU Compiler Collection includes front ends for C, " \ ...
null
recipes/gcc/all/conanfile.py
conanfile.py
py
5,428
python
en
code
null
code-starcoder2
51
361776652
""" Copyright (c) 2018-2020, Jairus Martin. Distributed under the terms of the MIT License. The full license is in the file LICENSE.txt, distributed with this software. Created on Aug 2, 2018 @author: jrm """ import os import logging import datetime import weakref import asyncio import sqlalchemy as sa from decimal...
null
atomdb/sql.py
sql.py
py
48,769
python
en
code
null
code-starcoder2
51
141256012
# Steven Hunt - Logistic Solutions # CST 205 # March 11 2017 # Lab 5 - Advanced Image Manipulation # Warm Up : Copy an image onto the middle of a larger canvas. def centerImage(): pic = makePicture(pickAFile()) w, h = getWidth(pic), getHeight(pic) copy = makeEmptyPicture(w*2,h*2) targetX = w/2 for sourc...
null
Lab-05.py
Lab-05.py
py
5,055
python
en
code
null
code-starcoder2
51
600290140
# python 3 import string import itertools import sys def gen_rotations(num): digits = [ch for ch in str(num)] for i in range(1, len(digits)): if digits[i] != '0': result = 0 for d in digits[i:]: result = 10*result + ord(d) - ord('0') for d...
null
solutions_1483488_0/Python/pawko/C.py
C.py
py
1,397
python
en
code
null
code-starcoder2
50
527575930
from locust import HttpUser, task, TaskSet, events, constant import time, sys import os class UserBehavior(HttpUser): @task(1) def test_get(self): data = { "requestId": "303fe1ca-9d76-45e3-ac3e-41f6aa35a994", "createTime": 0, "generator": 1, "type": 1, ...
null
test_4locust.py
test_4locust.py
py
1,474
python
en
code
null
code-starcoder2
50
389166434
# usage `python3 data_migration.py [optional "loop"] [optional project to resume (must include [loop] or [file] for arg 1)]` # example `python3 data_migration.py loop` # example `python2 data_migration.py file 350` import datetime import json import psycopg2 import shutil import os import glob import csv import re impo...
null
src/main/resources/scripts/data_migration.py
data_migration.py
py
28,687
python
en
code
null
code-starcoder2
50
24535426
import matplotlib.pyplot as plt import pandas as pd from sklearn import metrics from sklearn.metrics import auc, accuracy_score, precision_score, recall_score, f1_score, roc_auc_score output_file = open('./data/blobber-sent-analysis-01.txt', 'w') DataSet = pd.read_csv("./data/blobber-sent-new-01.csv",header=None, nam...
null
StockTweets/Blobber_sent_analysis_01.py
Blobber_sent_analysis_01.py
py
1,391
python
en
code
null
code-starcoder2
50
127080995
#coding: utf-8 import config from telegram.ext import Updater, CommandHandler import logging import parser_prg as parser logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO) WITH_PROXY = True # You need to change this variable to True if you want to start the b...
null
bot_mayak/bot.py
bot.py
py
2,971
python
en
code
null
code-starcoder2
50
476547846
from django import template register = template.Library() @register.simple_tag def query_transform(request, **kwargs): updated = request.GET.copy() for k, v in kwargs.items(): updated[k] = v return updated.urlencode()
null
customers/templatetags/customer_extras.py
customer_extras.py
py
241
python
en
code
null
code-starcoder2
51
328122313
from flask import render_template, flash, redirect, session, url_for, request, g from flask.ext.login import login_user, logout_user, current_user, login_required from datetime import datetime from app import app, db, models from .models import User, itemdata, menutable, vendortable, analytics, averagedb, uniquedb from...
null
app/views_admin.py
views_admin.py
py
3,499
python
en
code
null
code-starcoder2
51
32835450
# -*- coding: utf-8 -*- # # const.py - A set of structures and constants used to implement the Ethernet/IP protocol # # Copyright (c) 2019 Ian Ottoway <ian@ottoway.dev> # Copyright (c) 2014 Agostino Ruscito <ruscito@gmail.com> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this so...
null
pycomm3/clx.py
clx.py
py
68,714
python
en
code
null
code-starcoder2
51
560984336
#!/usr/bin/python3 # -*- coding: utf-8 -*- from xml.sax import make_parser from xml.sax.handler import ContentHandler class SmallSMILHandler(ContentHandler): def __init__ (self): self.width = "" self.height = "" self.background_color = "" self.id = "" self.top = "" ...
null
smallsmilhandler.py
smallsmilhandler.py
py
3,107
python
en
code
null
code-starcoder2
51
64237498
#! /usr/bin/python3 # 29ImageSiteDownloader.py: This program allows you to search for a category import requests import bs4 from selenium import webdriver from selenium.webdriver.firefox.options import Options from selenium.webdriver.common.by import By import os # Scrape the front page for elements with the ".Tag-na...
null
python/03AutomateTheBoringStuffWithPython/11Webscraping/29ImageSiteDownloader.py
29ImageSiteDownloader.py
py
3,098
python
en
code
null
code-starcoder2
51
433752619
import re INSTRUCTION_PATTERN = "([A-Z])([0-9]+)" def map_instruction(line): groups = re.search(INSTRUCTION_PATTERN, line.rstrip()).groups() return groups[0], int(groups[1]) def read_file_data(path): with open(path) as fp: return list(map(map_instruction, fp)) # ----------------- Part 1 -----...
null
day12/day12.py
day12.py
py
2,546
python
en
code
null
code-starcoder2
51
110945386
import math def factors(n): #return all factors of n as a list factors = [] for i in range(1,int(math.floor(math.sqrt(n)))): if n % i ==0 and not i in factors: factors.append(i) if not n/i == i: factors.append(int(n/i)) return sorted(factors) ...
null
003.py
003.py
py
877
python
en
code
null
code-starcoder2
51
227805690
from django.shortcuts import render, redirect from django.http import HttpResponse from models import UchetFile, UchetData from forms import UchetFileForm import os # Create your views here. def main_page(request): if request.method == "POST": form = UchetFileForm(request.POST, request.FILES) if f...
null
my_app/views.py
views.py
py
1,342
python
en
code
null
code-starcoder2
51
196535454
# License: Apache 2.0. See LICENSE file in root directory. # Copyright(c) 2020 Intel Corporation. All Rights Reserved. #test:device L500* #test:device D400* import platform import pyrealsense2 as rs from rspy import test from rspy import log import time dev = test.find_first_device_or_exit() depth_sensor = dev.first...
null
unit-tests/func/test-set-option.py
test-set-option.py
py
4,565
python
en
code
null
code-starcoder2
51
237256463
class Grupo: def __init__(self, no_grupos): self.no_grupos = no_grupos class Nodo: def __init__(self, no_grupos=None, next=None, posicion=None): self.no_grupos = no_grupos self.next = next self.posicion = posicion class Lista_Enlazada: # Indica que el primero de los nodo...
null
IPC 2 Proyecto 1/paquetes/lista_circular/Lista_Enlazada_Reducida.py
Lista_Enlazada_Reducida.py
py
1,923
python
en
code
null
code-starcoder2
51
501799918
# coding=utf-8 #!/usr/bin/env python # -*- coding:utf-8 -*- # Author : itdiaosinan.com # E-mail : goodboyryan@126.com # Date : 14/10/1 12:21:19 # Desc : admin管理 from dazizhu.models import Post from uuslug import slugify from upyun_util import UpyunUtil import settings def post_saved(sender, inst...
null
dazizhu/signal_handler/post.py
post.py
py
719
python
en
code
null
code-starcoder2
51
224304090
class User(object): __instance = None def __new__(cls,*args,**kwargs): if not cls.__instance: cls.__instance = super(User,cls).__new__(cls,*args,**kwargs) return cls.__instance def __init__(self,name): self.name = name def share_user(cls): if not cls.__instance: return User() user1 = User('aaa...
null
basic/day8/01-single_objects.py
01-single_objects.py
py
377
python
en
code
null
code-starcoder2
51
520293584
#!/usr/bin/env python # -*- coding: utf-8 -*- from datetime import datetime import functools import sys import warnings import matplotlib if not hasattr(sys, "ps1"): matplotlib.use("Agg") import matplotlib.pyplot as plt import numpy as np from scipy.optimize import curve_fit, OptimizeWarning from covsirphy.cleanin...
null
covsirphy/phase/trend.py
trend.py
py
8,186
python
en
code
null
code-starcoder2
50
646740882
import decimal from calendar import timegm from datetime import datetime, date from dateutil.tz import tzutc from marshmallow import ValidationError, Schema as MaSchema, missing, class_registry, utils from marshmallow import fields as ma_fields, validates_schema from marshmallow.base import SchemaABC from marshmallow....
null
umongo/marshmallow_bonus.py
marshmallow_bonus.py
py
12,039
python
en
code
null
code-starcoder2
50
263967231
from django.http import HttpResponse, JsonResponse, FileResponse import hashlib from django.core import serializers import base64 import os from wsgiref.util import FileWrapper import zipfile from io import BytesIO from wsgiref.util import FileWrapper import json from web3 import Web3, HTTPProvider from ethereum.util...
null
PythonClientV1/ClientGateKeeper/gatekeeper/views.py
views.py
py
5,582
python
en
code
null
code-starcoder2
50
180338189
# uncompyle6 version 3.7.4 # Python bytecode 3.6 (3379) # Decompiled from: Python 3.6.9 (default, Apr 18 2020, 01:56:04) # [GCC 8.4.0] # Embedded file name: /home/hanzz/releases/odcs/server/odcs/server/api_utils.py # Compiled at: 2018-01-11 04:20:51 # Size of source mod 2**32: 5556 bytes import copy from flask import ...
null
pycfiles/odcs-0.2.45.tar/api_utils.cpython-36.py
api_utils.cpython-36.py
py
4,131
python
en
code
null
code-starcoder2
50
441007536
#!/usr/local/bin/python3 # -*- coding:utf-8 -*- """ @author: @file: 922. 按奇偶排序数组 II.py @time: 2020/11/12 09:49 @desc: """ from typing import List """ 给定一个非负整数数组 A, A 中一半整数是奇数,一半整数是偶数。 对数组进行排序,以便当 A[i] 为奇数时,i 也是奇数;当 A[i] 为偶数时, i 也是偶数。 你可以返回任何满足上述条件的数组作为答案。   示例: 输入:[4,2,5,7] 输出:[4,5,2,7] 解释:[4,7,2,5],[2,5,4,7],[2...
null
all_topic/esay_topic/922. 按奇偶排序数组 II.py
922. 按奇偶排序数组 II.py
py
1,572
python
en
code
null
code-starcoder2
50
586556815
import re import requests from bs4 import BeautifulSoup url = 'https://www.amazon.com/' headers = {'user-agent': 'kaveh'} r = requests.get(url,headers=headers) soup = BeautifulSoup(r.text,'lxml') soup_Option = soup.select('#searchDropdownBox') Soup_value = soup_Option[0].children for items in Soup_value: # pri...
null
webscarp-project-maktabkhooneh.py
webscarp-project-maktabkhooneh.py
py
439
python
en
code
null
code-starcoder2
50
35472707
''' File name: createLeague.py Author: Jeremy Driesler Date created: 20190227 Date last modified: 20190227 Python Version: 3.7.2 ''' import datetime from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from tabledef import Player, Team, TeamLineup from random import randint ...
null
ServerSide/Database/createLeague.py
createLeague.py
py
4,352
python
en
code
null
code-starcoder2
50
84244976
import sys sys.path.append('.') from . import * class A0900Responses(FlaskForm): response = StringField('Birth Date (MMDDYYY):', validators=[InputRequired(), Length(min=8, max=8)]) class A0900Form(FlaskForm): section = 'Section_A' name = 'a0900' question = 'Birth Date' responses = FormField(A0900Responses) subm...
null
app/main/forms/section_a/a0900_form.py
a0900_form.py
py
346
python
en
code
null
code-starcoder2
50
603695197
import numpy as np import math import cmath from scipy import signal class lms(object): def __init__(self,N): self.N=N self.w=np.random.rand(N)*0.01 self.x=np.zeros(N) self.y=0 def update(self,x,d,eta): self.x=self.x[:-1] self.x=np.insert(self.x,0,x) y=np...
null
pasa.py
pasa.py
py
1,733
python
en
code
null
code-starcoder2
51
134489083
import json import re from pprint import pprint import pytest import requests from bs4 import BeautifulSoup from data.app_data import htaccess from fixture import rest dev = "assurancer.smashedmedia.guru" def test_Pages_Lassie(rest): doc = rest.get_data(htaccess+dev).text links = rest.find_(in_=doc,item='a::...
null
tests_Assurance_realty/test_AR_common.py
test_AR_common.py
py
2,028
python
en
code
null
code-starcoder2
51
304514189
""" General utility functions. """ import datetime import json from pathlib import Path from typing import Callable import numpy as np import talib from .object import BarData, TickData from .constant import Exchange, Interval, KlinePattern from .algorithm import Algorithm from talib import abstract from typing impor...
null
vnpy/trader/utility.py
utility.py
py
18,195
python
en
code
null
code-starcoder2
51
647098080
import requests import json def apiCallReturnJSON(token, method, api_url, payload): # TODO: Check if the token is still valid url = "https://webexapis.com/v1/{}".format(api_url) headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer {}'.format(token) } response = reques...
null
main.py
main.py
py
3,128
python
en
code
null
code-starcoder2
51
204540600
import logging from decimal import Decimal, InvalidOperation from django.contrib.auth import get_user_model from django.db import models from django.utils import timezone from django.utils.translation import gettext_lazy as _ logger = logging.getLogger("traffic_control") class SoftDeleteModel(models.Model): is_...
null
traffic_control/mixins/models.py
models.py
py
3,348
python
en
code
null
code-starcoder2
51
347881510
# Copyright 2017, 2018 Amazon.com, Inc. or its affiliates. # This module is part of Amazon Linux Extras. # # Amazon Linux Extras is free software: you can redistribute it and/or # modify it under the terms of the GNU General Public License v2 as published # by the Free Software Foundation. # # Amazon Linux Extras is d...
null
usr/lib/python2.7/site-packages/amazon_linux_extras/repo.py
repo.py
py
7,250
python
en
code
null
code-starcoder2
51
413273850
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Tests for the windows services analysis plugin.""" import unittest from dfvfs.path import fake_path_spec from plaso.analysis import windows_services from plaso.lib import definitions from plaso.parsers import winreg_parser from tests.analysis import test_lib class...
null
tests/analysis/windows_services.py
windows_services.py
py
4,775
python
en
code
null
code-starcoder2
51
7425359
from .config import logger import uuid from .child_filter import get_filter_values, apply_filter from .config import drug_like_params from rdkit import Chem from .selfies_methods import ( selfies_substitution, selfies_deletion, selfies_insertion, random_selfies_generator, selfies_scanner, ) from typ...
null
src/deriver/api.py
api.py
py
31,499
python
en
code
null
code-starcoder2
51
215979678
import requests import json import emoji import jieba import os import wordcloud stopWordList=open('stopWord.txt').read().splitlines() member_list=[] #分词 def jiebaClearText(text): jieba_list=jieba.cut(text,cut_all=False) #return ' '.join(list) outstr="" for word in jieba_list: ...
null
my_getbilibili.py
my_getbilibili.py
py
2,727
python
en
code
null
code-starcoder2
51
55676596
class Solution: def moveZeroes(self, nums): """ :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. """ index=0 for n in nums: if n!=0: nums[index]=n index+=1 while index<len(nums...
null
python/moveZeroes.py
moveZeroes.py
py
511
python
en
code
null
code-starcoder2
51
589415589
from datetime import datetime import pymysql import Controller.DB.DB_basic as db_basic print(db_basic.db) def dateFormat(date): res = datetime.strptime(date, "%Y-%m-%d").strftime('%Y/%#m/%#d') return res def getPrice(date): db = pymysql.connect(host=db_basic.db['host'], user=db_basic.db['user'], password...
null
SystemCode/backend/Bit_coin_v1.1/Controller/close_price/getPrice.py
getPrice.py
py
893
python
en
code
null
code-starcoder2
51
446609478
#========================================================================== # REINFORCE Working Code # # The code was initially written for UCSB Deep Reinforcement Learning Seminar 2018 # # Authors: Jieliang (Rodger) Luo, Sam Green # # May 8th, 2018 #=================================================================...
null
3_gradient_intro/REINFORCE.py
REINFORCE.py
py
3,841
python
en
code
null
code-starcoder2
51
68465255
import rgb import pygame from data_parser import get_sys_config from os import path from vlc import MediaPlayer pygame.font.init() ASSETS_DIR= path.join(*(get_sys_config()["Assets"])) def isWithin(point, rect): if point[0] > rect[0] and point[0] < (rect[0] + rect[2]): if point[1] > rect[1] and point[1] < (rect[1]...
null
UIManager.py
UIManager.py
py
8,713
python
en
code
null
code-starcoder2
51
518751815
''' given int a,b,c str s input a b c s return a+b+c s ''' # -*- coding: utf-8 -*- a = int(input()) b, c = map(int, input().split()) s = input() print("{} {}".format(a + b + c, s))
null
atcoder/practiveA.py
practiveA.py
py
198
python
en
code
null
code-starcoder2
51
348923174
# -*- coding: utf-8 -*- from odoo import api, fields, models, tools, _ class SaleOrderLine(models.Model): _inherit = "sale.order.line" dnk_profit_margin_color = fields.Char('- Color') dnk_profit_margin_html = fields.Char('- ', readonly=True) dnk_profit_margin_ratio = fields.Float('- Margin Ratio') ...
null
denker/dnk_sale_profit_margin_color/models/sale_order.py
sale_order.py
py
4,336
python
en
code
null
code-starcoder2
51
449468617
from django.db import models class Book(models.Model): title = models.CharField(max_length=255, blank=True) blurb = models.TextField(max_length=255, blank=True) num_pages = models.IntegerField(blank=True) prince = models.FloatField(blank=True) in_print = models.BooleanField(default=True) image = models.FileField...
null
models.py
models.py
py
504
python
en
code
null
code-starcoder2
51
402756484
import auditor class AuditorMixinView(object): get_event = None update_event = None delete_event = None def get_object(self): instance = super().get_object() method = self.request.method.lower() if method == 'get': auditor.record(event_type=self.get_event, ...
null
polyaxon/api/utils/views/auditor_mixin.py
auditor_mixin.py
py
1,057
python
en
code
null
code-starcoder2
51
277708685
from selenium import webdriver from selenium.common.exceptions import NoSuchElementException,StaleElementReferenceException from bs4 import BeautifulSoup from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by import...
null
crawler/rt.py
rt.py
py
1,571
python
en
code
null
code-starcoder2
51
201060591
''' Copyright 2017 The Regents of the University of Colorado 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 app...
null
django_harmonization/HeartData/calculate.py
calculate.py
py
25,623
python
en
code
null
code-starcoder2
51
216989683
import os import urllib import pandas as pd import requests from statsmodels.tsa.stattools import grangercausalitytests AUTHORIZE_ENDPOINT = "https://www.fitbit.com" CLIENT_ID = os.environ['FITBIT_ID'] CLIENT_SECRET = os.environ['FITBIT_SECRET'] REDIRECT_URI = 'https://127.0.0.1:3000/fitbit_auth' # generated placeh...
null
fitbit_api.py
fitbit_api.py
py
2,237
python
en
code
null
code-starcoder2
51
180369559
# # See README.md for instructions # import os import traceback from flask import Flask, jsonify, request, render_template from flask_cors import CORS import json app = Flask(__name__) app.secret_key = os.urandom(16) CORS(app, supports_credentials=True) data = {} @app.route("/") def hello(): return render_templ...
null
api/web.py
web.py
py
3,758
python
en
code
null
code-starcoder2
51
187882582
# -*- coding: utf-8 -*- # # /) # / ) # (\ / ) # ( \ / ) # ( \/ / ) # (@) ) # / \_ \ # // \\\ # (( \\ # ~ ~ ~ \ # skylark # """ skylark ~~~~~~~ A nice micro orm for python, mysql only. :copyright: (c) 2014 by Chao Wang (Hit...
null
skylark.py
skylark.py
py
25,427
python
en
code
null
code-starcoder2
51
471655718
import json from discord.ext import commands from utils import conjugator class Japanese(commands.Cog): """A cog that provides some useful japanese tools""" def __init__(self): with open("utils/japanese_verbs.json") as f: verbs = json.load(f) for key, value in verbs.items(): ...
null
cogs/japanese.py
japanese.py
py
1,113
python
en
code
null
code-starcoder2
51
120979103
from django.shortcuts import render from functions import * def home(request): title = "Website" investReturn = roi(102) states = ["California", "Arizona", "Texas", "New York", "Washington DC"] agents = {"California": ["Tom Delaney", "Nick Gate", "Jim Morse"]} return render(request, 'home.html', {'title': title...
null
website/src/views.py
views.py
py
542
python
en
code
null
code-starcoder2
51
69783555
'''ALGORITIMO DE ORGANIZAÇÃO DE LISTAS''' def organizar(lista): '''PRIMEIRO LOOP ARMAZENAR O ITEM A SER COMPARADO NA VARIAVEL''' for x in range(len(lista)): item = x '''SEGUNDO LOOP A PARTIR DO INDICE DO PRIMEIRO LOOP + 1, ATÉ TAMANHO MAXIMO DA LISTA''' for y in range (x+1, len(...
null
semana4/organizar_lista.py
organizar_lista.py
py
854
python
en
code
null
code-starcoder2
51
152699955
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class TransferDetailResult(object): def __init__(self): self._account = None self._amount = None self._fund_desc = None self._instruction_id = None self._memo = ...
null
alipay/aop/api/domain/TransferDetailResult.py
TransferDetailResult.py
py
5,662
python
en
code
null
code-starcoder2
51
388208536
import sys import dbmanager.pf_metric_collection_manager import dbmanager.pf_device_collection_manager import dbmanager.pf_tags_collection_manager import dbmanager.pf_taguid_collection_manager import util.utils import libs.util.logger import libs.util.my_utils import util.calc_tag import ubc.pf_metric_helper from confi...
null
pf_calc_profile_device.py
pf_calc_profile_device.py
py
13,652
python
en
code
null
code-starcoder2
51
156588259
# Copyright 2017 reinforce.io. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
null
tensorforce/util/experiment_util.py
experiment_util.py
py
3,422
python
en
code
null
code-starcoder2
51
394744498
# -*- coding: utf-8 -*- # Copyright 2015 Mirantis, 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 requi...
null
nailgun/nailgun/orchestrator/graph_visualization.py
graph_visualization.py
py
4,722
python
en
code
null
code-starcoder2
51
90584748
from os import path from ci.tests.base import BaseTestCase import ci.container_index.lib.state as index_ci_state SETUP_PACKAGES = False DUMMY_INDEX_FILE = "./test.yaml" class IndexCIBase(BaseTestCase): node = "controller" def _setup_test(self): """Setup the requirements for test""" # Setup...
null
ci/tests/test_00_unit/test_00_index_ci/indexcibase.py
indexcibase.py
py
562
python
en
code
null
code-starcoder2
51
68451653
from asyn import launch from uasyncio import sleep_ms from homie.constants import FALSE, PUBLISH_DELAY, SET, SLASH, TRUE from homie.device import await_ready_state class HomieNode: def __init__(self, id, name, type): self.id = id self.name = name self.type = type self._properties ...
null
homie/node.py
node.py
py
2,963
python
en
code
null
code-starcoder2
51
403547842
import sys import requests # 上層目錄import sys.path.append(".") class Weather: def __init__(self): self.location_name: str = "" # 風向,單位 度,一般風向 0 表示無風 self.wind_direction: str = "" # 風速,單位 公尺/秒 self.wind_speed: int = 0 # 小時最大陣風風速,單位 公尺/秒 self.h_fx: int = 0 ...
null
project/weather/main.py
main.py
py
1,932
python
en
code
null
code-starcoder2
51
622528561
""" Utility functions that operate on landlab grids. ------------------------------------------------ """ import numpy as np from six.moves import range def resolve_values_on_active_links(grid, active_link_values): """Resolve active-link values into x and y directions. Takes a set of values defined on act...
null
landlab/grid/grid_funcs.py
grid_funcs.py
py
5,904
python
en
code
null
code-starcoder2
51
351220660
from bs4 import BeautifulSoup from mobile_extractor import * import urllib import csv import urllib.request from city_calc import * def innerHTML(element): return element.decode_contents(formatter="html") def get_name(body): return body.find('span', {'class':'jcn'}).a.string def get_phone_number(body): try: ...
null
SIH_Final-master/jd_scraper_hospital.py
jd_scraper_hospital.py
py
2,253
python
en
code
null
code-starcoder2
51
516169946
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Copyright (c) 2016 Борис Макаренко Данная лицензия разрешает лицам, получившим копию данного программного обеспечения и сопутствующей документации (в дальнейшем именуемыми «Программное Обеспечение»), безвозмездно использовать Программное Обеспечение без ограничений, в...
null
gostcryptogui/gui.py
gui.py
py
15,350
python
en
code
null
code-starcoder2
51
464627774
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Copyright © 2014 German Neuroinformatics Node (G-Node) All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted under the terms of the BSD License. See LICENSE file in the root of the Project. Author: J...
null
docs/source/examples/regularlySampledData.py
regularlySampledData.py
py
2,106
python
en
code
null
code-starcoder2
51
299554347
import os import torch import logging import Filesystem START_SENTENCE_TOKEN = "[CLS]" END_SEP_TOKEN = "[SEP]" def compute_sentence_dBert_vector(model, tokenizer, sentence_text): toks = tokenizer.tokenize(START_SENTENCE_TOKEN + sentence_text + END_SEP_TOKEN) indices = tokenizer.convert_tokens_to_ids(toks) ...
null
VocabularyAndEmbeddings/EmbedWithDBERT.py
EmbedWithDBERT.py
py
1,253
python
en
code
null
code-starcoder2
51
49902436
#!/usr/bin/env python """ Testing k-means clustering for purely random and normally distributed data """ import os import math import random from numpy import array, random as numpy_random from ase.data import chemical_symbols from kmeans import Point, kmeans, k_from_n from element_groups import get_element_group from...
null
tutorials/simple_data_mining/sample_kmeans.py
sample_kmeans.py
py
2,672
python
en
code
null
code-starcoder2
51