id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
1783939 | from clickatell import Transport
class Http(Transport):
"""
Provides access to the Clickatell HTTP API
"""
def __init__(self, apiKey):
"""
Construct a new API instance with the auth key of the API
:param str apiKey: The auth key
"""
self.apiKey = apiKey
... | StarcoderdataPython |
3399199 | from . import db
from werkzeug.security import generate_password_hash, check_password_hash
from flask_login import UserMixin
from . import login_manager
from datetime import datetime
@login_manager.user_loader
def load_user(user_id):
return User.query.get(user_id)
class User(UserMixin,db.Model):
__tablename... | StarcoderdataPython |
1687446 | <reponame>waleoyediran/django-starter
from rest_framework import routers
from demoproject.api import views
api_router = routers.DefaultRouter()
api_router.register(r'users', views.UserViewSet)
| StarcoderdataPython |
119090 | #!/usr/bin/env python
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Unit tests for the contents of device_temp_file.py.
"""
import logging
import os
import sys
import unittest
from pylib import con... | StarcoderdataPython |
186134 | from http.client import HTTPConnection
import sys, urllib.parse
def stop_server (port):
"""send QUIT request to http server running on localhost:<port>"""
conn = HTTPConnection("localhost:%d" % port)
conn.request("PRINT", "/", "THIS IS IT PRINTING")
resp = conn.getresponse()
conn = HTTPConnection(... | StarcoderdataPython |
1641547 | # -*- coding: utf-8 -*-
"""
Created on Thu Dec 9 00:35:02 2021
@author: loaner
"""
import numpy as np
from matplotlib import pyplot as plt
import os
from scipy.interpolate import make_interp_spline
Re_tau1 = [125, 180, 250, 550]
sparese = [0.02, 0.05, 0.1]
dummy_idx1 = 200
path = "raw_resul... | StarcoderdataPython |
1690069 | <gh_stars>0
from Node import Node
class LinkedList:
def __init__(self):
self.head = None
self.tail = None
def append(self, data):
new_node = Node(data)
if self.head is None:
self.head = new_node
self.tail = new_node
else:
new_node.pr... | StarcoderdataPython |
31475 | # -*- encoding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import re
from addonpayments.utils import GenerationUtils
class TestGenerationUtils:
def test_generate_hash(self):
"""
Test Hash generation success case.
"""
test_string = '20120926112654.thestore... | StarcoderdataPython |
2140 | <reponame>WAvdBeek/CoAPthon3
#!/usr/bin/env python
import getopt
import socket
import sys
import cbor
#from cbor2 import dumps, loads
import json
import time
import traceback
from coapthon.client.helperclient import HelperClient
from coapthon.utils import parse_uri
from coapthon import defines
client = None
paths = {... | StarcoderdataPython |
153777 | <reponame>nhtri2003gmail/ctf-write-ups
#!/usr/bin/env python3
from pwn import *
binary = context.binary = ELF('./outbackdoor')
if args.REMOTE:
p = remote('pwn-2021.duc.tf', 31921)
else:
p = process(binary.path)
payload = b''
payload += 0x18 * b'A'
payload += p64(binary.sym.outBackdoor+1)
p.sendlineafter(b'song?... | StarcoderdataPython |
3371274 | import struct
import argparse
def write_spdz(input_folder, data):
f = open(input_folder + "/f0", 'w')
for d in data[0]:
sign = d < 0
output = struct.pack("?", sign)
f.write(output)
output = struct.pack("Q", abs(int(d)))
f.write(output)
f.close()
f = open(input_f... | StarcoderdataPython |
135285 | # File name: main.py
# Copyright 2017 <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
from flask import Flask, current_app, request, jsonify
imp... | StarcoderdataPython |
3358979 | from flask import Flask, render_template
app = Flask(__name__, template_folder='templates')
@app.route("/")
def index():
return render_template("index.html")
# otro
@app.route("/video")
def video():
return render_template("video.html")
# material
@app.route("/material")
def material():
... | StarcoderdataPython |
3390342 | <filename>t4.py<gh_stars>0
print("git session")
| StarcoderdataPython |
1644957 | <gh_stars>0
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import modelcluster.fields
import wagtail.wagtailcore.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('v1', '0004_auto_20160712_1531'),
('jobmanager', '0002_auto_2... | StarcoderdataPython |
3204349 | <gh_stars>1-10
from .builder import build_loss
from .kld_loss import KLDLoss
__all__ = [
'build_loss',
'KLDLoss'
]
| StarcoderdataPython |
1783221 | # Copyright 2021 Google LLC
#
# 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, ... | StarcoderdataPython |
79933 | <gh_stars>1-10
# Copyright 2019 DeepMind Technologies Ltd. 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 r... | StarcoderdataPython |
178231 | ( ( ( nu*(15*nu/2 - 5/2)*r(t)**3/c )*nHat*nHat*nHat*SigmaVec )
+( ( -5*delta*nu*r(t)**3/(2*c) )*nHat*nHat*nHat*S ) ) | StarcoderdataPython |
3227257 | #!/usr/bin/env python3
# Copyright (C) 2021 The Android Open Source Project
#
# 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 requ... | StarcoderdataPython |
1605951 | <filename>itb-backup.py
#!/usr/bin/env python3
# Into The Breach saves backuper/restorer
#
# MAYBE: do not save again the same save (calc files hashes)
# TODO: remove external dependency (on pick)
# TODO: add save name dialogue (save save's meta info like date)
# TODO: config file/env vars support (where to save saves ... | StarcoderdataPython |
199074 | """Test the factory for classifiers"""
import pytest
from src.classification.classifier_factory import ClassifierFactory
from src.classification.image import (
CrossAttentionNetworkClassifier,
MultiTaskEfficientNetB2Classifier,
VGG16Classifier,
)
from src.classification.text import (
BertClassifier,
... | StarcoderdataPython |
3398356 | <gh_stars>0
from .converter import FeatureConverter, MapFeatureConverter
from .dataset import Dataset, MapDataset, map_dataset
__all__ = []
__all__ += ['FeatureConverter', 'MapFeatureConverter']
__all__ += ['Dataset', 'MapDataset', 'map_dataset']
| StarcoderdataPython |
167977 | """
Title | Project
Author: <NAME>
Contact: <<EMAIL>>
Created:
Updated:
License: MIT License <https://github.com/cannlytics/cannlytics-ai/blob/main/LICENSE>
"""
# Initialize a Socrata client.
# app_token = os.environ.get('APP_TOKEN', None)
# client = Socrata('opendata.mass-cannabis-control.com', app_token)
# # Ge... | StarcoderdataPython |
4829894 | <filename>tools/nntool/quantization/multiplicative/quantizers/lstm_mult_ne16.py
# Copyright (C) 2020 GreenWaves Technologies, SAS
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either ... | StarcoderdataPython |
102340 | #!/usr/bin/env python
# coding: utf-8
import argparse
import tensorflow as tf
import logging
import os
from nnrecsys.data.yoochoose.input import get_feature_columns, train_input_fn
from nnrecsys.data.yoochoose import constants
from nnrecsys.models.rnn import model_fn
from nnrecsys.training.hooks import ValidationMetr... | StarcoderdataPython |
1657521 | # -*- coding: utf-8 -*-
def get_unique_method_id(view_method, request):
# todo: test me as UniqueMethodIdKeyBit
return "%s|%s" % (view_method.__name__, request.path.replace('/', '|'))
# return u'.'.join([
# view_instance.__module__,
# view_instance.__class__.__name__,
# view_method.... | StarcoderdataPython |
102455 | from django import template
from django.db.models import Model
from django.http import Http404
from django.urls import reverse, resolve
from formfactory import models
register = template.Library()
@register.tag()
def render_form(parser, token):
"""{% render_form <form_slug> %}"""
tokens = token.split_conten... | StarcoderdataPython |
3221351 | import numpy as np
import torch as th
from torch import Tensor
# Reference: https://github.com/aayushmnit/Deep_learning_explorations/blob/master/1_MLP_from_scratch/Building_neural_network_from_scratch.ipynb
class Layer:
"""
A building block. Each layer is capable of performing two things:
- Process inp... | StarcoderdataPython |
1723273 | <filename>Chaos/logistic.py
from manimlib.imports import *
def logistic(r,x):
return r*x*(1-x)
r = 3.5
class logistic_map(MovingCameraScene):
def func(self,t):
return np.array([t,logistic(r,t),0])
def construct(self):
s = Square(color=YELLOW)
s.scale(0.5);s.move_to(np.array([0.5,0.5,0]))
T = Title("Logistic... | StarcoderdataPython |
1719001 | #!/usr/bin/env python3
# <NAME> (bithack)
# 111601008
# Question No. 2a
# Here we are again. This time no bunny is floating in the middle of the ocean.
# And no agent want to find the dirt. This time we will write a script to count the
# number of the words in a file.
import sys
import os.path
def main(argv):
... | StarcoderdataPython |
1772136 | <filename>notebooks/data_generator.py<gh_stars>0
# Request Deps ----->
import pandas as pd
import requests
import json
import csv
import time
import datetime as dt
import praw
from psaw import PushshiftAPI
# Request Deps ----->
api = PushshiftAPI()
def grabdata(iterations,outputs):
runge = range(1,iterations)
... | StarcoderdataPython |
31294 | from typing import Any, List, Mapping, Sequence
import jsonschema
from dataclasses import dataclass, field
from sqlalchemy.orm import scoped_session
from vardb.datamodel.jsonschemas.load_schema import load_schema
from vardb.datamodel import annotation
@dataclass
class ConverterConfig:
elements: Sequence[Mapping[s... | StarcoderdataPython |
3212865 | <filename>ex25.py
def break_words(stuff):
"""This function will break up words for us."""
words=stuff.split('')
return words
def sort_words(words):
"""Sorts the words."""
return sorted(words)
def print_first_word(words):
"""Prints the first word after popping it off."""
word=words.pop(0)
... | StarcoderdataPython |
3346249 | <gh_stars>1-10
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from . import ElasticsearchTestCase
class TestUnicode(ElasticsearchTestCase):
def test_indices_analyze(self):
self.client.indices.analyze(body='{"text": "привет"}')
| StarcoderdataPython |
56667 | <gh_stars>0
import gin
import librosa
import numpy as np
import tensorflow as tf
import pretty_midi
PHONEMES = ['sil', 'b','d','f','g','h','j','k','l','m','n','p','r','s','t','v','w','z','zh','ch','sh','th','dh','ng','y','ae','ei','e','ii','i','ai','a','ou','u','ao','uu','oi','au','eo','er','oo']
PHONEME2ID={}
for i,p... | StarcoderdataPython |
3352836 | <filename>exampleread.py
##############################################################################
## This file is part of 'smurftestapps'.
## It is subject to the license terms in the LICENSE.txt file found in the
## top-level directory of this distribution and at:
## https://confluence.slac.stanford.edu/dis... | StarcoderdataPython |
1681725 | """
Nomad Regions Endpoint Access
"""
from nomad.api import base
class Regions(base.Endpoint):
"""Get information about the regions nomad knows about. This are
generally very low level, and not really useful for clients.
"""
def list(self):
"""Returns the known region names
:rtype:... | StarcoderdataPython |
3354686 | import os
import logging
import log_wrapper
import sys
FILE_NAME = "./attributes.json"
STRING_TO_FIND = '"x-id":'
BASE = 140
OFFSET = 150
def renumber(argv):
"""
Read file and re-number all parameters/attributes.
This should only be used during initial development.
Once 'released' the x-id cannot c... | StarcoderdataPython |
62390 | from Statistics.ZScore import zscore
from Statistics.Mean import mean
from Statistics.StandardDeviation import standard_deviation
from Calculator.Subtraction import subtraction
from Calculator.Division import division
from Calculator.Multiplication import multiplication
from Calculator.Addition import addition
def po... | StarcoderdataPython |
192821 | <reponame>ecoo-app/ecoo-backend
# Generated by Django 3.1 on 2020-09-10 21:18
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("profiles", "0005_userprofile_place_of_origin"),
]
operations = [
migrations.AddF... | StarcoderdataPython |
3313808 | class Module:
name = ""
info = ""
options = dict()
def run():
pass
| StarcoderdataPython |
3354732 | <filename>vyperlogix/gds/man2c.py
'''
Converts a text file into a C function called manpage that prints
the indicated text to a stream.
Copyright (C) 2002 GDS Software
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Sof... | StarcoderdataPython |
1740368 | <gh_stars>0
import socket
import select
import time
from threading import Thread, Timer
from typing import Dict, List, Tuple
import packet
from packet import MAX_PACKET_SIZE, Packet, SEQ_LIM, FINISHER_DATA
def grouper(iterable, n, fillvalue=None):
"Collect data into fixed-length chunks or blocks"
# grouper('... | StarcoderdataPython |
1742798 | import datetime
import enum
import attr
import six
from dbnd._core.utils.timezone import make_aware, utcnow
RESULT_PARAM = "result"
CURRENT_DATETIME = utcnow()
CURRENT_TIME_STR = CURRENT_DATETIME.strftime("%Y%m%d_%H%M%S")
CURRENT_DATE = CURRENT_DATETIME.date()
class EnvLabel(object): # env label
dev = "dev"... | StarcoderdataPython |
1656937 | PRIMITIVE_TYPES = (int, str, float, bool)
SEQUENCE_TYPES = (tuple, set, list)
MAPPING_TYPES = dict
ComponentName = str
TargetName = str
| StarcoderdataPython |
1773400 | <reponame>mgorzkowski/abn
#!/usr/bin/env python
from ctypes import *
# Type definitions
# _abn_unit must be the same type like abn_unit in abn/include/abn.h file one
_abn_unit = c_uint32
# main type of ABN library
class _abn_t(Structure):
_fields_ = [("chain", POINTER(_abn_unit)),
("volume", c_uint)]
# pointers... | StarcoderdataPython |
76801 | import os
import sys
import collections
import typing
import re
from json import JSONDecoder
from typing import List
import pandas as pd
import requests
from d3m.primitive_interfaces.transformer import TransformerPrimitiveBase
from d3m.primitive_interfaces.base import CallResult
from d3m import container, utils
from d... | StarcoderdataPython |
3850 | <filename>main.py
import tensorflow as tf
import os.path
import warnings
from distutils.version import LooseVersion
import glob
import helper
import project_tests as tests
#--------------------------
# USER-SPECIFIED DATA
#--------------------------
# Tune these parameters
NUMBER_OF_CLASSES = 2
IMAGE_SHAPE = (160, ... | StarcoderdataPython |
58615 | import pathlib
import typing
import urllib.parse
_PLUGIN_DIR = pathlib.Path(__file__).parent
PLUGIN_DIR = str(_PLUGIN_DIR)
CONFIGS_DIR = str(_PLUGIN_DIR.joinpath('configs'))
SCRIPTS_DIR = str(_PLUGIN_DIR.joinpath('scripts'))
def scan_sql_directory(root: str) -> typing.List[pathlib.Path]:
return [
path
... | StarcoderdataPython |
1742095 | #!/usr/bin/env python
# stdlib imports
import os.path
# third party libraries
from configobj import ConfigObj
from validate import Validator, VdtTypeError
def __getCustomValidator():
'''
Return a Validator object with the custom types we have defined here.
Returns:
Validator object with custom ... | StarcoderdataPython |
1765077 | <reponame>optik/minicms
import time
from selenium import webdriver
from django.conf import settings
from django.test import LiveServerTestCase
class FrontendTestCase(LiveServerTestCase):
fixtures = ['fixtures/content.yaml',]
def setUp(self):
self.browser = webdriver.Firefox()
def tearDown(self... | StarcoderdataPython |
3328731 | <filename>env.py<gh_stars>1-10
# Copyright 2018 Google 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless re... | StarcoderdataPython |
71442 | import numpy as np
from scipy.signal import hilbert
from PyEMD.compact import filt6, pade6
# Visualisation is an optional module. To minimise installation, `matplotlib` is not added
# by default. Please install extras with `pip install -r requirement-extra.txt`.
try:
import pylab as plt
except ImportError:
pa... | StarcoderdataPython |
1696859 | <reponame>mmaaz60/ssl_for_fgvc
import sys
class Model:
"""
This class initiates the specified model.
"""
def __init__(self, config):
"""
Constructor, select the model specified in the configuration file
:param config: Configuration class object
"""
# Select the... | StarcoderdataPython |
1723178 | DEFAULT_MOUNT_SHARE = "True"
MAX_SHARES_PER_FPG = 16
def create_metadata(backend, cpg, fpg, share_name, size,
readonly=False, nfs_options=None, comment='',
fsMode=None, fsOwner=None):
return {
'id': None,
'backend': backend,
'cpg': cpg,
'fpg'... | StarcoderdataPython |
1605869 | # -*- coding: utf-8 -*-
from pathlib import Path
from setuptools import find_packages, setup
README = (Path(__file__).parent / "README.md").read_text()
REQUIRES = ["pluggy>=1.0,<1.1", "robotframework>=4.0,<5.0"]
EXTRAS_REQUIRE = {"test": ["pytest>=5.2.2,<6.3.0" "black==21.12b0"]}
def get_version():
global_vars... | StarcoderdataPython |
3285115 | <gh_stars>10-100
# Copyright 2011 SRI International
#
# 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... | StarcoderdataPython |
53510 | <reponame>fei-protocol/checkthechain
from __future__ import annotations
import math
import typing
if typing.TYPE_CHECKING:
import aiohttp
import toolstr
url_template = 'https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&order=market_cap_desc&per_page=100&page={page}&sparkline=true&price_change_perc... | StarcoderdataPython |
1665336 | import ChromaPy32 as Chroma # Import the Chroma Module
from time import sleep
Keyboard = Chroma.Keyboard() # Initialize a new Keyboard Instance
RED = (255, 0, 0) # Initialize a new color by RGB (RED,GREEN,BLUE)
GREEN = (0, 255, 0)
for y in range(0, Keyboard.MaxRow): # Use Keyboard.MaxRow as an iteration border i... | StarcoderdataPython |
57169 | <reponame>BLannoo/Advent-of-Code-2021
from pathlib import Path
from day4.board import Board
def silver(input_file_path: Path) -> int:
number_sequence, boards = parse_input(input_file_path)
for number in number_sequence:
for board in boards:
board.mark(number)
if board.is_won()... | StarcoderdataPython |
1749776 | from subprocess import Popen, PIPE, STDOUT
import sys
pomXml = """
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId... | StarcoderdataPython |
3248198 | <reponame>alexbarten/adventofcode2021<filename>src/december06/compute_fishschool_growth_smart.py
def main():
fishschool = fishschool_to_dict("src/december06/fish.txt")
grown_school = reduce_and_grow(fishschool, 256)
number_of_fish = 0
for value in grown_school.values():
number_of_fish += value
... | StarcoderdataPython |
127033 | """
--- Day 2: 1202 Program Alarm ---
-- Part One --
An Intcode program is a list of integers separated by commas (like 1,0,0,3,99).
To run one, start by looking at the first integer (called position 0).
Here, you will find an opcode - either 1, 2, or 99. The opcode indicates what to do;
for example, 99 means that th... | StarcoderdataPython |
80476 | <reponame>yingcuhk/Distributed-and-Asynchronos-SGD<filename>src/LG.py
mport gzip
import os
import sys
import numpy as np
import cPickle
import tensorflow as tf
class LogisticRegression(object):
def __init__(self):
self.X = tf.placeholder("float", [None, 784])
self.Y = tf.placeholder("float", [... | StarcoderdataPython |
136232 | import subprocess
import json
if __name__ == '__main__':
filename ="/tmp/test.json"
f = open(filename,"w")
result = subprocess.check_output(['kubectl','get','pods','-o','json']).rstrip()
f.write(result)
f.close()
#
f = open(filename,"r")
data = json.load(f)
#print(data)
print da... | StarcoderdataPython |
52234 | <reponame>adger-me/you-get
#!/usr/bin/env python
''' WIP
def main():
script_main('you-get', any_download, any_download_playlist)
if __name__ == "__main__":
main()
'''
| StarcoderdataPython |
82746 | from DesignPatterns.Factory.Sedan import Sedan
from DesignPatterns.Factory.SUV import SUV
from DesignPatterns.Factory.Hatchback import Hatchback
class VehicleFactory:
def generate(self, vehicle_type):
if vehicle_type is 'Sedan':
return Sedan().produce_vehicle()
elif vehicle_type is 'S... | StarcoderdataPython |
4804390 | <gh_stars>0
import data_io
import pandas as pd
import requests
from typing import List
from debug_tools import *
"""
Function that takes as input a job title and returns a dataframe
with the average salary by state for that job title.
"""
def scrape_salary_table_for_job_title(job_name: str) -> pd.DataFrame... | StarcoderdataPython |
54134 | <filename>Chapter 08/Chap08_Example8.24.py
class Student:
def __init__(self):
self.name = 'Mohan'
self.age = 10
self.country = 'India'
def mydelete(self):
del self.age
myobj1 = Student()
print("Before deleting: ")
print(myobj1.__dict__)
del myobj1.country # dele... | StarcoderdataPython |
3228012 | <filename>Pointnet/pointnet_segmentation.py<gh_stars>0
from __future__ import print_function
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
from torch.autograd import Variable
import numpy as np
import torch.nn.functional as F
from Pointnet import PointNet
class PointNetSeg(nn.Mod... | StarcoderdataPython |
186223 | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
from queue import PriorityQueue
class Solution:
def mergeKLists(self, lists: List[ListNode]) -> ListNode:
class Wrapper():
def __init__(self, no... | StarcoderdataPython |
4824734 | from optparse import OptionParser
import pprint
import pymongo
def main():
parser = OptionParser()
parser.add_option("-s", "--seconds-running", dest="seconds", default=None,
help="search for current Ops where the secs_running is greater than or equal to this value")
parser.add_o... | StarcoderdataPython |
1704793 | <gh_stars>0
""" graph -> InChI string conversion
"""
from ._to_inchi import with_atom_inchi_numbers
__all__ = ['with_atom_inchi_numbers']
| StarcoderdataPython |
1689236 | import redis
class Config(object):
"""配置信息"""
# 随机加密盐值,随机即可
# SECRET_KEY = "<KEY>"
SECRET_KEY = ""
AUTH_SALT = "sYjLRzKQG4vra"
EXPIRES_IN = 3600
# 文件保存路径
UPLOAD_FOLDER = '/static'
# 数据库
# SQLALCHEMY_DATABASE_URI = "mysql://root:sa123@192.168.126.131:3307/metaphysics"
SQL... | StarcoderdataPython |
3296630 | <reponame>RSB4760/apq8016_external_vixl<gh_stars>0
#!/usr/bin/env python2.7
# Copyright 2014, ARM Limited
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code mu... | StarcoderdataPython |
1675011 | """
builtin_bracket.py
"""
from __future__ import print_function
from _devbuild.gen.id_kind_asdl import Id
from _devbuild.gen.runtime_asdl import value, quote_e, quote_t
from _devbuild.gen.syntax_asdl import (
word, word_e, word_t, word__String,
bool_expr,
)
from _devbuild.gen.types_asdl import lex_mode_e
fro... | StarcoderdataPython |
1640553 | <reponame>angad11121/red-eye-meme
from flask import Flask, request, render_template, url_for, redirect
from PIL import Image
import numpy as np
import os
import cv2
from gaze_tracking import GazeTracking
from werkzeug.utils import secure_filename
ALLOWED_EXTENSIONS = {'jpg', 'jpeg', 'png'}
DIRNAME = os.path.dirname(__... | StarcoderdataPython |
1600014 | # ______________________________________________________________________________
# ******************************************************************************
#
# The simplest robot task: Just go and reach a point
#
# ______________________________________________________________________________
# ******************... | StarcoderdataPython |
161926 | import io
import aiohttp
from PIL import Image
from plugin_system import Plugin
plugin = Plugin('Зеркало', usage=["отзеркаль <прикреплённые фото> - отзеркаливает прикреплённое фото"])
FAIL_MSG = 'К сожалению, произошла какая-то ошибка :('
@plugin.on_command('отзеркаль')
async def mirror(msg, args):
photo = Fa... | StarcoderdataPython |
1650786 | import sys
sys.path.append("..")
from models.network import *
from utils.utils import get_args
from utils.config import process_config
from utils.dirs import create_dirs
from data_loader.data_generator import *
from trainer.trainer import Trainer
from utils.logger import Logger
def main():
try:
args = get_... | StarcoderdataPython |
1740489 | <reponame>DaleProctor/tscharts
#(C) Copyright <NAME> 2017-2020
#(C) Copyright Thousand Smiles Foundation 2017-2020
#
#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/licens... | StarcoderdataPython |
4840625 | # -*- coding:utf-8 -*-
# Copyright 2015 NEC Corporation. #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); #
# you may not use this file except in compliance with the License... | StarcoderdataPython |
1791990 | import smtplib
import src.irulez.log as log
import src.irulez.util as util
from abc import ABC, abstractmethod
logger = log.get_logger('mail_processor')
class MailProcessor(ABC):
@abstractmethod
def send_mail(self, json_object) -> None:
pass
class AuthenticateSMTPProcessor(MailProcessor):
def _... | StarcoderdataPython |
64120 | from math import trunc
numero = float(input('Digite um numero inteiro: '))
print('O valor digitado foi {} e a sua porção inteira é {}'.format(numero, trunc(numero)))
'''
int (numero) => tambem funciona para estrair um inteiro
'''
| StarcoderdataPython |
197820 | <reponame>peanutbutter144/nixpkgs<gh_stars>100-1000
# Ugliest Python code I've ever written. -- aszlig
import sys
def get_plist(path):
in_pack = False
in_str = False
current_key = None
buf = ""
packages = {}
package_name = None
package_attrs = {}
with open(path, 'r') as setup:
f... | StarcoderdataPython |
3275213 | <reponame>lanargh/FaceMaskDetection<filename>utils.py<gh_stars>0
import os
import random
from os.path import basename
from shutil import copyfile
from zipfile import ZipFile
def genlabels(labels):
f = open("labels.txt","w+")
f.write("__ignore__\r\n")
f.write("_background_\r\n")
for label in labels:
... | StarcoderdataPython |
3202951 | import os
import pytest
from intervaltree import Interval
from viridian_workflow import self_qc, primers
this_dir = os.path.dirname(os.path.abspath(__file__))
data_dir = os.path.join(this_dir, "data", "primers")
class StatsTest:
def __init__(self, fail):
self.fail = fail
self.log = []
se... | StarcoderdataPython |
3317368 | This is file3.
| StarcoderdataPython |
109387 | from django.core.management.base import BaseCommand
from account.utils import send_bulk_reminders
class Command(BaseCommand):
help = 'Send reminders to users who have not signed in today'
def handle(self, *args, **options):
self.stdout.write('Preparing to send reminder emails...')
send_bulk_... | StarcoderdataPython |
1785362 | <filename>projects/src/main/python/CodeJam/Y11R5P1/dennislissov/generated_py_bb93a4d1acf540c3b7c8dfd80359bd28.py
import sys
sys.path.append('/home/george2/Raise/ProgramRepair/CodeSeer/projects/src/main/python')
from CodeJam.Y11R5P1.dennislissov.A import *
def func_3ba6780ca418469a885da55554034725(y, x):
area += (x... | StarcoderdataPython |
3369777 | # -*- coding: utf-8 -*-
"""
Created on Thu May 14 11:50:56 2020
@author: <NAME>
"""
# %% Import packages
import os
# %% Set the working directory
# IMPORTNAT!! make sure to set the working directory to the path where you
# stored the python files, including this script and the Data & Models folders.
os.chdir('D:/One... | StarcoderdataPython |
4830722 | <gh_stars>0
#Embedded file name: ACEStream\Core\DecentralizedTracking\pymdht\core\message_tools.pyo
import sys
import socket
from socket import inet_ntoa, inet_aton
import logging
import bencode
from identifier import Id, ID_SIZE_BYTES, IdError
from node import Node
logger = logging.getLogger('dht')
IP4_SIZE = 4
IP6_SI... | StarcoderdataPython |
1763213 | <filename>servo/system_config.py
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""System configuration module."""
import collections
import glob
import logging
import os
import re
import xml.etree.... | StarcoderdataPython |
1691552 | <reponame>hmmartiny/LazyFunctions
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import gridspec as gridspec
"""
An attempt at making a class for drawing advanced dendrograms with Python.py
Both linear and circular (polar) dendrograms.
"""
class Dendogram:
"""Inspired by https://stackoverflow.... | StarcoderdataPython |
4812904 | """
Constants module
"""
class Status(object):
"""
Utim status class
"""
STATUS_NEWBORN = 'STATUS_NEWBORN'
STATUS_SRP = 'STATUS_SRP'
STATUS_CONFIGURING = 'STATUS_CONFIGURING'
STATUS_TESTING = 'STATUS_TESTING'
STATUS_DONE = 'STATUS_DONE'
STATUS_NO_CONFIG = 'STATUS_NO_CONFIG'
ST... | StarcoderdataPython |
3200656 | <reponame>AdityaSidharta/shopee_data_science
import math
import torch
def get_batch_info(dataloader):
n_obs = len(dataloader.dataset)
batch_size = dataloader.batch_size
n_batch_per_epoch = math.ceil(n_obs / float(batch_size))
return n_obs, batch_size, n_batch_per_epoch
def img2tensor(img_array, devi... | StarcoderdataPython |
3320343 | <gh_stars>1-10
# Copyright (c) 2017-present, Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | StarcoderdataPython |
179250 | <filename>gdcv/db/base_match_state.py
from sqlalchemy import Column, String, Integer, BigInteger, PrimaryKeyConstraint
class BaseMatchState(object):
__table_args__ = (
PrimaryKeyConstraint('event_key', 'match_id', 'wall_time'),
)
event_key = Column(String(16), nullable=False) # Like 2017nyny
... | StarcoderdataPython |
1622160 | <filename>tests/test_parser.py
"""Define tests for parser endpoints."""
import aiohttp
import pytest
from regenmaschine import Client
from .common import TEST_HOST, TEST_PASSWORD, TEST_PORT, load_fixture
@pytest.mark.asyncio
async def test_parsers_current(aresponses, authenticated_local_client):
"""Test getting... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.