id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
9625916 | # coding=utf-8
#
# @lc app=leetcode id=137 lang=python
#
# [137] Single Number II
#
# https://leetcode.com/problems/single-number-ii/description/
#
# algorithms
# Medium (46.72%)
# Likes: 937
# Dislikes: 266
# Total Accepted: 177.4K
# Total Submissions: 378.1K
# Testcase Example: '[2,2,3,2]'
#
# Given a non-empt... | StarcoderdataPython |
4824089 | <filename>src/opnsense/scripts/suricata/lib/metadata.py<gh_stars>1-10
"""
Copyright (c) 2015 <NAME>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code ... | StarcoderdataPython |
4896638 | from test.test_utilities import parse_node_combo_template_yaml_file
fileName = "npm-coverage-validation-xunit-cobertura.yml"
contents = parse_node_combo_template_yaml_file(fileName)
steps = contents["steps"]
parameters = contents["parameters"]
npmInstallParameters = parameters["npmInstall"]
runNpmEnforceCoverageScript... | StarcoderdataPython |
1881173 | <filename>feature_extraction/src/2_graph_analysis/main_freq_subgraph_plotter.py
import os
import sys
sys.path.insert(1, '../src')
import numpy as np
import networkx as nx
def generateNXGraphLite(adj_mat):
x = nx.from_numpy_matrix(adj_mat)
return x
if len(sys.argv) != 2:
raise Exception(
'This ... | StarcoderdataPython |
9685154 | # <NAME>
# 08/09/2020
# Purpose: The purpose of the program is to allow the user to control the movements of the turtle, using the turtle module
import turtle # imports turtle module
def square(shashank): # defines new function called square
shashank.color("green yellow") # sets turtle color to Green Yello... | StarcoderdataPython |
1686198 | <reponame>talon-one/talon_one.py
# coding: utf-8
"""
Talon.One API
The Talon.One API is used to manage applications and campaigns, as well as to integrate with your application. The operations in the _Integration API_ section are used to integrate with our platform, while the other operations are used to mana... | StarcoderdataPython |
3571748 | <filename>sfrmaker/test/test_utils.py
# TODO: add unit tests for utils.py
import numpy as np
import pytest
from sfrmaker.utils import (assign_layers, width_from_arbolate_sum,
arbolate_sum, make_config_summary)
def test_assign_layers(shellmound_sfrdata, shellmound_model):
layers, new_bo... | StarcoderdataPython |
3532991 | from core.template_parser.template import Template
| StarcoderdataPython |
92538 | from tg_bot.handlers import (
start,
registration,
info,
main_menu,
schedule,
attestation,
suburbans,
editor,
rate,
other_text,
inline_handlers
)
| StarcoderdataPython |
6467417 | <reponame>Cyxapic/fb_client
# класс пользовательского интерфеса
import sys
from PyQt5 import QtWidgets, QtGui
from fb_client.accounts.account import UserManager
from fb_client.core.handlers import GuiReciever
from fb_client.protocol.jim import Messages
from fb_client.utils.utils import get_path
from .ui_files.client... | StarcoderdataPython |
9791473 | from .cache import EvieeLRU
from .core import *
from .errors import *
from .paginators import *
from .time import UserFriendlyTime
from .fuzzy import finder as fuzzyfinder
from .string import StringParser
| StarcoderdataPython |
357997 | <filename>feature_extraction/mfeature_extractor.py
# This file is part of me-features-to-mol-ID-mapping.
#
#
# Copyright © 2021 Blue Brain Project/EPFL
#
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the APACHE-2 License.
#
# This program is distributed in the hope tha... | StarcoderdataPython |
3588793 | """
Short Gallery of examples
for meshpy
written by <NAME>
"""
import numpy as np
import jw_meshtools as mt
import meshpy.triangle as triangle
import numpy.linalg as la
length = 0.3
# Simple mesh rectangle
p, v = mt.RectangleSegments([-1, -1], [2.5, 3], edge_length=length)
mt.DoTriMesh(p, v, edge_length=length)
... | StarcoderdataPython |
12864715 | # Copyright (c) 2021 kamyu. All rights reserved.
#
# Google Code Jam 2014 Round 2 - Problem A. Data Packing
# https://codingcompetitions.withgoogle.com/codejam/round/0000000000432fed/0000000000432b8d
#
# Time: O(NlogN)
# Space: O(1)
#
def data_packing():
N, X = map(int, raw_input().strip().split())
S = map(in... | StarcoderdataPython |
6683505 | <gh_stars>1000+
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Copyright 2010 California Institute of Technology. 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 obt... | StarcoderdataPython |
228986 | <reponame>acse-hg2917/DDGAN_buildings
#%%
import numpy as np
import matplotlib.pyplot as plt
from sklearn.metrics import mean_squared_error
# from nirom_dd_orig import plot_starshape
save_bf = False
snapshots_matrix_1 = np.load('snapshots/snapshots_pod_0709.npy')
snapshots_matrix_2 = np.load('snapshots/snapshots_pod.... | StarcoderdataPython |
11348299 | #!/usr/bin/env python
# encoding: utf-8
from ostn02python.OSGB import parse_grid, grid_to_ll
from ostn02python.OSTN02 import OSGB36_to_ETRS89
import six
def OSGB36GridRefToETRS89(mapRef):
if len(mapRef) < 4:
raise ValueError("Map ref too short")
if len(mapRef) % 2 == 1:
six.print_(ValueError("Unexpected input... | StarcoderdataPython |
3561690 | """
Meta social community views
"""
from io import BytesIO
from PIL import Image
from django.http import Http404
from simple_search import search_filter
from django.shortcuts import render, get_object_or_404, redirect, HttpResponseRedirect
from django.forms import modelformset_factory
from django.core.files.base impo... | StarcoderdataPython |
9748102 | <gh_stars>1-10
"""Library to connect with millheat open API"""
import json
import asyncio
import aiohttp
import logging
import urllib3
import async_timeout
from .errors import ApplyAuthCode, MillHeatSystem, MillHeatUds, AccessToken, RefreshToken, DeviceControlForOpenApi
urllib3.disable_warnings(urllib3.exceptions.Ins... | StarcoderdataPython |
8129946 | <reponame>thatscotdatasci/aws-lambda-hello-world
from helloworld.message import Message
def lamdba_handler(event, context):
my_hello_world = Message(event['first_name'], event['last_name'])
return {'message': my_hello_world.message}
| StarcoderdataPython |
1995829 | # This file is part of siti_tools
#
# MIT License
#
# siti_tools, Copyright (c) 2021 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation... | StarcoderdataPython |
5067694 | import pandas as pd
import numpy as np
class BBS:
""" Block bootstrap irregularly-spaced time-series data
"""
def __init__(self, timeseries, block_length=100, freq='D'):
"""
Parameters
----------
timeseries : pandas.Series or DataFrame
Time-indexed data series t... | StarcoderdataPython |
8063037 | #!/usr/bin/env python
import math
import features
def get_entropy_hash(feature_list,data):
to_return = {}
for f in feature_list:
x = get_entropy(f, data)
to_return[x] = f
return to_return
def create_majority_label(data):
majority_label = None
labels = {}
for i in ... | StarcoderdataPython |
3334396 | from datetime import datetime
import unittest
from unittest import mock
from domain.model.track import PlaylistTrack, Track
from persistence.model import db
from persistence.model.user_playlist import UserPlaylistDataModel
from persistence.model.playlist import PlaylistInfoDataModel
from persistence.model.playlist_tra... | StarcoderdataPython |
6599781 | <reponame>SofianeLeCubeur/ColorClassifier
from keras.models import load_model
import numpy as np
from colour import Color
model = load_model('training.h5')
line = ""
print("Write 'quit' to stop")
while True:
line = input(":")
if line.lower() == "quit":
break
else:
try:
c = Colo... | StarcoderdataPython |
186185 | <reponame>josephramsay/LDS
'''
v.0.0.9
LDSReplicate - ConfigWrapper
Copyright 2011 Crown copyright (c)
Land Information New Zealand and the New Zealand Government.
All rights reserved
This program is released under the terms of the new BSD license. See the
LICENSE file for more information.
Created on 23/07/2012
... | StarcoderdataPython |
11239724 | from django.conf.urls.static import static
from django.shortcuts import render
from django.views.generic import TemplateView
from django.http import HttpResponse
from django.views import View
from .forms import SearchCompanyForm, FindCusipForm
from static.py import process13Fdata
# Create your views here.
class... | StarcoderdataPython |
1668727 | __version__ = '0.93.3'
| StarcoderdataPython |
3307701 | <reponame>khjxiaogu/spotify-downloader<filename>spotdl/tests/test_config.py
import spotdl.config
import argparse
import os
import sys
import yaml
import pytest
@pytest.mark.xfail
@pytest.fixture(scope="module")
def config_path(tmpdir_factory):
config_path = os.path.join(str(tmpdir_factory.mktemp("config")), "con... | StarcoderdataPython |
3588376 | # Copyright 2018 <NAME>
#
# 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 agreed to in writing, softw... | StarcoderdataPython |
5089921 | '''
LICENSED under Apache 2.0 (http://directory.fsf.org/wiki/License:Apache2.0)
Created by: <NAME> (Research Assistant, Aalto University)
<NAME> (Project Researcher, Aalto University)
<NAME>
February, 2020
'''
from tkinter import *
import time
import json
# ---------------------------------------------... | StarcoderdataPython |
4937533 | <filename>wootric.py
import os, requests, json, dateparser, time, yaml, boto3, slack, random
from typing import List
from pathlib import Path
from pprint import pprint
from traceback import format_exc
from missing_data import get_missing_responses, get_missing_users
BATCH_SIZE = 500
wootric_session = requests.Sess... | StarcoderdataPython |
11285055 | # 리스트 길이와 무관 O(1)
L = ["Bob", "Cat", "Spam", "Programmers"]
print(L[1])
print(L[-2])
L.append("New")
res = L.pop()
# 원소 추가 O(N)
target = 65
L = [20, 37, 58, 72, 91]
for i in range(len(L)):
if L[i] >= 65:
L.insert(i, target)
break
print(L)
# 원소 삭제 O(N)
target = 58
for i in range(len(L)):
if L... | StarcoderdataPython |
4853209 | <reponame>sulaymandesai/pyUSID
"""
================================================================================
02. The USIDataset
================================================================================
**<NAME>**
11/11/2017
**This document illustrates how the pyUSID.USIDataset class substantially simpl... | StarcoderdataPython |
3552849 | <gh_stars>1-10
from django.shortcuts import render,redirect
from django.contrib import messages
from django.contrib.auth.models import User
from django.contrib import auth
from auctionItem.models import Contact,Wishlist
# Create your views here.
def register(request):
if request.method =='POST':
# messag... | StarcoderdataPython |
5005801 | from gamechangerml.src.utilities.utils import *
from gamechangerml.src.utilities.aws_helper import *
from gamechangerml import REPO_PATH
import os
import sys
topic_model_dir=os.path.join(
REPO_PATH,
"gamechangerml/models/topic_models/models/"
)
os.chdir(topic_model_dir)
s3_models_dir = "models/topic_models/"
... | StarcoderdataPython |
3342521 | <reponame>ClownMonster/StockPrediction_MLmodel_python
import pandas as pd
import matplotlib
matplotlib.use('Agg')
#import matplotlib.pyplot as plt
import plotly.express as px
from ProcessedDataframe import trainData , testData
# reading the train data into df_train
df_train = trainData()
######################... | StarcoderdataPython |
192969 | <gh_stars>1-10
# Little Vasya has received a young builder’s kit. The kit consists of several wooden bars, the lengths
# of all of them are known. The bars can be put one on the top of the other if their lengths are the same.
# Vasya wants to construct the minimal number of towers from the bars. Help Vasya to use the b... | StarcoderdataPython |
11382441 | import clip
import os
import torch
import numpy as np
from PIL import Image
class Accuracy():
def __init__(self, TP=0, FP=0, FN=0) -> None:
self.TP = TP
self.FP = FP
self.FN = FN
def __getitem__(self, key):
# We use the getattr() function to get the attribute of an object.
... | StarcoderdataPython |
148338 | <gh_stars>1-10
from collections import defaultdict
from queue import PriorityQueue
from binteger import Bin
from divprop import Sbox
import logging
def half_lens(fset, n):
l = sum(1 for i in fset if i < n)
r = len(fset) - l
return l, r
class SboxPeekANFs:
"""
Advanced algorithm for DivCore co... | StarcoderdataPython |
8151207 | from unittest.mock import patch
from django.test import TestCase, override_settings
from django.test.client import Client
try:
from django.core.urlresolvers import reverse_lazy
except ImportError:
from django.urls import reverse_lazy
from django.contrib.auth.models import User
from .decorators import override... | StarcoderdataPython |
9694907 | <gh_stars>10-100
# Copyright 2020 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2... | StarcoderdataPython |
6430411 | <reponame>openclimatefix/graph_weather
"""Model for forecasting weather from NWP states"""
import torch
from huggingface_hub import PyTorchModelHubMixin
from graph_weather.models import Decoder, Encoder, Processor
class GraphWeatherForecaster(torch.nn.Module, PyTorchModelHubMixin):
"""Main weather prediction mod... | StarcoderdataPython |
5185743 | # coding=utf-8
"""Unit tests of the _events.Event class."""
from ..event import Event
def test_event_create():
"""Test creating an event object."""
event = Event(event_id='0000',
event_type='event_type')
assert event.id == '0000'
assert event.type == 'event_type'
| StarcoderdataPython |
5160824 | env = {'WITH_DATA_DUMPING': '0', 'WITH_DEBUG': '0', 'WITH_OPENMP': '0'}
| StarcoderdataPython |
4976620 | # Problem : https://leetcode.com/problems/string-to-integer-atoi/
# Solution: https://github.com/tjzhym/LeetCode-solution
# Author : zhym (tjzhym)
# Date : 2021-7-24
class Solution:
def myAtoi(self, s: str) -> int:
stringList = s.strip()
answer = 0
if len(stringList) == 0:
... | StarcoderdataPython |
6695803 | #!/usr/bin/env python
from google.protobuf.json_format import MessageToJson
from tensorflow.core.framework import graph_pb2
graph_def = graph_pb2.GraphDef()
# to JSON
with open("vgg16_tf.pb", "rb") as pb:
graph_def = pb
tf_json = MessageToJson(graph_def)
with open("vgg16_tf.json", "w") as output:
... | StarcoderdataPython |
9773046 | # Given a string with length > 1, return true if the first 2 chars in the string also appear at the end of the string
# (ignore case)
# for more info on this quiz, go to this url: http://www.programmr.com/front-again-2
def front_end(x_str):
if len(x_str) > 1:
if x_str[:2] == x_str[-2:]:
retur... | StarcoderdataPython |
9797314 | <reponame>zhiyanliu/riverrun
import os
# Income metadata frame
METADATA_FRAME_SERVER_PORT_ENV_VAR_NAME = "METADATA_FRAME_SERVER_PORT"
METADATA_FRAME_SUBSCRIBE_TOPIC_ENV_VAR_NAME = "METADATA_FRAME_SUBSCRIBE_TOPIC"
METADATA_FRAME_TAKE_TYPE_ENV_VAR_NAME = "METADATA_FRAME_TAKE_TYPE"
METADATA_FRAME_TAKE_TYPE_SUBSCRIBE = "... | StarcoderdataPython |
52691 | from discord import Client
from discord.ext import tasks
from configurationparser import ConfigurationParser
from message import Message
import asyncio, logging, random, time
logger = logging.getLogger(__name__)
HELP='''```
Usage:
&help - show this help page
&start [author_id] - start sending mes... | StarcoderdataPython |
143420 | from __future__ import division, print_function
import os, types
import numpy as np
import vtk
from vtk.util.numpy_support import numpy_to_vtk
from vtk.util.numpy_support import vtk_to_numpy
import vtkplotter.colors as colors
##############################################################################
vtkMV = vtk.v... | StarcoderdataPython |
4909691 | <filename>spiro/config.py
import json
import os
import sys
def log(msg):
sys.stderr.write(msg + '\n')
sys.stderr.flush()
class Config(object):
defaults = {
'calibration' : 8, # number of steps taken after positional sensor is lit
'sensor': 4, # pin for mini microswitch positiona... | StarcoderdataPython |
6465393 | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
import pss_entity as entity
# ---------- Constants ----------
MISSION_DESIGN_BASE_PATH = 'MissionService/ListAllMissionDesigns2?languageKey=en'
MISSION_DESIGN_KEY_NAME = 'MissionDesignId'
MISSION_DESIGN_DESCRIPTION_PROPERTY_NAME = 'MissionTitle'
# ---------... | StarcoderdataPython |
1648953 | <gh_stars>10-100
#/******************************************************************************
# * Copyright (c)2012 <NAME> <<EMAIL>> *
# * *
# * This file is part of the FreeCAD CAx development system. *
# * *
# * This library is free software; you can redistribute it and/or *
# * modify it under the terms of the G... | StarcoderdataPython |
1724797 | from dae.common_reports.denovo_report import \
DenovoReportTable, \
DenovoReport, \
EffectRow, \
EffectCell
def test_denovo_report_table(denovo_variants_ds1, phenotype_role_collection):
denovo_report_table = DenovoReportTable(
denovo_variants_ds1,
["Missense", "Splice-site"],
... | StarcoderdataPython |
8009931 | #Import relevant modules
import pandas as pd
import matplotlib.pyplot as plt
#Define variables filename and genename
filename = 'gene_rpkm_report_fb_2019_02.tsv'
genename = 'FBgn0031681'
#Read in tsv file as pandas csv
#skip first 5 rows and tab delineate
df = pd.read_csv(filename, skiprows=5, sep='\t')
#Drop rows... | StarcoderdataPython |
3451686 | __copyright__ = "Copyright 2017-2018, http://radical.rutgers.edu"
__author__ = "<NAME> <<EMAIL>>"
__license__ = "MIT"
# -----------------------------------------------------------------------------
# Possible states
INITIAL = 'DESCRIBED'
SCHEDULING = 'SCHEDULING'
SCHEDULED = 'SCHEDULED'
SUBMITTING = 'SUBMITTING'
SUBM... | StarcoderdataPython |
1793543 | #!/usr/bin/env python
"""
Copyright (c) 2015, <NAME> <<EMAIL>>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTH... | StarcoderdataPython |
8153728 | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE.txt in the project root for
# license information.
# -------------------------------------------------------------------------
import os
... | StarcoderdataPython |
6638254 | <filename>PyISY/Programs/__init__.py
from ..constants import _empty_time
from datetime import datetime
from .folder import Folder
from .program import Program
from ..Nodes import NodeIterator as ProgramIterator
from time import sleep
from xml.dom import minidom
class Programs(object):
"""
This clas... | StarcoderdataPython |
11223092 |
# Discord でメッセージを送信する
import os
import requests
import json
class Discord:
def __init__(self, webhook_url):
self.webhook_url = webhook_url
# print(self.webhook_url)
# メッセージを送信する
def send_message(self, message, image = None):
url = self.webhook_url
headers = {
... | StarcoderdataPython |
8096321 | """
GFG Site
Python Program for Maximum height when coins are arranged in a triangle
We have N coins which need to arrange in form of a triangle, i.e. first row will have 1 coin,
second row will have 2 coins and so on, we need to tell maximum height which we can achieve by using these N coins.
Input : N = 7
Output : ... | StarcoderdataPython |
8170652 | """
Objective-C runtime wrapper for use by LLDB Python formatters
Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
See https://llvm.org/LICENSE.txt for license information.
SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
"""
import lldb.formatters.metrics
class Cache:
def __... | StarcoderdataPython |
3520903 | <gh_stars>1-10
from cobrakbase.core.kbasegenome.pangenome import KBasePangenome | StarcoderdataPython |
3418705 |
class Rect:
def __init__(self, x, y, width, height):
self.x = x
self.y = y
self.width = width
self.height = height
def __str__(self):
return str("Rect(%s,%s,%s,%s)" % (
self.x, self.y, self.width, self.height))
def __eq__(self, obj):
return (sel... | StarcoderdataPython |
3452745 | import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
import dash_daq as daq
import dash_bootstrap_components as dbc
import numpy as np
import pandas as pd
import logging
import plotly.graph_objs as go
import plotly.express as px
import lay... | StarcoderdataPython |
11266021 | <reponame>faezs/plotly.py<filename>plotly/validators/histogram2d/_ybins.py<gh_stars>1-10
import _plotly_utils.basevalidators
class YBinsValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(
self, plotly_name='ybins', parent_name='histogram2d', **kwargs
):
super(YBinsValidat... | StarcoderdataPython |
5179616 | <reponame>sideshowbrian/Denver_Weather_Scrap
# -*- coding: utf-8 -*-
"""
Created on May 21, 2020
Working May 21, 2020
@author: brian
"""
from bs4 import BeautifulSoup
import datetime
#from urllib2 import urlopen
import requests
def weather():
#7news site
kdvr_news = "https://kdvr.com/weather/"
# query th... | StarcoderdataPython |
5083779 | <filename>qdarkstyle/pyqt_style_rc.py
# -*- coding: utf-8 -*-
# Resource object code
#
# Created by: The Resource Compiler for PyQt4 (Qt v4.8.7)
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore
qt_resource_data = b"\
\x00\x00\x11\x2d\
\x00\
\x00\x5f\x67\x78\x9c\xc5\x1c\x6b\x73\xd3\xb... | StarcoderdataPython |
1676450 | # -*- encoding: utf-8 -*-
import requests
from django.conf import settings
from django_q.tasks import async
from djmail.template_mail import InlineCSSTemplateMail
def send_djmail(to, service_name, tp, value, grace, msg):
o = InlineCSSTemplateMail('alert')
o.send(to, {
'service_name': service_name,
... | StarcoderdataPython |
8095149 | <gh_stars>1-10
from __future__ import absolute_import
import datetime
from .config import conf
class Site(object):
__instances = {}
def __new__(cls, name):
x = cls.__instances.get(name)
if x is None:
x = object.__new__(cls)
cls.__init__(x, name)
cls.__instances[name] = x
return x
def __init__(sel... | StarcoderdataPython |
5014586 | <reponame>tersesystems/blacklite
#!/usr/bin/env python3
from sqlite_utils import Database
import time
import json
import os.path
import click
import zstandard as zstd
from typing import ByteString
@click.command()
@click.argument("dbpath", default="../data/blacklite.db")
def main(dbpath):
"""Reads data from blac... | StarcoderdataPython |
1974598 | <reponame>SamvitJ/Accel<gh_stars>10-100
# --------------------------------------------------------
# Accel
# Copyright (c) 2019
# Licensed under the MIT License [see LICENSE for details]
# Modified by <NAME>
# --------------------------------------------------------
import cPickle
import mxnet as mx
from utils.symbol ... | StarcoderdataPython |
6578372 | <filename>Python3/0134-Gas-Station/soln.py
class Solution:
def canCompleteCircuit(self, gas, cost):
"""
:type gas: List[int]
:type cost: List[int]
:rtype: int
"""
if sum(cost) > sum(gas): return -1
start, accumulate = 0, 0
for i, (g, c) in enumerate(zi... | StarcoderdataPython |
8130289 | ''' bella domanda ''' | StarcoderdataPython |
6545967 | import pandas as pd
import matplotlib
from matplotlib import pyplot as plt
appl = pd.read_csv('aapl.csv', index_col='date', parse_dates=True)
close_series = appl['close']
print(type(close_series))
plt.plot(close_series)
plt.show()
#we can use the same plot as the same
close_series.plot() #plots series directly
plt.... | StarcoderdataPython |
9773620 | from django.forms import ModelForm, inlineformset_factory
from . import models
class ParentForm(ModelForm):
"""
Форма Родителя
"""
class Meta:
model = models.Parent
fields = "__all__"
# exclude = ['']
class SportsmanForm(ModelForm):
"""
Форма спортсмена
"""
... | StarcoderdataPython |
9655111 | <reponame>Garyfallidis/dipy
"""Create a unit sphere by subdividing all triangles of an octahedron
recursively.
The unit sphere has a radius of 1, which also means that all points in this
sphere (assumed to have centre at [0, 0, 0]) have an absolute value (modulus)
of 1. Another feature of the unit sphere is that the u... | StarcoderdataPython |
9663500 | import nltk
nltk.download('brown')
nltk.download('names')
nltk.download('wordnet')
nltk.download('averaged_perceptron_tagger')
nltk.download('universal_tagset')
| StarcoderdataPython |
9620033 | # coding: utf-8
#########################################################################
# 网站: <a href="http://www.crazyit.org">疯狂Java联盟</a> #
# author yeeku.H.lee <EMAIL> #
# #
# version 1.0 ... | StarcoderdataPython |
4873360 | #!/usr/bin/env python3
import time
import socket
from lib.tuntap import TunThread
from lib import dns
from lib import query
from lib.packet import Packet
from lib.connection import Connection, ConnectionPool
from lib.resolv import get_resolv_conf
addr = get_resolv_conf()['nameserver'][0]
hostname = b'vpn.bgpat.net'
q... | StarcoderdataPython |
3206309 | from selenium import webdriver
from bs4 import BeautifulSoup
import time
import pickle
import os
driver = webdriver.Chrome('D:\py\chromedriver_win32\chromedriver.exe')
link_list = []
link_list_v = []
#load profile links from file links.txt
if os.path.getsize('links.txt') > 0:
with open('links.txt', 'rb') as fp:
l... | StarcoderdataPython |
1851940 | # str(bytes, encoding='ascii', errors='ignore')
bytes = bytes('pythôn', encoding='utf-8')
print(str(bytes, encoding='ascii', errors='ignore'))
# see issue https://github.com/brython-dev/brython/issues/1060
| StarcoderdataPython |
6643821 | from django.shortcuts import render, get_object_or_404
from bio.guide import models
def guides(request):
guides = models.Guide.objects.all()
return render(request, 'bio/guides.html', {
'meta': models.Guide._meta,
'guides': guides
})
def guide(request, guide_id):
guide = get_object_or... | StarcoderdataPython |
208928 | from neat.reporting import BaseReporter
class FunctionReporter(BaseReporter):
def __init__(self, handle):
self._handle = handle
def end_generation(self, config, population, species_set):
self._handle()
| StarcoderdataPython |
3479919 | """
Program za generiranje priznanj za sodelovanje na tekmovanju v programiranju
z delčki Pišek.
Ta program je prilagojen za pyinstaller bundle s katerim naredimo izvršljivo
.exe datoteko. To pomeni, da so poti zunanjih datotek nastavljene tako, da so
v isti mapi kot samostojni .exe, ki ga zgenerira pyinstaler.
Zunan... | StarcoderdataPython |
9614905 | from flask import render_template
from app import app
@app.route('/')
@app.route('/home')
def home():
movie = []
" Add a Let's Get Started' button to redirect to input page"
return '''
<html>
<head>
<title>Home Page - Recommender Evaluator</title>
</head>
<body>
... | StarcoderdataPython |
5130762 | <gh_stars>10-100
import pySurfaceHierarchy
from read_data import DataReader
import os
mesh_dir_path = "D:/data/MPI-FAUST_training/normalized/registrations"
mesh_name = "tr_reg_000"
output_path = "D:/data/MPI-FAUST_training/normalized/reg_dataset/"
top_level_size = 6890
level_size_factor = 1.0
start_level = 0
level_num ... | StarcoderdataPython |
12817107 | <filename>clubsandwich/generators.py
"""
Level generator utilities.
"""
import weakref
from math import floor
from random import randrange, choice
from .blt.nice_terminal import terminal
from .geom import Point, Rect, Size
from .draw import draw_rect
class BSPNode:
"""
Node in a binary space partitioning tr... | StarcoderdataPython |
3305746 | <reponame>kirang89/song-bot<gh_stars>1-10
#!/usr/bin/env python
#
# A Bot to download bollywood songs from the internet
# @author <NAME>
#
import requests
import sys
import os
from BeautifulSoup import BeautifulSoup
from progressbar import *
def movie_finder(base_url, movie_name):
found = False
movie_list_ur... | StarcoderdataPython |
11233307 | <reponame>casperkaae/parmesan
import lasagne
import theano.tensor as T
import numpy as np
class NormalizingPlanarFlowLayer(lasagne.layers.Layer):
"""
Normalizing Planar Flow Layer as described in Rezende et
al. [REZENDE]_ (Equation numbers and appendixes refers to this paper)
Eq. (8) is used for calcul... | StarcoderdataPython |
5071571 | from django.shortcuts import render, redirect, get_object_or_404
from django.views.generic import ListView, DetailView, DeleteView, UpdateView
from django import forms
from django.urls import reverse_lazy, reverse
from django.views import View
from django.contrib.auth import authenticate, login, logout
from django.cont... | StarcoderdataPython |
3402688 | <reponame>zsz00/single-shot-detector
import tensorflow as tf
@tf.contrib.framework.add_arg_scope
def depthwise_conv(
x, kernel=3, stride=1, padding='SAME',
activation_fn=None, normalizer_fn=None,
data_format='NCHW', scope='depthwise_conv'):
with tf.variable_scope(scope):
assert da... | StarcoderdataPython |
5196222 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import pytest
import html5lib
from packaging_repositories.entries import _parse_base_url
@pytest.mark.parametrize(
("html", "url", "expected"),
[
(b"<html></html>", "https://example.com/", "https://example.com/"),
(
b"<html><head>"
... | StarcoderdataPython |
9665194 | <gh_stars>0
# ---------------------------------------------------------------------------------------------------------------------
# scientific
import pandas as pd
import numpy as np
# ---------------------------------------------------------------------------------------------------------------------
# plotly
import ... | StarcoderdataPython |
4831655 | # coding=utf-8
# Copyright 2018 The TF-Agents Authors.
#
# 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... | StarcoderdataPython |
6578154 | # (c) 2019, NetApp, Inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
''' unit test template for ONTAP Ansible module '''
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
import pytest
from ansible_collections.netapp.on... | StarcoderdataPython |
9798528 | <reponame>pip-services3-python/pip-services3-aws-python
# -*- coding: utf-8 -*-
from pip_services3_commons.config import ConfigParams
from test.Dummy import Dummy
from test.containers.DummyLambdaFunction import DummyLambdaFunction
DUMMY1: Dummy = Dummy(None, 'Key 1', 'Content 1')
DUMMY2: Dummy = Dummy(None, 'Key 2', ... | StarcoderdataPython |
5030330 | <reponame>ahwind/django-todolist
# -*- coding: utf-8 -*-
from django.contrib.auth import authenticate,login as user_login,logout
from django.shortcuts import HttpResponseRedirect, render
from django.contrib import messages
from django.contrib.auth.decorators import login_required
@login_required
def Logout(request):
... | StarcoderdataPython |
1623090 | import os
import json
import luigi
from . import check_components as component_tasks
from ..cluster_tasks import WorkflowBase
from ..paintera import unique_block_labels as unique_tasks
from ..paintera import label_block_mapping as mapping_tasks
from ..utils import volume_utils as vu
# TODO fail if check does not pas... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.