id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
4822126 | <reponame>raeubaen/membrii
"""
Django settings for emme project.
Generated by 'django-admin startproject' using Django 2.1.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/setti... | StarcoderdataPython |
1633115 | <filename>blender/arm/logicnode/camera/LN_set_camera_fov.py<gh_stars>0
from arm.logicnode.arm_nodes import *
class SetCameraFovNode(ArmLogicTreeNode):
"""Set the field of view (FOV) of a camera.
@seeNode Get Camera FOV"""
bl_idname = 'LNSetCameraFovNode'
bl_label = 'Set Camera FOV'
arm_version = 1... | StarcoderdataPython |
1688580 | class DataLinkError(RuntimeError):
GENERIC_ERROR_MESSAGE = 'Something went wrong. Please try again. \
If you continue to have problems, please contact us at <EMAIL>.'
def __init__(self, data_link_message=None, http_status=None, http_body=None, http_headers=None,
data_link_error_code=None, resp... | StarcoderdataPython |
3303821 | <gh_stars>1-10
#import pycuda.autoinit # NOQA:401
#import pycuda.gpuarray as gpuarray
import ctypes
import os
import warnings
import numpy as np
from ctypes import c_double
from ctypes import c_int
from ctypes import c_float
from ctypes import c_void_p
c_int_p = ctypes.POINTER(c_int)
c_float_p = ctypes.POINTER(c_flo... | StarcoderdataPython |
3224534 | <gh_stars>1-10
""" This is entry point when using boring from command line"""
from boring.server import Server
def main():
Server().start()
if __name__ == '__main__':
# TODO
pass
| StarcoderdataPython |
1646564 | <reponame>amanalok/python-dsa<filename>data_structures_one/1_stack.py
class StackWithList:
def __init__(self):
self.stack = []
self.len = -1
def push(self, item):
self.stack.append(item)
self.len += 1
def pop(self):
if self.len == -1:
return None
... | StarcoderdataPython |
48496 | import re
import six
import datetime
from urllib import urlencode
from django.conf import settings
from django.http import HttpResponse
from django.core.exceptions import ObjectDoesNotExist
from django.urls import reverse
from django.utils.encoding import force_text
import debug # pyflakes:... | StarcoderdataPython |
3394117 | <filename>stock/quant/huanshoulv.py<gh_stars>1-10
import sys
import datetime
import os
import numpy as np
import pandas as pd
from stock.marketdata.storefactory import get_store
from stock.lib.finance import load_stock_basics
from config import store_type
import matplotlib.pyplot as plt
date = sys.argv[1]
store = get... | StarcoderdataPython |
1756445 | from __future__ import absolute_import
__author__ = 'katharine'
import socket
import struct
import websocket
from .. import BaseTransport, MessageTarget, MessageTargetWatch
from .protocol import WebSocketRelayToWatch, WebSocketRelayFromWatch, endpoints, from_watch
from libpebble2.exceptions import ConnectionError, P... | StarcoderdataPython |
3280889 | <reponame>JWang169/LintCodeJava<filename>Python/31.py
# April 3rd
class Solution:
def nextPermutation(self, nums: List[int]) -> None:
i = len(nums) - 1
while i > 0 and nums[i] <= nums[i - 1]:
i -= 1
if i == 0:
nums.reverse()
return
#... | StarcoderdataPython |
1669319 | # 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, software
# distributed under the... | StarcoderdataPython |
1693385 | from ..utils import TranspileTestCase
class SetComprehensionTests(TranspileTestCase):
def test_syntax(self):
self.assertCodeExecution("""
x = [1, 2, 3, 4, 5]
s = {v**2 for v in x}
print(len(s))
print(1 in s)
print(4 in s)
print(9 in s... | StarcoderdataPython |
3285193 | <reponame>MCLConsortium/jpl.mcl.site.knowledge
# encoding: utf-8
u'''JPL MCL Site Knowledge — setup handlers.'''
from ._utils import publish, hideTab, rename, move
from plone.dexterity.utils import createContentInContainer
from plone.registry.interfaces import IRegistry
from ZODB.DemoStorage import DemoStorage
from z... | StarcoderdataPython |
1638073 | <gh_stars>0
from django.core.management.base import BaseCommand
from archive.tasks import get_phantomjs_screenshot
from archive.models import Site, Update, Screenshot
from django.utils import timezone
import logging
logger = logging.getLogger(__name__)
class Command(BaseCommand):
help = 'Archive screenshots for a... | StarcoderdataPython |
1710991 | <gh_stars>100-1000
import argparse
import socket
import json
import time
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument("--self_port", default=60000, type=int)
return parser.parse_args()
def recv_data(sock):
print("Waiting to receive data")
data, address = sock.recvfrom(4... | StarcoderdataPython |
1686184 | import argparse
import torch
from model.wide_res_net import WideResNet
from model.smooth_cross_entropy import smooth_crossentropy
from data.cifar import Cifar
from utility.log import Log
from utility.initialize import initialize
from utility.step_lr import StepLR
from utility.bypass_bn import enable_running_stats, dis... | StarcoderdataPython |
1683418 | <filename>src/camera.py
from __future__ import division
# import h5py
import numpy as np
from xml.dom import minidom
import numpy as np
CAMERA_ID_TO_NAME = {
1: "54138969",
2: "55011271",
3: "58860488",
4: "60457274",
}
def project_point_radial(P, R, T, f, c, k, p):
"""
Args
P: Nx3 points in wo... | StarcoderdataPython |
1758284 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# Generated by Django 1.9.12 on 2017-03-16 15:41
from __future__ import unicode_literals
from __future__ import absolute_import
from django.db import migrations, models
import jsonfield.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
... | StarcoderdataPython |
1739064 | <reponame>Vasudeva-bit/Python-Projects
import PyPDF2
with open('super.pdf','rb') as surfile :
with open('wtr.pdf','rb') as wtrfile :
readers=PyPDF2.PdfFileReader(surfile)
readerw=PyPDF2.PdfFileReader(wtrfile)
n=readers.numPages
pagew=readerw.getPage(0)
with open('wtrsuper.pdf','wb') as file :
writer=PyPDF2.PdfFileWrite... | StarcoderdataPython |
3205386 | <gh_stars>1-10
from django.shortcuts import render
# Create your views here.
from django.http import HttpResponse
import json
import CloudJudge.info as info
FrontMessageCode = info.getFrontMessage()
def getFrontMessageCode(request):
if request.method == "GET":
return HttpResponse(json.dumps(FrontMessage... | StarcoderdataPython |
136545 | import numpy as np
import pandas as pd
l_2d = [[0, 1, 2], [3, 4, 5]]
arr_t = np.array(l_2d).T
print(arr_t)
print(type(arr_t))
# [[0 3]
# [1 4]
# [2 5]]
# <class 'numpy.ndarray'>
l_2d_t = np.array(l_2d).T.tolist()
print(l_2d_t)
print(type(l_2d_t))
# [[0, 3], [1, 4], [2, 5]]
# <class 'list'>
df_t = pd.DataFrame(l... | StarcoderdataPython |
3253396 | <filename>final/smalltest/foto.py
import pygame
import pygame.camera
from pygame.locals import *
DEVICE = '/dev/video0'
SIZE = (640, 480)
FILENAME = 'capture.png'
def camstream():
pygame.init()
pygame.camera.init()
display = pygame.display.set_mode(SIZE, 0)
camera = pygame.camera.Camera(DEVICE, SIZE)
... | StarcoderdataPython |
3324064 | # Copyright 2020 The TensorFlow Authors. 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 applica... | StarcoderdataPython |
3378569 | <reponame>marywhetham11/3xCoolTech
import pytest
from seleniumbase import BaseCase
from qa327_test.conftest import base_url
"""
This file defines all requirement tests for R1.1
R1.1 - If the user hasn`t logged in, show the login page
"""
class FrontEndLoginR1(BaseCase):
def test_notLoggedIn(self, *_):
"... | StarcoderdataPython |
3201346 | <filename>openmldefaults/config_spaces/svc.py<gh_stars>1-10
import ConfigSpace
def get_hyperparameter_search_space_small(seed):
"""
Small version of svm config space, featuring important hyperparameters
based on https://arxiv.org/abs/1710.04725
Parameters
----------
seed: int
Random s... | StarcoderdataPython |
3247917 | #!/usr/bin/env python
# (c) <NAME>, 2016-2017
DESC="""Plot an IRIG-B signal read from stdin. Assumes that the timeseries
is a sequence of newline-delimited float literals."""
FAST_CHANNEL_BITRATE = 16384 # for IRIG-B, DuoTone, etc.
# THE REST OF THE IMPORTS ARE AFTER THIS IF STATEMENT.
# Quits immediately on --help ... | StarcoderdataPython |
160127 | <gh_stars>0
import json
import math
import urllib.parse
from area import area as compute_area
from haversine import Unit
from haversine.haversine import get_avg_earth_radius
EARTH_RADIUS = get_avg_earth_radius(Unit.METERS)
EARTH_PERIMETER = 2 * math.pi * EARTH_RADIUS
def latitude_radians_to_meters(radians: float) -... | StarcoderdataPython |
126595 | text = input().split()
times_seen = {}
for word in text:
if word not in times_seen:
times_seen[word] = 0
print(times_seen[word], end=' ')
times_seen[word] += 1 | StarcoderdataPython |
4800318 | from argparse import ArgumentParser
import os
import json
from src.core.util import read_json, write_pickle, read_pickle
from src.core.scenario_db import ScenarioDB, add_scenario_arguments
from src.core.schema import Schema
from src.model.preprocess import Preprocessor
from dataset_statistics import *
from src.core.lex... | StarcoderdataPython |
3217196 | # Generated by Django 3.0.5 on 2020-04-25 09:02
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import filer.fields.file
import filer.fields.image
import publications.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
... | StarcoderdataPython |
1796403 | <filename>Python/Exceptions/TryAndCatch.py
try:
number = int(input("Enter a number: "))
print(number);
except:
print("Invalid Input, please enter number!") | StarcoderdataPython |
1794000 | <reponame>JosepOrenga/Discover<gh_stars>0
import pandas as pd
def read_csv(path=str, sep=';'):
"""
Leer un archivo csv y los transforma a un dataframe
:param path: dirección del archivo csv
:param sep: separador del archvio
:return: dataframe
"""
# Leemos el archivo con la funcioón read_cs... | StarcoderdataPython |
110280 | #!/usr/bin/python -W ignore -tt
"""Module to collect data from network devices."""
from collections import defaultdict
from datetime import datetime
import sys
import re
import warnings
import ipaddress
import helpers
import netspot
import netspot_settings
from napalm import get_network_driver
from spotmax import S... | StarcoderdataPython |
1774567 | #!/usr/bin/env python3
#
# Copyright 2015 Dovetail Genomics LLC
#
#
from __future__ import print_function
from builtins import range
from builtins import object
import math
import itertools
import networkx as nx
class LSbitlinks(object):
def __init__(self,w):
n = 2**w
self.n=n
#print n
... | StarcoderdataPython |
121548 | # 山灵M0播放器播放列表管理工具配置
# ver.11
# By <NAME>
class Default:
m0_prefix = "A:\\" # M0播放列表的驱动器映射
m0_folder = "_explaylist_data\\" # M0播放列表所在的文件夹,以 \\ 结尾
m0_playlist_type = ".m3u" # M0播放列表文件格式
m0_disabled_playlist = ".m0disabled" # M0禁用的播放列表格式
playlist_default_name = "Default" # 默认播放列表名称
suppo... | StarcoderdataPython |
145697 | """
Author: <NAME>, PhD - Higher Education Specialist at Education & Research at Esri Canada.
Date: Remodified Q1 - 2022.
About: From per transit route and trip_id, this geoprocessing operation identifies where along
the transit route was the vehicle at.
Warning Note: This operation runs while in P... | StarcoderdataPython |
80706 | class PyginationError(Exception):
pass
class PaginationError(Exception):
pass
| StarcoderdataPython |
1716888 | <reponame>kgullikson88/gullikson-scripts<filename>kglib/fitters/linear.py
"""
Defines a few functions for linear fits
"""
from __future__ import print_function, division, absolute_import
import numpy as np
from astropy.modeling import fitting
from astropy.modeling.polynomial import Chebyshev2D
import statsmodels.api... | StarcoderdataPython |
1606253 | import logging
import sys
import random
import json
from leosdk.aws.payload import Payload
from leosdk.leo import Leo
import leo_config
leo = Leo(leo_config, 'mybot', 'myqueue')
leo.log_handler(logging.StreamHandler(sys.stdout))
stream = leo.load()
for i in range(0, 25):
p = Payload()
p.set_event("FollowUp"... | StarcoderdataPython |
3252974 | a = 100
if 99 == a:
print('if')
elif 100 == a:
print('elif')
else:
print('else')
| StarcoderdataPython |
56388 | <filename>laf/models.py
from django.db import models
from imagekit.models import ProcessedImageField
from imagekit.processors import ResizeToFill
# 用户信息表
class User(models.Model):
username = models.CharField(
max_length=20,
unique=True
)
gender = models.CharField(max_length=8)
age = mo... | StarcoderdataPython |
1697836 | #!/usr/bin/python
import re
# case-insensitive match
# re.M is multiline
if re.search(r'eF', 'abcdef', re.I): print True
else: print False
# True
# match at end of string
if re.search(r'cd$', 'abcdabcd'): print True
else: print False
# True
# find/count occurrences
my_list = re.findall(r'cd', 'abcdabcd')
print my_l... | StarcoderdataPython |
1732755 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
ILI9488_demo.py
Created: 01:57 AM 09/24/2021
Last Updated: 12:01 PM 09/24/2021
MIT License
Copyright (c) 2021 <NAME>(<NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and the assoc... | StarcoderdataPython |
168308 | from django.db import models
from django.contrib.auth import get_user_model, authenticate, login, logout
User = get_user_model()
# Create your models here.
class Teacher(models.Model):
name = models.CharField(max_length=100)
email = models.EmailField(max_length=255, unique=True, verbose_name='email address')... | StarcoderdataPython |
1683081 | # Uses python3
import sys
def optimal_summands(n):
summands = []
k = n
l = 1
while k and l:
if k <= 2*l:
summands.append(k)
k -= k
else:
summands.append(l)
k -= l
l += 1
return summands
if __name__ == '__main__':
input =... | StarcoderdataPython |
3367368 | arr = []
res = []
cnt = 0
for x in range(8):
arr.append(int(input()))
for i in range(5):
cnt += max(arr)
idx = arr.index(max(arr))
res.append(idx+1)
arr[idx] = 0
print(cnt)
print(*(sorted(res))) | StarcoderdataPython |
7495 | <filename>xled_plus/samples/colmeander.py<gh_stars>0
from .sample_setup import *
ctr = setup_control()
eff = ColorMeanderEffect(ctr, "solid")
eff.launch_rt()
input()
eff.stop_rt()
ctr.turn_off()
| StarcoderdataPython |
1704674 | from caffeination_gui import *
| StarcoderdataPython |
3254729 | <gh_stars>1-10
import math
with open("input.txt") as fp:
matrix = [i.strip() for i in fp.readlines()]
height = len(matrix)
width = len(matrix[0])
row = 0
col = 0
def findTrees(matrix, height, width, row, col, rowJump, colJump):
trees = 0
while row < height and col <= width:
if matrix[row][col]... | StarcoderdataPython |
1799160 | <reponame>mkoryor/Python
from bisect import bisect_left, bisect_right
strls = ['a', 'awkward', 'awl', 'awls', 'axe', 'axes', 'bee']
# t = 'This is the world.$'
t = 'banana$'
suffixes = sorted([t[i:] for i in range(len(t))])
print(len(suffixes))
print(suffixes)
# Get range of elements with ‘aw’ as a prefix
s... | StarcoderdataPython |
99239 | <filename>accelbyte_py_sdk/api/dsm_controller/wrappers/_public.py<gh_stars>0
# pylint: disable=duplicate-code
# pylint: disable=line-too-long
# pylint: disable=missing-function-docstring
# pylint: disable=missing-function-docstring
# pylint: disable=missing-module-docstring
# pylint: disable=too-many-arguments
# pylint... | StarcoderdataPython |
1755809 | <filename>myPackage/crotalProcessing.py<gh_stars>0
import cv2
import re
import numpy as np
import pytesseract
import tesserocr
from myPackage import tools as tl
from matplotlib import pyplot as plt
from os.path import basename, getsize
from PIL import Image
from sklearn.cluster import KMeans
def validateImage(nameIma... | StarcoderdataPython |
3269036 | #!/usr/bin/env python
import sys
from typing import List, Tuple
def _parse_fold(fold_desc: str) -> Tuple[str, int]:
axis, at = fold_desc.split("=")
return (axis[-1], int(at))
def fold(fold: Tuple[str, int], points: List[Tuple[int, int]]) -> List[Tuple[int, int]]:
axis, fold_at = fold
fold_idx = 0 i... | StarcoderdataPython |
22034 | from pgm.pgmplayer import PGMPlayer
import cps_constraints as con
from operator import itemgetter
import uuid
import os
class ConstraintSolver:
def __init__(self, my_con_collector, my_con_scoper, SHOULD_USE_CONSTRAINT_SCOPING=False):
self.con_collector = my_con_collector
self.con_scoper = my_con_s... | StarcoderdataPython |
53065 | <reponame>isamumu/GazeVechicle
import cv2
video_capture = cv2.VideoCapture(2)
success, frame = video_capture.read()
while(success):
cv2.imshow("frame", frame)
cv2.waitKey(10)
success, frame = video_capture.read() | StarcoderdataPython |
1610028 | <gh_stars>1-10
# ----------------------------------------------------------------------------
# Copyright (c) 2005-2017, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distribu... | StarcoderdataPython |
3673 | <reponame>Mannan2812/azure-cli-extensions<gh_stars>100-1000
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------... | StarcoderdataPython |
3378406 | # coding: utf8
from __future__ import unicode_literals, print_function
import tensorflow as tf
import numpy as np
import copy
import io
from PIL import Image
from time import time
from prodigy.components.loaders import get_stream
from prodigy.components.preprocess import fetch_images
from prodigy.core import recipe, ... | StarcoderdataPython |
37262 | <filename>project_3/code/characters.py
from get_char_pos import get_char_position
class Character:
def __init__(self):
self.x = 0
self.y = 0
self.vel = 32
self.alive = True
self.tag = "str"
mac = Character()
mac.tag = "mac"
guard = Character()
guard.tag = "guard"
macp... | StarcoderdataPython |
3399146 | import moabb
import pyriemann
import numpy as np
import gzip, pickle
# import matplotlib.pyplot as plt
from moabb.paradigms import BaseSSVEP, MotorImagery
from moabb.datasets import SSVEPExo, AlexMI, PhysionetMI, Weibo2014, Ofner2017
from pyriemann.estimation import Covariances
from pyriemann.utils.distance import pai... | StarcoderdataPython |
3308845 | <filename>__init__.py
from writer import Writer
| StarcoderdataPython |
57003 | <filename>users/mutations/social.py<gh_stars>1-10
import os
import re
import graphene
import requests
from requests_oauthlib import OAuth1
from urllib.parse import parse_qs
from users import mixins, types
from users.decorators import social_auth
class SocialAuthMutation(mixins.SocialAuthMixin, graphene.Mutation):
... | StarcoderdataPython |
1655964 | <filename>torchsupport/distributions/vae_distribution.py
import torch
import torch.nn as nn
from torch.distributions import Distribution
class VAEDistribution(nn.Module, Distribution):
def __init__(self, encoder, decoder, prior=None):
super().__init__()
self.encoder = encoder
self.decoder = decoder
s... | StarcoderdataPython |
74465 | from Gamepad import Gamepad
class Controller(Gamepad):
def __init__(self):
self.names = {
"BTN_TR2": "RT",
"BTN_TR": "RB",
"BTN_TL2": "LT",
"BTN_TL": "LB",
"BTN_THUMBL": "LS_BTN",
"BTN_THUMBR": "RS_BTN",
"BTN_WEST": "Y",
... | StarcoderdataPython |
3284271 | """ Application commands common to all interfaces.
"""
from .cmd1 import main as cmd1
from .start import main as start
from .cmd2 import main as cmd2
__all__ = "cmd1", "cmd2", "start"
| StarcoderdataPython |
68951 | from time import sleep
from PyQt5.QtCore import pyqtSignal, Qt
from PyQt5.QtWidgets import QMessageBox, QDialog
from gui.file_transfer import Ui_FileTransferDialog
from src.logic.file_transfer import FileTransfer
class FileTransferDialog(QDialog, Ui_FileTransferDialog):
_update_signal = pyqtSignal()
#FIXME... | StarcoderdataPython |
3237919 | <filename>shape_detection/shape.py
import math
class Point(tuple):
"""Extends 'tuple', Point represents a 2d position."""
def __new__(cls, x: int, y: int) -> tuple:
return tuple.__new__(cls, (x, y))
def __init__(self, x: int, y: int):
self._x = x
self._y = y
@property
def... | StarcoderdataPython |
80763 | <filename>server/explorer/utils/collection.py<gh_stars>100-1000
"""
Copyright 2015, Cisco Systems, 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
Un... | StarcoderdataPython |
126661 | # %%
import pandas as pd
# %% Display a data frame
df = pd.DataFrame({'A': [1, 2], 'B': [3, 4]},
index=pd.Index(['x0', 'x1'], name='x'))
df
# %% Pandas plot {"tags": ["parameters"]}
df.plot(kind='bar')
| StarcoderdataPython |
132133 | <gh_stars>0
from io import StringIO
from django.http import HttpResponse
depts_list = [
{'no': 10, 'name': '财务部', 'location': '北京'},
{'no': 20, 'name': '研发部', 'location': '成都'},
{'no': 30, 'name': '销售部', 'location': '上海'},
]
def index(request):
output = StringIO()
output.write('<html>\n')
ou... | StarcoderdataPython |
151139 | import logging
import os
import sys
import arguments
from app.core import files
from cli.main import start_cli
from gui.main import start_gui
def main():
app_path = files.get_app_path()
if not os.path.exists(app_path):
os.mkdir(app_path)
if not os.path.isfile(files.get_config_path()):
ope... | StarcoderdataPython |
185479 | <reponame>qeedquan/misc_utilities<gh_stars>1-10
from math import *
def isclose(a, b, rel_tol=1e-06, abs_tol=0.0):
return abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)
class Vec2:
def __init__(self, x = 0, y = 0):
self.x, self.y = x, y
def __add__(self, p):
return Vec2(se... | StarcoderdataPython |
1759630 | from .Dispatcher import Dispatcher
from .Component import PyOptSparseComponent
from .TimeSeries import TimeSeries
from .Solution import Solution
# Don't import pyoptsparse here as Gekko users may not want to install it
import numpy as np
import sys
import os
import time as time_lib
import traceback
from typing import ... | StarcoderdataPython |
98635 | <filename>sopel/modules/wiktionary.py<gh_stars>0
# -*- coding: cp1252 -*-
from sopel import web
from sopel.module import NOLIMIT, commands, example, rule
import json
import re
REDIRECT = re.compile(r'^REDIRECT (.*)')
def configure(config):
if config.lang == 'fr':
config.interactive_add('core', 'w... | StarcoderdataPython |
3224721 | <reponame>TBxy/gae-angular-material-init<gh_stars>1-10
# coding: utf-8
# pylint: disable=too-few-public-methods, no-self-use, missing-docstring, unused-argument
"""
Provides API logic relevant to users
"""
from flask_restful import reqparse, Resource
import auth
import util
from main import API, auth
from model impor... | StarcoderdataPython |
64234 | <filename>questions/migrations/0004_auto_20191211_0912.py
# Generated by Django 2.1 on 2019-12-11 06:12
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('questions', '0003_auto_20191211_0910'),
]
operations = [
migrations.RenameField(
... | StarcoderdataPython |
3246273 | import argparse
import os
import PIL.Image
import PIL.ImageOps
import sys
from io import BytesIO
class Thumbnailer():
def __init__(self):
# Parse arguments
parser = argparse.ArgumentParser()
parser.add_argument('-i', '--input', type=str, required=True)
parser.add_argument('-o', '--... | StarcoderdataPython |
1630677 | <gh_stars>1-10
import os
import numpy as np
import pytest
import rowan
from hypothesis import example, given, settings
from hypothesis.extra.numpy import arrays
from hypothesis.strategies import floats, integers
from scipy.spatial import ConvexHull
from conftest import (
EllipsoidSurfaceStrategy,
get_oriented... | StarcoderdataPython |
1774960 | <filename>get_structures/code/maybe_obsolete/clean_pdb_withgaps.py
#!/usr/bin/env python3
import os
import sys
import re
from Bio import AlignIO
af = sys.argv[1] #"../mcm_test/pdb_bank/aligned/alignment_files/align_output.fasta" #sys.argv[1]
#args=["902:1101","1735:1956","2608:2703","3495:3633","4189:4289","4891:5073"... | StarcoderdataPython |
132727 | <reponame>andywalden/msiempy
import msiempy
import msiempy.alarm
import unittest
import pprint
class T(unittest.TestCase):
def test_no_detailed_filter(self):
alarms = msiempy.alarm.AlarmManager(
time_range='CURRENT_DAY',
page_size=5,
status_filter='unacknowledged')
... | StarcoderdataPython |
3358315 | import os
import time
from functools import partial
from absl import logging
import tensorflow as tf
from lib import utils, dataset
class Trainer(object):
""" Trainer class for ESRGAN """
def __init__(
self,
summary_writer,
summary_writer_2,
settings,
model_dir="... | StarcoderdataPython |
5577 | <reponame>n-kats/mlbase<filename>mlbase/lazy.py<gh_stars>0
from mlbase.utils.misc import lazy
tensorflow = lazy("tensorflow")
numpy = lazy("numpy")
gensim = lazy("gensim")
| StarcoderdataPython |
3372573 | <reponame>gwangyi/pygritia
"""sphinx helper for paver"""
from paver.easy import * # pylint: disable=unused-wildcard-import,wildcard-import
# pylint: disable=invalid-name,unused-import
try:
import sphinx # type: ignore
has_sphinx = True
except ImportError:
has_sphinx = False
try:
import sphinx.cmd.b... | StarcoderdataPython |
1625537 | import time
ZERO = 0
def f1(n):
"Arbitrary test function."
i = 0
x = 1
while i<n:
j = 0 #ZERO
while j<=i:
j = j + 1
x = x + (i&j)
i = i + 1
return x
try:
import pypyjit
except ImportError:
print "No jit"
else:
pypyjit.enable(f1.func_... | StarcoderdataPython |
3285464 | <reponame>GulaAren/sharelinks
from django.urls import path
from . import views
urlpatterns = [
path('login', views.login, name='login'),
path('logout', views.logout, name='logout'),
path('daftar', views.daftar, name='daftar'),
] | StarcoderdataPython |
65384 | <reponame>acheronfail/pyatv
import asyncio
import logging
import struct
from unittest.mock import patch
from contextlib import contextmanager
from ipaddress import IPv4Address
from collections import namedtuple
from typing import List, Dict, Optional, Tuple, Union, cast
from pyatv.support import dns, mdns
from tests.... | StarcoderdataPython |
3235510 | <filename>ex067.py
import random
num = (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10), random.randint(1, 10), random.randint(1, 10))
print(num)
print(f'O menor número é {min(num)} e o maior número é {max(num)}')
| StarcoderdataPython |
3384416 | <filename>admin/settings.py<gh_stars>1-10
from admin.models import Setting, PYPARTY_SETTINGS
def get_setting(name):
try:
setting = Setting.objects.get(name=name)
except Setting.DoesNotExist:
# save the default record for this item
setting = Setting()
setting.name = name
... | StarcoderdataPython |
143942 | <reponame>mm40/pudb
import collections
import pytest # noqa: F401
from pudb.py3compat import builtins
from pudb.settings import load_breakpoints, save_breakpoints
def test_load_breakpoints(mocker):
fake_data = ["b /home/user/test.py:41"], ["b /home/user/test.py:50"]
mock_open = mocker.mock_open()
mock_... | StarcoderdataPython |
1799883 | <filename>tests/workspace_2_12.bzl<gh_stars>1-10
load("@rules_jvm_external//:defs.bzl", "maven_install")
def test_2_12_artifacts():
return [
"org.specs2:specs2-common_2.12:4.12.3",
"org.specs2:specs2-core_2.12:4.12.3",
"org.specs2:specs2-matcher_2.12:4.12.3",
"org.scalatest:scalates... | StarcoderdataPython |
51494 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# <bitbar.title>GitHub Zen</bitbar.title>
# <bitbar.version>v1.0.0</bitbar.version>
# <bitbar.author>Josh</bitbar.author>
# <bitbar.author.github>andjosh</bitbar.author.github>
# <bitbar.desc>GitHub zen in your menu bar!</bitbar.desc>
# <bitbar.dependencies>python</bitbar.... | StarcoderdataPython |
190932 | import numpy as np
import sys
from six import StringIO, b
from gym import utils
from gym.envs.toy_text import discrete
LEFT = 0
DOWN = 1
RIGHT = 2
UP = 3
MAPS = {
"4x4": [
"SFFF",
"FFFF",
"FFFF",
"FFFG"
],
"8x8": [
"SFFFFFFF",
"FFFFFFFF",
"FFFFFFFF"... | StarcoderdataPython |
40289 | """A set of Python Classes for connecting to and interacting with a VOSpace
service.
Connections to VOSpace are made using a SSL X509 certificat which is
stored in a .pem file.
"""
#from contextlib import nested
import copy
import errno
import fnmatch
import hashlib
import requests
from requests.exceptions i... | StarcoderdataPython |
94634 | <filename>models.py
from sqlalchemy import Column, Integer, String, Float
from app import db, ma
class User(db.Model):
__tablename__ = 'users'
id = Column(Integer, primary_key=True)
first_name = Column(String)
last_name = Column(String)
email = Column(String, unique=True)
password = Column(Str... | StarcoderdataPython |
91143 | import humanfriendly
import datetime
def duration_to_date(duration: str) -> datetime.timedelta:
seconds = humanfriendly.parse_timespan(duration)
return datetime.timedelta(seconds=seconds)
| StarcoderdataPython |
3264329 | """
MIT License
Copyright (c) 2021 Standby
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, merge, publish, dist... | StarcoderdataPython |
3222850 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import inspect as _inspect
from edward.models.random_variable import RandomVariable as _RandomVariable
from tensorflow.contrib import distributions as _distributions
# Automatically generate random variable c... | StarcoderdataPython |
1796699 | <reponame>lunduniversity/schoolprog-satellite
import sys
from wrap_smhi_api import *
from collections import defaultdict
start_year = 1961
end_year = 2018
margin = 100 # Allowed missed data points
min_no_of_data_points = (end_year - start_year + 1)*365.25 - 200
stations = get_stations()
all_lines = [] # Text lines to o... | StarcoderdataPython |
1796166 | <gh_stars>10-100
class DatasourceI(object):
'''As usual, a reference, as opposed to an interface you actually have to implement'''
def __init__(self):
pass
def __iter__(self):
'''This should yield tuples of label-document (basestring, basestring) pairs.'''
raise NotImplementedError... | StarcoderdataPython |
4842854 | <filename>proxyscrape/__init__.py
# MIT License
#
# Copyright (c) 2018 <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 the rights
# ... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.