id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
11232064 | from . import layers, models
from .models import vpnn
| StarcoderdataPython |
1709665 | <filename>just4me/websites/albertsons.py<gh_stars>1-10
from just4me.websites.vons import Vons
# Albertson's site is the same as Vons but just different urls
class Albertsons(Vons):
site_name = "Albertsons"
coupon_program_name = "just4U"
home_url = 'https://www.albertsons.com/'
login_url = 'https://ww... | StarcoderdataPython |
3462451 | import chess
import chess.pgn
import PySimpleGUI as sg
from io import StringIO
def main():
defaulttheme = 'DarkGrey8'
themes = ['DarkBlue3', 'DarkAmber', 'DarkBlack1', 'DarkBlue', 'DarkBlue14', 'DarkBlue2',
'DarkBrown2', 'DarkBrown5', 'DarkGreen3', 'DarkGreen4', 'DarkGreen5', 'DarkGreen7',
... | StarcoderdataPython |
90803 | from rpython.rlib import jit
from rpython.rlib.cache import Cache
from rpython.rlib.objectmodel import specialize, import_from_mixin
from rsqueakvm.util.version import Version
class QuasiConstantCache(Cache):
def _build(self, obj):
class NewQuasiConst(object):
import_from_mixin(QuasiConstantM... | StarcoderdataPython |
11331467 | from .base_command import BaseProcessCommand
from blog.models import BlogIndexPage, BlogPage
class Command(BaseProcessCommand):
def handle(self, *args, **options):
self.output_start('Deleting blogs...')
blogs = BlogPage.objects.all()
for blog in blogs:
self.output_spinner(... | StarcoderdataPython |
12837251 | # stdlib
from typing import Any
# relative
from ...abstract.node import AbstractNodeClient
from ...enums import ResponseObjectEnum
from ..node_service.role_manager.role_manager_messages import CreateRoleMessage
from ..node_service.role_manager.role_manager_messages import DeleteRoleMessage
from ..node_service.role_man... | StarcoderdataPython |
1652489 | from typing import List
class Solution:
def threeSumClosest(self, nums: List[int], target: int) -> int:
nums.sort()
rev = [target - num for num in nums]
min_gap = 10 ** 5
total = 0
for pos in range(0, len(nums) - 2):
if nums[pos] == nums[pos - 1] and pos - 1 >= ... | StarcoderdataPython |
1931091 | # Copyright (c) 2020, <NAME>
# License: MIT License
import struct
from .const import *
from .crc import crc8
codepage_to_encoding = {
37: 'cp874', # Thai,
38: 'cp932', # Japanese
39: 'gbk', # UnifiedChinese
40: 'cp949', # Korean
41: 'cp950', # TradChinese
28: 'cp1250', # CentralEurope
... | StarcoderdataPython |
81293 | <reponame>saurabnigam/django-keycloak
# Generated by Django 2.2.12 on 2020-04-21 18:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('django_keycloak', '0006_remove_client_service_account'),
]
operations = [
migrations.AddField(
... | StarcoderdataPython |
1694048 | <gh_stars>100-1000
# Copyright 2019 Xiaomi, Inc. 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 b... | StarcoderdataPython |
287947 | """
Test cases for the regi0.geographic.outliers._is_std_outlier function.
"""
import numpy as np
import pytest
from regi0.geographic.outliers import _is_std_outlier
@pytest.fixture()
def values():
return np.array([52, 56, 53, 57, 51, 59, 1, 99])
def test_std(values):
result = _is_std_outlier(values)
e... | StarcoderdataPython |
215881 | #!/usr/bin/env python3
import argparse
import collections
import re
import os
ErrorItem = collections.namedtuple('ErrorItem', ['path', 'line', 'col', 'msg'])
def load_error_items(file):
# path:line:col: error: msg
re_error = re.compile(r'(.+)\:(\d+)\:(\d+)\: error\: (.+)')
items = []
with open(file,... | StarcoderdataPython |
1764516 | import os
import re
from oelint_parser.cls_item import Variable
from oelint_adv.cls_rule import Rule
class VarDependsOrdered(Rule):
def __init__(self):
super().__init__(id="oelint.vars.dependsordered",
severity="warning",
message="'{VAR}' entries should b... | StarcoderdataPython |
12811692 | import torch
from .audio_zen.acoustics.feature import mag_phase
from .audio_zen.acoustics.mask import decompress_cIRM
from .audio_zen.inferencer.base_inferencer import BaseInferencer
def cumulative_norm(input):
eps = 1e-10
device = input.device
data_type = input.dtype
n_dim = input.ndim
assert n... | StarcoderdataPython |
1667566 | import shutil
import os
import numpy as np
def mkdir(path, reset=False):
"""Checks if directory exists and if not, create one.
Parameters
----------
reset: erase the content of the directory if exists
Returns
-------
the path
"""
if reset and os.path.exists(path):
shutil.... | StarcoderdataPython |
274179 | import logging
import os
import uuid
import string
import random
from django.core.files.storage import FileSystemStorage
from django.conf import settings
from django.core.cache import cache
from django_tus.response import TusResponse
logger = logging.getLogger(__name__)
class FilenameGenerator:
def __init__(se... | StarcoderdataPython |
2621 | <filename>code_doc/views/author_views.py
from django.shortcuts import render
from django.http import Http404
from django.views.generic.edit import UpdateView
from django.views.generic import ListView, View
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django... | StarcoderdataPython |
6636385 | #!/usr/bin/python3
import time
import zmq
import sys
if len(sys.argv) < 2:
print ("Usage {} NUM_NODES".format(sys.argv[0]))
exit(-1)
num_nodes = int(sys.argv[1])
base_port = int(sys.argv[2])
if num_nodes < 1 or num_nodes > 9:
print("Num nodes is of range (0 > num_nodex > 10)")
exit(-1)
context = ... | StarcoderdataPython |
6529664 | import numpy as np
import matplotlib.pyplot as plt
data = [[5., 25., 50., 20.],
[4., 23., 51., 17.],
[6., 22., 52., 19.]]
X = np.arange(4)
plt.bar(X + 0.00, data[0], color = 'b', width = 0.25)
plt.bar(X + 0.25, data[1], color = 'g', width = 0.25)
plt.bar(X + 0.50, data[2], color = 'r', width = 0.25)
plt.show() | StarcoderdataPython |
132349 | num1=10
num2=20
num3=300
num3=30
num4=40
| StarcoderdataPython |
8040659 | import os
import logging
import ray
from ray import serve
from fastapi import FastAPI
app = FastAPI()
logging.basicConfig(level='INFO')
ray.init(address=os.getenv('RAY_ADDRESS', 'auto'), namespace='serve', ignore_reinit_error=True)
serve.start(detached=True)
class APIDeployment:
message = "Hello from #{}!"
@se... | StarcoderdataPython |
6454533 | from html.parser import HTMLParser
from typing import NamedTuple
class HTMLLinkParser(HTMLParser):
def __init__(self):
super().__init__()
self.hrefs = []
def handle_starttag(self, tag: str, attrs: NamedTuple) -> None:
"""
Filter out the <a> tags and add the href value to the h... | StarcoderdataPython |
3549795 | <gh_stars>0
def Int(s):
try:
a = int(s)
return a
except ValueError:
return -1
f = open("day07.txt")
f = f.readlines()
reg = []
for i in range(len(f)):
line_array = f[i].split()
reg.append([line_array[-1], -1, line_array[:-2]])
# reg.sort(key=lambda x: (len(x[2]), x[0]))
whil... | StarcoderdataPython |
6486152 | """Pattoo. Posting Routes."""
# Standard imports
import os
import json
import sys
from random import randrange
import hashlib
import uuid
# Flask imports
from flask import Blueprint, request, abort, session, jsonify
# pattoo imports
from pattoo_shared import log
from pattoo_shared.constants import CACHE_KEYS
from pa... | StarcoderdataPython |
9674125 | <filename>setup.py
import setuptools
import os
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
# I took it from catalyst setup.py https://github.com/catalyst-team/catalyst/blob/master/setup.py
def load_version():
context = {}
with open(os.path.join(PROJECT_ROOT, "np_draw_tools", "version.py")) as f... | StarcoderdataPython |
9748707 | <reponame>chris48s/UK-Polling-Stations<gh_stars>0
from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = 'E07000181'
addresses_name = 'parl.2017-06-08/Version 1/West Oxfordshire Democracy_Club__08June2017.tsv'
stati... | StarcoderdataPython |
9666588 | <reponame>benjaminrose/SNIa-Local-Environments
import pytest
import numpy as np
import fsps
import redoGupta
class TestRedoGupta():
""" Test running data
This function should be tested. The 4 month import bug was here. But I
combined too much. I can't test that it works, because calling this run my
a... | StarcoderdataPython |
1620192 | <gh_stars>0
# -*- coding: utf-8 -*-
# -- ==mymu_imports== --
#%% mymu_imports
import sys
sys.dont_write_bytecode = False
import numpy.random as rnd
import numpy as np
import pandas as pd
import os
import time
import glob
from collections import OrderedDict
import psychopy
import logging as dev_logging
reload(psychop... | StarcoderdataPython |
6590333 | <filename>Dictionary4.py
'''
Function Name : main()
Description : Variations On Dictionary
Function Date : 21 Mar 2021
Function Author : <NAME>
Input : Int
Output : Int
'''
def main():
Employee = {11 : {"Name" : "Prasad", "Age" : 30}, 21 : {"Name" : "Amar"... | StarcoderdataPython |
6582310 | <reponame>saulshanabrook/conda-store<gh_stars>0
from flask import (
Blueprint,
render_template,
request,
redirect,
Response,
url_for,
)
import pydantic
import yaml
from conda_store_server import api, schema
from conda_store_server.server.utils import get_conda_store, get_auth, get_server
from c... | StarcoderdataPython |
5125911 | <gh_stars>10-100
# Generated by Django 2.2.6 on 2020-01-07 00:08
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('vouchers', '0007_merge_20191028_1925'),
]
operations = [
migrations.AddField(
model_name='voucher',
... | StarcoderdataPython |
1840890 | # coding=utf-8
'''
Date:20160930
@author: zhaozhiyong
'''
import numpy as np
def load_data(file_path):
'''导入用户商品数据
input: file_path(string):用户商品数据存储的文件
output: data(mat):用户商品矩阵
'''
f = open(file_path)
data = []
for line in f.readlines():
lines = line.strip().split("\t")
tmp = []
for x in lines:
if x ... | StarcoderdataPython |
1642058 | <reponame>BORB-CHOI/AD-project<gh_stars>0
import sys
from PyQt5.QtQuick import QQuickView
from PyQt5.QtCore import QObject, QUrl
from windows.util import get_file_path
from windows.mainWindow import MainWindow
# setting path
sys.path.append('../')
FILE_NAME = '..\\ui\Login.ui.qml'
class LoginWindow(QQuickView):... | StarcoderdataPython |
3516143 | <reponame>liranpeng/E3SM-2CRM<filename>components/mpas-source/testing_and_setup/compass/ocean/global_ocean/QU240wISC/init/define_base_mesh.py
#!/usr/bin/env python
"""
% Create cell width array for this mesh on a regular latitude-longitude grid.
% Outputs:
% cellWidth - m x n array, entries are desired cell width in... | StarcoderdataPython |
9785291 | <reponame>twsl/lightning-flash<filename>tests/tabular/forecasting/test_model.py<gh_stars>0
# Copyright The PyTorch Lightning team.
#
# 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... | StarcoderdataPython |
3322263 | <gh_stars>1-10
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sb
from sklearn.cluster import KMeans
from sklearn.metrics import pairwise_distances_argmin_min
from sklearn import preprocessing
import string
from kneed import KneeLocator
import csv
dataframe = pd.read_csv(r"data... | StarcoderdataPython |
6531175 | <reponame>bclehmann/AlgorithmExamples<filename>optimized linear search/python.py
def optimized_sequential_search(array, target):
for i in range(len(array)):
if array[i] == target:
return i
if array[i] > target:
return -1
return -1
| StarcoderdataPython |
12856787 | import requests
import datetime
import time
UPDATE_URL = "http://www.trac-us.appspot.com/api/updates/"
#UPDATE_URL = "http://localhost:8000/api/updates/"
def post_split(reader_code, tag_code, time):
formatted_time = time.strftime("%Y/%m/%d %H:%M:%S.%f")
payload = {'r': reader_code,
'... | StarcoderdataPython |
139033 | import re
from data_extraction.scraper import Scraper
class DKSBScraper(Scraper):
"""Scrapes the website dksb.de."""
base_url = 'https://www.dksb.de'
debug = True
def parse(self, response, url):
"""Handles the soupified response of a detail page in the predefined way and returns it"""
... | StarcoderdataPython |
1672365 | """Test the minimum spanning tree function"""
from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.testing import assert_
import numpy.testing as npt
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import minimum_spanning_tree
def test_minimum_spanning_tree():
... | StarcoderdataPython |
3307308 | import re
import subprocess
from typing import List
from nvhtop.process import CPUProcess
class ProcessStatus(object):
PS_FORMAT = "pid,user,%cpu,%mem,etime,command"
PATTERN = re.compile(r"\s+")
MAX_SPLIT = 5
def __init__(self, pids: List[int]) -> None:
self._pids = pids
self._comman... | StarcoderdataPython |
9721997 | <gh_stars>1-10
#!/usr/local/bin/python
# encoding: utf-8
"""
*Extract out the tags from a dayone XML file and add them as mavericks tags*
:Author:
<NAME>
:Date Created:
February 25, 2014
.. todo::
@review: when complete pull all general functions and classes into dryxPython
Usage:
dt_add_maveri... | StarcoderdataPython |
6428503 | # -*- coding: utf-8 -*-
import telebot
import os
import flask
import logging
from telebot import types
if 'TOKEN' in os.environ:
TOKEN = os.environ.get("TOKEN")
else:
from config import TOKEN
bot = telebot.TeleBot(TOKEN)
@bot.message_handler(commands=['help', 'start'])
def send_welcome(message):
# bot... | StarcoderdataPython |
12820739 | #coding:utf-8
import time
dt = "2021-09-25 22:28:54"
#转换为时间数组
timeArray = time.strptime(dt, "%Y-%m-%d %H%M%S")
#转换为时间戳
timestamp = time.mktime(timeArray) | StarcoderdataPython |
9766719 | <reponame>Aquaveo/tethysapp-modflow
"""
********************************************************************************
* Name: init_command
* Author: ckrewson and mlebaron
* Created On: November 14, 2018
* Copyright: (c) Aquaveo 2018
********************************************************************************
"""... | StarcoderdataPython |
9715615 |
"""
Base class for a wiggler.
"""
from syned.storage_ring.magnetic_structures.insertion_device import InsertionDevice
class Wiggler(InsertionDevice):
def __init__(self, K_vertical = 0.0, K_horizontal = 0.0,period_length = 0.0, number_of_periods = 1):
InsertionDevice.__init__(self,
... | StarcoderdataPython |
6509670 | import os
from typing import Iterator, Text
import pytest
import sqlalchemy as sa
from rasa.core.lock_store import RedisLockStore
REDIS_HOST = os.getenv("REDIS_HOST", "localhost")
REDIS_PORT = os.getenv("REDIS_PORT", 6379)
POSTGRES_HOST = os.getenv("POSTGRES_HOST", "localhost")
POSTGRES_PORT = os.getenv("POSTGRES_P... | StarcoderdataPython |
94076 | <filename>day5-1 面向对象核心概念/t.py
# encoding = utf-8
__author__ = "<NAME>"
class Person:
age = 100
def __init__(self, name):
self.name = name
tom = Person('Tom')
print(tom.age) # tom 中没有定义age,访问的是类的,如果类中没有会接着访问上层的父类的
print(*tom.__dict__.items()) # 但是这种访问,是直接访问,tom实例并不会 并不会新增一个age属性。
| StarcoderdataPython |
9768674 | from transformers import Trainer, TrainingArguments, BertConfig, RobertaConfig, ElectraConfig
from transformers import HfArgumentParser
from transformers import BertTokenizerFast, RobertaTokenizerFast
from transformers import RobertaForMaskedLM
import transformers
transformers.logging.set_verbosity_debug()
import torc... | StarcoderdataPython |
5143082 | <reponame>fpgaedu/fpgaedu
import fpgaedu
if __name__ == '__main__':
fpgaedu.main()
| StarcoderdataPython |
8163565 | <filename>m_lagou/jobs_spider/pipelines.py
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
import pymongo
class JobsSpiderPipeline(object):
def __init__(self):
cl... | StarcoderdataPython |
125724 | from javax.swing.event import ListSelectionListener
class IssueListener(ListSelectionListener):
def __init__(self, view, table, scanner_pane, issue_name, issue_param):
self.view = view
self.table = table
self.scanner_pane = scanner_pane
self.issue_name = issue_name
self.issu... | StarcoderdataPython |
4915202 | from django.conf.urls.defaults import *
from django.conf import settings
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('',
# Example:
# (r'^desksearch/', include('webui.foo.urls')),
(r'^$', 'webui.frontend.... | StarcoderdataPython |
11261968 | <reponame>lakhlaifi/RedHat-Ansible<filename>virt/ansible-latest/lib/python2.7/site-packages/ansible/utils/collection_loader.py<gh_stars>1-10
# (c) 2019 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_f... | StarcoderdataPython |
3592905 | #!/usr/bin/env python
import sys
import csv
import argparse
import dns.resolver
from dns import reversename
"""
Written by <NAME>
Deductiv, Inc.
An adapter that takes CSV as input, performs a lookup to the DNS Python
resolution package, then returns the CSV results for DNS entries.
"""
# STDERR printing for pyth... | StarcoderdataPython |
13250 | # TODO Postcode: https://m3o.com/postcode/overview
| StarcoderdataPython |
11278877 | #!/usr/bin/env python3
#
# Copyright (c) 2021, NVIDIA CORPORATION. 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
#
# ... | StarcoderdataPython |
11340473 | <reponame>ssbostan/netmeter
from flask import Flask
from netmeter import get_iface_list, get_iface_raw_data
app = Flask(__name__)
app.config["JSONIFY_PRETTYPRINT_REGULAR"] = True
@app.route("/")
def index():
network_stats = {}
iface_list = get_iface_list()
for iface in iface_list:
iface_receive ... | StarcoderdataPython |
286731 | from librtf.version import __version__
from setuptools import setup, find_packages
url = 'https://github.com/Yasas1994/lib-rtf'
with open('README.md') as f:
long_description = f.read()
setup(
name='librtf',
version=__version__,
description='return time based phylogeny',
long_description=long_d... | StarcoderdataPython |
9685639 | from .transform import transform
| StarcoderdataPython |
3539430 | # Copyright 2019 The Cirq Developers
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | StarcoderdataPython |
1719510 | <filename>ahamodel/data.py<gh_stars>0
import numpy as np
import matplotlib.pyplot as plt
import h5py
import datetime
import pandas as pd
from helper import pH_to_mu
class LatticeHDF5WriterG:
'''Class to implement hdf5 writing used by GridRun
'''
def __init__(self,fname,attrs,c0,c1):
self.f = h5py.F... | StarcoderdataPython |
1618641 | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
dataset = pd.read_csv('Position_Salaries.csv')
X = dataset.iloc[:, 1:2].values
y = dataset.iloc[:, 2].values
from sklearn.tree import DecisionTreeRegressor
regressor = DecisionTreeRegressor(random_state = 0)
regressor.fit(X, y)
y_pred = regresso... | StarcoderdataPython |
3575213 | # -*- coding: utf-8 -*-
import contextlib
import functools
import pytest
@contextlib.contextmanager
def connect(port):
... # create connection
yield
... # close connection
@pytest.fixture
def equipments(request):
r = []
for port in ("C1", "C3", "C28"):
cm = connect(port)
equip... | StarcoderdataPython |
8091014 | from distutils.core import setup, Extension
import pybind11
import os
import platform
import os
if 'CC' not in os.environ:
os.environ['CC'] = 'clang'
if 'CXX' not in os.environ:
os.environ['CXX'] = 'clang++'
cc = os.environ['CC']
if cc[:len('ccache')] != 'ccache':
os.environ['CC'] = 'ccache ' + cc
extra_... | StarcoderdataPython |
6671337 | import argparse
import logging
import numpy as np
def parse_arguments():
'''
Parses the attention2vec arguments.
'''
parser = argparse.ArgumentParser(description="Run attention2vec.")
parser.add_argument('--train_per', type=int, default=20,
help='Input train percentage')
... | StarcoderdataPython |
11348858 | import os
import time
import re
from flask import Blueprint
from flask import request
import utils as u
import settings as s
import pagemaker as p
import writer
import whitelist
viewer = Blueprint("viewer", __name__)
friends = s.friends
with open("templ/post.t", "r") as postt:
postt = postt.read()
with open("temp... | StarcoderdataPython |
4808112 | <filename>argostranslate/argospm.py
from argostranslate import package
import argparse
"""
Example usage:
argospm update
argospm install translate-en_es
argospm list
argospm remove translate-en_es
"""
def name_of_package(pkg):
"""The package name of IPackage
Args:
(package.IPackage) Package ... | StarcoderdataPython |
5021624 | <gh_stars>0
import os
from flask import render_template, redirect, request, jsonify, url_for, flash
from flask_login import login_required, current_user
from sqlalchemy.sql.expression import func
from sqlalchemy import and_
from dynitag import app, db
from dynitag.models import Project, AnnotationTag, Audio, Annotatio... | StarcoderdataPython |
9681466 | <gh_stars>0
from django.apps import AppConfig
from django.db.models.signals import pre_migrate, post_migrate
from .signals import connect_post_save_handler, disconnect_post_save_handler
class TreenavConfig(AppConfig):
name = 'treenav'
def ready(self):
"""
Connect post_save handler during rou... | StarcoderdataPython |
396352 | import pytest
from async_asgi_testclient import TestClient
from mirumon.domain.users.scopes import DevicesScopes
pytestmark = [pytest.mark.asyncio]
@pytest.fixture
def user(superuser_username, superuser_password):
return {
"username": superuser_username,
"password": <PASSWORD>,
"scopes":... | StarcoderdataPython |
6519692 | #!/usr/bin/env python
# A Simple Gripper Node based on
# RobotiqHand https://github.com/TechMagicKK/RobotiqHand
import rospy
import sys
from RobotiqHand import RobotiqHand
from robotiq_hand_ros_node.msg import GripperControl
from robotiq_hand_ros_node.msg import GripperMoveResult
def signal_handler(sig, frame):
... | StarcoderdataPython |
1888815 | # MIT License
#
# Copyright (c) 2020 SCL team at Red Hat
#
# 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 the rights
# to use, copy, modify,... | StarcoderdataPython |
6440816 | <reponame>suryatechie/capstone_fall20_irrigation
#!/usr/bin/env python
# coding: utf-8
import argparse
import csv
import json
import numpy as np
import os
import pandas as pd
import rasterio
import tensorflow as tf
from glob import glob
from tqdm import tqdm
# Path to the BigEarthNet extracted files
big_earth_path = ... | StarcoderdataPython |
6458120 | from datetime import datetime, timezone
import pytest
from api.models import Factory
pytestmark = pytest.mark.django_db
@pytest.fixture
def factory(db):
return Factory.objects.create(
name="test_factory",
lat=24,
lng=121,
landcode="test_landcode",
townname="test_townnam... | StarcoderdataPython |
8175221 | from corehq.apps.domain.shortcuts import create_domain
from corehq.apps.sms.forms import (
LANGUAGE_FALLBACK_NONE,
LANGUAGE_FALLBACK_SCHEDULE,
LANGUAGE_FALLBACK_DOMAIN,
LANGUAGE_FALLBACK_UNTRANSLATED,
)
from corehq.apps.translations.models import StandaloneTranslationDoc
from corehq.apps.users.models im... | StarcoderdataPython |
6524151 | <reponame>styojm/CryptoPal-Challenges<gh_stars>0
'''
Implement CBC mode
CBC mode is a block cipher mode that allows us to encrypt irregularly-sized messages, despite the fact that a block cipher natively only transforms individual blocks.
In CBC mode, each ciphertext block is added to the next plaintext block before t... | StarcoderdataPython |
6619897 | <gh_stars>0
from __future__ import annotations
import unittest
from typing import List, Tuple, Dict, Callable, Type, Set
import os
import time
from datetime import datetime
import uuid
from src.austin_heller_repo.game_manager import GameManagerClientServerMessage, GameManagerStructureFactory, AuthenticateClientRequestG... | StarcoderdataPython |
3461103 | # ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.11.4
# kernelspec:
# display_name: Python 3 (ipykernel)
# language: python
# name: python3
# ---
# <img align="right" src="images/tf-small.... | StarcoderdataPython |
9691888 | import os
import pprint
from collections import Counter, defaultdict
from functools import partial
from multiprocessing import Pool
from pathlib import Path
from typing import List, Tuple
from uuid import uuid4
import argparse
import numpy as np
import zarr
from l5kit.data import ChunkedStateDataset, get_combined_scen... | StarcoderdataPython |
1900151 | import discord
from discord.ext import commands
import random
import asyncio
import re
client = commands.Bot(command_prefix='your prefix')
def convert(seconds):
seconds = seconds % (24 * 3600)
seconds %= 3600
minutes = seconds // 60
seconds %= 60
return f'{minutes} minutes {seconds} seconds... | StarcoderdataPython |
12803767 | import logging
import time
from celery import shared_task
from dateutil.relativedelta import relativedelta
from django.db.models import Q
from django.utils import timezone
from posthog.celery import app
from posthog.ee import check_ee_enabled
from posthog.models import Cohort
logger = logging.getLogger(__name__)
@... | StarcoderdataPython |
261197 | <reponame>IvoAA/PeerGrade
from flask import Flask
from flask_cors import CORS
print(__name__)
app = Flask(__name__)
CORS(app)
app.config.from_pyfile('application.cfg', silent=True)
import chat.views
| StarcoderdataPython |
5114376 | <filename>clean_plate.py
# -*- coding: utf-8 -*-
"""clean_plate.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1YyqneQz6Cf7tLxJMRVQsnFEglrNjGA07
"""
# In order to run this lab we need to import two packages.
# IBM Watson: which allows access to... | StarcoderdataPython |
1706266 | # Collaborators (including web sites where you got help: (enter none if you didn't need help)
#
def factorial_calc(x): #you may choose the name of the parameter
return # be sure to return the factorial
if __name__ == '__main__':
# Test your code with this first
# Change the argument to try differ... | StarcoderdataPython |
1709215 | """
Aggregations.
| Copyright 2017-2021, Voxel51, Inc.
| `voxel51.com <https://voxel51.com/>`_
|
"""
import numpy as np
import eta.core.utils as etau
from fiftyone.core.expressions import ViewField as F
import fiftyone.core.media as fom
import fiftyone.core.utils as fou
class Aggregation(object):
"""Abstract b... | StarcoderdataPython |
276710 | import numpy as np
import matplotlib.pyplot as plt
import pydub
from filter import *
from dtw import dtw
from midi import NoteSequencer
def get_raw_from_file(filename):
container = pydub.AudioSegment.from_file(filename)
if container.sample_width == 1:
data = np.fromstring(container._data, np.int8)
... | StarcoderdataPython |
3255975 | <reponame>jongio/azure-script<filename>azsc/handlers/az/IoT.py<gh_stars>0
from azsc.handlers.Handler import Handler
from azsc.handlers.az.Generic import GenericHandler
class IoTHubHandler(GenericHandler):
azure_object = "iot hub"
def execute(self):
fqn = self.get_full_resource_name()
... | StarcoderdataPython |
9645455 | from django.contrib.auth.models import User
from django.db import models
class UserProfile(models.Model):
user = models.OneToOneField(
User, related_name="userpfrofile", on_delete=models.CASCADE
)
is_employer = models.BooleanField(default=False)
User.userprofile = property(lambda u: UserProfile.... | StarcoderdataPython |
11280044 | import pytest
from anom import Model, props
from anom.model import PropertyFilter
class Nested(Model):
y = props.Integer()
z = props.Integer(indexed=True)
class Outer(Model):
x = props.Float(indexed=True)
nested = props.Embed(name="child", kind=Nested)
def test_embed_properties_cannot_have_defaul... | StarcoderdataPython |
12952 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-07-27 16:14
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('basic', '0002_auto_20170727_1741'),
]
operations = [
migrations.AddField(
... | StarcoderdataPython |
31357 | """
Code for the optimization and gaming component of the Baselining work.
@author: <NAME>, <NAME>
@date Mar 2, 2016
"""
import numpy as np
import pandas as pd
import logging
from gurobipy import GRB, Model, quicksum, LinExpr
from pandas.tseries.holiday import USFederalHolidayCalendar
from datetime import datetime
f... | StarcoderdataPython |
50991 | <filename>ems/datasets/case/case_set.py
# Interface for a "set" of cases
class CaseSet:
def __init__(self, time):
self.time = time
def __len__(self):
raise NotImplementedError()
def iterator(self):
raise NotImplementedError()
def get_time(self):
return self.time
... | StarcoderdataPython |
4870231 | import csv
import numpy as np
import pandas as pd
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from matplotlib.backends.backend_gtk3agg import (
FigureCanvasGTK3Agg as FigureCanvas)
from matplotlib.figure import Figure
from collections import Counter
win = Gtk.Window()
win.connect("del... | StarcoderdataPython |
3210388 | <gh_stars>1-10
import numpy as np
def perceptron(X, y):
'''
PERCEPTRON Perceptron Learning Algorithm.
INPUT: X: training sample features, P-by-N matrix.
y: training sample labels, 1-by-N row vector.
OUTPUT: w: learned perceptron parameters, (P+1)-by-1 column vector.
... | StarcoderdataPython |
3300295 | n = int(input())
if n <=3:
print(1)
else:
print(n-2) | StarcoderdataPython |
3441289 | <filename>Problem Sets/Problem Set 1/Solutions/rootsofcubic_4_1.py
#!/usr/bin/env python
"""
Find all of the roots of x^3 - 25 x^2 + 165 x - 275 by
combined bisection/Newton method
Problem set 1, problem 4
To run:
./rootsofcubic_3_1.py
"""
import matplotlib.pyplot as plt
import numpy as np
from rtsafe import rtsafe
... | StarcoderdataPython |
5092153 | '''
lab 3
list and set
'''
#3.1
str_list = ["a" , "d" , "e" , "b" , "c"]
str_list.sort()
print(str_list)
#3.2
str_list.append("f")
print(str_list)
#3.3
str_list.remove("d")
print(str_list)
#3.4
print(str_list[2])
#3.5, THIS IS WHERE WE STOPPED AS A CLASS. AND I KEPT GOING
my_list = ("a" , "123" , "'123'" , "'b'" , ... | StarcoderdataPython |
3332471 | <reponame>lukovnikov/teafacto
import elasticsearch, re, sys
from teafacto.util import tokenize, argprun
class SimpleQuestionsLabelIndex(object):
def __init__(self, host="drogon", index="simplequestions_labels"):
self.host = host
self.indexp = index
def index(self, labelp="labels.map"):
... | StarcoderdataPython |
6547099 | <gh_stars>0
import argparse
import json
import os.path
from .basic_data_provider import list_providers, get_provider
from .tex_gen import tex_gen
from sys import stdin
# TODO: добавить аргументы для настройки компиляции и генерации данных
def get_args():
parser = argparse.ArgumentParser(
description='lxg... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.