id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
196376 | """create order book snapshot table
Revision ID: ca6cd71568db
Revises: 76f253d77eba
Create Date: 2019-09-22 01:33:59.794177
"""
from antalla.settings import TABLE_PREFIX
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "ca6cd71568db"
down_revision = "76f253d77eba"
b... | StarcoderdataPython |
1687990 | <gh_stars>0
import re
from itertools import chain
import pkgutil
from warnings import warn
from functools import partial
import os
import subprocess
standard_lib_dir = os.path.dirname(os.__file__)
path_sep = os.path.sep
def ensure_slash_suffix(s: str):
if not s.endswith(path_sep):
s += path_sep
retur... | StarcoderdataPython |
3328196 | from redisolar.dao.redis.base import RedisDaoBase
from redisolar.dao.redis.capacity_report import CapacityReportDaoRedis
from redisolar.dao.redis.feed import FeedDaoRedis
from redisolar.dao.redis.fixed_rate_limiter import FixedRateLimiter
from redisolar.dao.redis.meter_reading import MeterReadingDaoRedis
from redisolar... | StarcoderdataPython |
3286461 | import os.path
from PyQt4 import QtCore, QtGui
from PyQt4.QtCore import QEventLoop, QEvent, QObject
import logging
from gii.core import app
_cursorCache = {}
def getCursor(name, fallback=None):
global _cursorCache
if not name: return QtGui.QCursor()
cursor = _cursorCache.get(name,None)
if cursor: return cursor... | StarcoderdataPython |
75645 | import os, sys, json
import argparse
try:
from patrace import InputFile, OutputFile, Call
except ImportError:
print 'patrace (Python interface of PATrace SDK) is required.'
sys.exit(1)
def main():
ap = argparse.ArgumentParser(description="Output the call numbers of a certain GLES function.")
ap.ad... | StarcoderdataPython |
3350003 | Django==3.2.5
django-cryptography==1.0
django-crispy-forms==1.12.0 | StarcoderdataPython |
1688480 | <filename>deploy/python/keypoint_infer.py
# Copyright (c) 2020 PaddlePaddle 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/license... | StarcoderdataPython |
190583 | fout=open('oops.txt','wt')
print('oops, i created a file',file=fout)
fout.close()
fin=open('oops.txt','rt')
po=fin.read()
fin.close()
print(po) | StarcoderdataPython |
1675599 | # app/controllers/event.py
# coding:utf-8
from flask import Flask, render_template, request, redirect, url_for
from app import app
from app.models.event import Event
import os
import datetime
@app.route("/event/edit")
@app.route("/event/edit/<int:event_id>", methods=['GET', 'POST'])
def edit_event(event_id=-1):
... | StarcoderdataPython |
4833744 | <filename>tools/lines.py
import random
import codecs
class LinesAbstract:
def __init__(self, path_or_list):
if isinstance(path_or_list, str):
self.lines = list([line.strip() for line in codecs.open(path_or_list, "r", "utf-8")])
else:
self.lines = list(path_or_list)
s... | StarcoderdataPython |
1687098 | <reponame>NicoAN42/Iris-Eye-Care<gh_stars>1-10
import os
import cv2
class Dataset:
"""
Representing dataset of images
"""
def __init__(self, root_folder: str, img_format: format, images=None):
self.root = root_folder
self.img_format = img_format
self.images_names = None
... | StarcoderdataPython |
4820158 | """
Test the convergence of a small diffusion problem discretized with the local
discontinuous Galerkin method. The polynomial order is 5. To utilize the
visualization capabilities, you need to have Paraview and scikits.delaunay
installed.
References
----------
[1] <NAME> and <NAME>. Smoothed Aggregation Multigrid... | StarcoderdataPython |
3282104 | import gym
from gym.spaces import Box, Discrete, Tuple
import numpy as np
import unittest
import ray
from ray.rllib.models import ModelCatalog, MODEL_DEFAULTS, ActionDistribution
from ray.rllib.models.tf.tf_modelv2 import TFModelV2
from ray.rllib.models.tf.tf_action_dist import TFActionDistribution
from ray.rllib.mode... | StarcoderdataPython |
1648392 | <filename>backend_server/operations.py<gh_stars>1-10
import pickle
import sys
import os
import redis
from bson.json_util import dumps, loads
import json
from datetime import datetime
sys.path.append(os.path.join(os.path.dirname(__file__), '..','common'))
import mongodb_client
from cloudAMQP_client import CloundAMQPCli... | StarcoderdataPython |
1751401 | # 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
# distrib... | StarcoderdataPython |
28104 | <reponame>supro200/sdwan-auto-upgrade
JUMPHOST = "jumphost"
VMANAGE = "10.121.6.35"
AZURE_STORAGE_ACCOUNT = "azure-storage-account" | StarcoderdataPython |
1644609 | # Please, do not use the built-in python functions like map, reduce, len, etc.
# that solve the same problems and try to solve it yourself instead.
def foldl(function, xs, acc):
for x in xs:
acc = function(acc, x)
return acc
def append(xs, ys, extend=True):
if isinstance(ys, list) and... | StarcoderdataPython |
1676930 | <reponame>nizovn/luna-sysmgr<gh_stars>1-10
# Copyright (C) 2011 Google Inc. 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 must retain the above copyright... | StarcoderdataPython |
1622288 | <reponame>FI-Mihej/Cengal
#!/usr/bin/env python
# coding=utf-8
# Copyright © 2016 ButenkoMS. All rights reserved. Contacts: <<EMAIL>>
#
# 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
#
# ... | StarcoderdataPython |
3202530 | from unittest.mock import MagicMock
from graphql_relay import to_global_id
from creator.studies.models import Study
from creator.projects.models import Project
from creator.events.models import Event
from creator.studies.factories import StudyFactory
from creator.organizations.factories import OrganizationFactory
from ... | StarcoderdataPython |
3350164 | <filename>multitoken/admin.py
from django.contrib import admin
from . import models
class TokenAdmin(admin.ModelAdmin):
list_display = ('user', 'key', 'client', 'created')
fields = ('user', 'client', 'created')
ordering = ('-created',)
readonly_fields = ('created',)
admin.site.register(models.Token,... | StarcoderdataPython |
3317184 | <gh_stars>1-10
#!/usr/bin/env python
import sys, os
ROOT = os.path.abspath('%s/../..' % os.path.abspath(os.path.dirname(__file__)))
sys.path.append(ROOT)
os.environ['DJANGO_SETTINGS_MODULE'] = 'qurkexp.settings'
from django.core.management import setup_environ
from django.conf import settings
from qurkexp.join.models ... | StarcoderdataPython |
3301402 | <reponame>ncar-hackathons/handson-notebooks
a_col_max = a.max(axis=1)
print(a_col_max)
a_row_mean = a.mean(axis=0)
print(a_row_mean)
i_j_index_min = np.argwhere(a == a.min()) # Find index of the overall minimum
print(i_j_index_min) | StarcoderdataPython |
4836038 | from bs4 import BeautifulSoup
from pathlib import Path
from subprocess import run
from shutil import copytree, rmtree
import pytest
path_tests = Path(__file__).parent.resolve()
path_base = path_tests.joinpath("sites", "base")
@pytest.fixture(scope="session")
def sphinx_build(tmpdir_factory):
class SphinxBuild:
... | StarcoderdataPython |
3306593 | #!/usr/bin/python
#---------------------------------------------------------------------#
# test.py #
#---------------------------------------------------------------------#
# test package functionality #
#------------... | StarcoderdataPython |
123849 | <reponame>BjornChrisnach/Learn_python_3_The_hard_way<gh_stars>0
# store the input from the user into age
age = input("How old are you? ")
# store the input from the user into height
height = input(f"You're {age}? Nice. How tall are you? ")
# store the input from the user into weight
weight = input("How much do you weig... | StarcoderdataPython |
151068 | import rod_math_core
from ndc_extractor import main as cc_extractor
| StarcoderdataPython |
3290528 | <gh_stars>0
from crispy_forms.helper import FormHelper
from django import forms
from .models import Post
class PostForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(PostForm, self).__init__(*args, **kwargs)
self.fields['title'].label = 'Titles'
self.fields['draft'].label =... | StarcoderdataPython |
1684380 | <gh_stars>0
import config
import schemas
__all__ = ['api', 'config', 'crud', 'main', 'models', 'schemas', 'utils']
| StarcoderdataPython |
1728095 | <gh_stars>10-100
# coding=utf-8
# Copyright 2018 The Hypebot 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
#
... | StarcoderdataPython |
178337 | from upwork import config
def test_config_initialization():
cfg = config.Config(
{
"client_id": "keyxxxxxxxxxxxxxxxxxxxx",
"client_secret": "<KEY>",
"redirect_uri": "https://a.callback.url",
"token": {"access_token": "a"},
}
)
assert cfg.cli... | StarcoderdataPython |
47632 | # Limiar da Matriz Quadrada :: github.com/sliatecinos
# ================================================================================
# Ref.externa: https://www.facebook.com/groups/608492105999336/permalink/2061101090738423/
# Entradas do usuario (lado, limiar, ordem da matriz)
lado_diagonal = input('Estarao "... | StarcoderdataPython |
1719598 | import boto3
import requests
import pandas as pd
import common.helpers.github as gt
from datetime import datetime, timedelta
from civictechprojects.models import Project, ProjectLink
from django.core.management.base import BaseCommand, CommandError
github_api_endpoint = 'https://api.github.com'
class Command(BaseCom... | StarcoderdataPython |
1617047 | <filename>train_ppo.py
from agent import Actor, Critic
from agent import Critic as Var_Critic
import hyper_params as h
import torch
import gym
from torch.utils.tensorboard import SummaryWriter
from torch import optim
import numpy as np
import torch.nn.functional as F
import re
import math
import pathlib
import time
imp... | StarcoderdataPython |
4821693 | <gh_stars>10-100
""" Ipsen-Mikhailov Distance
Given two graphs, this method quantifies their difference by comparing their
spectral densities. This spectral density is computed as the sum of Lorentz distributions :math:`\\rho(\\omega)`:
.. math::
\\rho(\\omega) = K \\sum_{i=1}^{N-1} \\frac{\\gamma}{ (\\omega - \... | StarcoderdataPython |
1699602 | <reponame>Adnan-Khan7/ComputerVisionFundamentals
import torch
from torch.nn.functional import interpolate
def _resize(tensor, size, mode='bilinear'):
"""Resize the image.
Args:
tensor (torch.Tensor): The image tensor to be resized.
size (tuple of int): Size of the resized image (height, width... | StarcoderdataPython |
1797952 | <gh_stars>100-1000
from pudzu.charts import *
import seaborn as sns
from pudzu.dates import *
import dateparser
CONFEDERATE = ["South Carolina", "Mississippi", "Florida", "Alabama", "Georgia", "Louisiana", "Texas"] + ["Arkansas", "North Carolina", "Tennessee", "Virginia"]
UNION = ["California", "Connecticut", "I... | StarcoderdataPython |
1619858 | <gh_stars>1-10
# Copyright (c) 2010 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.
{
'variables': {
'chromium_code': 1,
},
'includes': [
'../../build/common.gypi',
'../../ceee/common.gypi',
],
'targe... | StarcoderdataPython |
1606942 | """
Django settings for my_api project.
Generated by 'django-admin startproject' using Django 3.0.7.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
"""
import os
fro... | StarcoderdataPython |
1607348 | <filename>3.Longest Substring Without Repeating Characters.py<gh_stars>0
# https://leetcode.com/problems/longest-substring-without-repeating-characters/
class Solution:
def lengthOfLongestSubstring(self, s):
"""
:type s: str
:rtype: int
"""
longest = ""
curr = ""
... | StarcoderdataPython |
26405 | import pytest
from Tree import Tree
class TestClass:
def setup_class(self):
pass
def test_tree(self):
tree = Tree()
tree.add(3)
tree.add(4)
tree.add(0)
tree.add(8)
tree.add(2)
tree.print_tree()
assert True
def test_compare_trees(se... | StarcoderdataPython |
152958 | <reponame>unfoldingWord-dev/tools
# -*- coding: utf-8 -*-
# This program adds 2nd level header (H2) immediately after top level (H1) header if missing in markdown files.
# A level 2 header containing the word for "Definition" is required in every tW markdown file.
# Assumes input .md files are already in UTF-8 format.
... | StarcoderdataPython |
32696 | <filename>P20-Stack Abstract Data Type/Stack - Base Converter.py
class Stack:
def __init__(self):
self.items = []
def is_empty(self): # test to see whether the stack is empty.
return self.items == []
def push(self, item): # adds a new item to the top of the stack.
self.items.appe... | StarcoderdataPython |
1656000 | <reponame>cczzaa101/CS412_Final_Project<gh_stars>0
from random import randrange,seed
import numpy as np
import pandas as pd
from copy import deepcopy
from numpy import array,var,mean
from numpy import polyfit
import json
#parameter set up
start_ind = 0
forest_num = 150
D_array = []
tree_array = []
second_fit_model = [... | StarcoderdataPython |
1749954 | <filename>lib/gitspindle/monkey.py<gh_stars>100-1000
# Set the spindle attribute
import github3.gists
# Monkeypatch github3.gists.Gist to behave more like a repo
github3.gists.gist._Gist.ssh_url = property(lambda self: 'git@gist.github.com:/%s.git' % self.id)
github3.gists.gist._Gist.clone_url = property(lambda self: ... | StarcoderdataPython |
174080 | <gh_stars>0
import enum
import functools
import typing as ta
from omnibus import check
from omnibus import defs
from .. import datatypes as dt
T = ta.TypeVar('T')
U = ta.TypeVar('U')
class Bound(enum.Enum):
BELOW = 1
EXACTLY = 2
ABOVE = 3
@functools.total_ordering
class Marker(ta.Generic[T]):
d... | StarcoderdataPython |
1707225 | from django.shortcuts import render
from .models import DadosPessoais, Customers
from .serializer import DadosPessoaisSerializer, CustomersSerializer
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework import status
def portfolio_exibir(request):
pessoa = Da... | StarcoderdataPython |
1617410 | <filename>src/testcase/GN_APP/case/GN_APP_DEVICE_PAGE/GN_APP_DEVICE_PAGE_002.py
# coding=utf-8
from src.testcase.GN_APP.WidgetOperation import *
class GNAPPDevicePage2(WidgetOperation):
@case_run(False)
def run(self):
self.case_module = u"设备页" # 用例所属模块
self.case_title = u'设备配网过程中,返回按钮功能检查' #... | StarcoderdataPython |
3277424 | # Auto generated by 'inv collect-airflow'
from airfly._vendor.airflow.models.baseoperator import BaseOperator
class EmrCreateJobFlowOperator(BaseOperator):
aws_conn_id: "str"
emr_conn_id: "str"
job_flow_overrides: "typing.Union[str, typing.Dict[str, typing.Any], NoneType]"
region_name: "typing.Union[s... | StarcoderdataPython |
103670 | # Copyright (c) 2014 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the License);
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, so... | StarcoderdataPython |
3245707 | <reponame>NiclasEriksen/rpg_procgen
import math
import random
from functions import *
from spanning_tree import get_connections
import gridmancer
import numpy as np
from collections import Counter
import jsonpickle # For saving the dungeon
class DungeonGenerator:
def __init__(self, logger, config=None):
... | StarcoderdataPython |
3305683 | <filename>alf/utils/dist_utils.py
# Copyright (c) 2020 Horizon Robotics and ALF Contributors. 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.o... | StarcoderdataPython |
145309 | <reponame>bbieniek/deidentify<filename>tests/evaluation/test_evaluate.py
from deidentify.base import Annotation, Document
from deidentify.evaluation.evaluator import ENTITY_TAG, Evaluator
def test_entity_level():
gold = [
Document(name='doc_a', text='', annotations=[Annotation('', 3, 6, 'MISC')]),
... | StarcoderdataPython |
98604 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
#
# 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
# i... | StarcoderdataPython |
1708709 | def my_function(a, b):
return a + b
functions = [my_function]
print(functions[0])
print(functions[0](1, 2))
| StarcoderdataPython |
3308705 | # Generated by Django 3.0.8 on 2020-09-13 19:21
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('lesson', '0008_auto_2020... | StarcoderdataPython |
131530 | # -*- coding: utf-8 -*-
from ..data_helpers import production_volume
import pprint
def ensure_all_datasets_have_production_volume(data):
"""Make sure all datasets have a single reference product exchange with a valid production volume amount"""
for ds in data:
assert production_volume(ds), "Dataset do... | StarcoderdataPython |
3278092 | import json
import unittest
from typing import Dict, Union, List, Any
from urllib.parse import quote
from calories.test import BaseTestCase
HeaderType = Dict[str, str]
class TestAPI(BaseTestCase):
def setUp(self):
super().setUp()
self.path = 'api'
def delete(self, path: str, headers: Heade... | StarcoderdataPython |
1633520 | <reponame>GrammarBot-API/grammarbot-py<gh_stars>10-100
from typing import List
from urllib.parse import urljoin
import requests
class GrammarBotClient:
"""
A GrammarBot-API wrapper client.
"""
def __init__(self, base_uri: str='http://api.grammarbot.io/', api_key: str='python-default'):
self.... | StarcoderdataPython |
3202759 | from handler.parser import parser_product_details, parser_product
| StarcoderdataPython |
1731323 | <filename>tests/test_sr3_character_parser.py
# -*- coding: utf-8 -*-
"""
This software is licensed under the License (MIT) located at
https://github.com/ephreal/rollbot/Licence
Please see the license for any restrictions or rights granted to you by the
License.
"""
import unittest
from utils.rpg.shadowrun3e.parser i... | StarcoderdataPython |
84326 | #!/usr/bin/env python
"""Make sure the data in BOTMETA.yml is valid"""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import glob
import os
import re
import sys
import yaml
from voluptuous import All, Any, Match, MultipleInvalid, Required, Schema
from voluptuous.humanize impor... | StarcoderdataPython |
157335 | from functools import partial
from mkreports.md import MdProxy
def test_md_proxy(page_info):
md_proxy = MdProxy(page_info=page_info, md_defaults=dict(Table=dict(max_rows=1000)))
test_table = md_proxy.Table
assert isinstance(test_table, partial)
assert test_table.keywords["max_rows"] == 1000
| StarcoderdataPython |
1633949 | <reponame>tepperly/Caliper<filename>test/ci_app_tests/test_symbollookup.py
# Sampler/symbollookup tests
import json
import unittest
import calipertest as cat
class CaliperSamplerTest(unittest.TestCase):
""" Caliper sampler test case """
def test_sampler_symbollookup(self):
target_cmd = [ './ci_test_... | StarcoderdataPython |
3209765 | import json
from file_storage.auth import auth_needed as __required_access_level__
from file_storage.utils import Serializable as __Serializable__
from file_storage.utils import DEFAULT_SAVE_PATH as __asd__
from file_storage.users import User
from file_storage.users import Roles
from file_storage.auth import LoginMana... | StarcoderdataPython |
3289006 | from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases() # NOQA
import unittest
import numpy
import chainer
from chainer import cuda
from chainer import g... | StarcoderdataPython |
3278431 | # Generated by Django 2.2 on 2019-04-12 20:57
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('orders', '0002_auto_20190410_1906'),
]
operations = [
migrations.CreateModel(
name='Product',
... | StarcoderdataPython |
171492 | <filename>test/test_backend/test_workers.py
from pyqode.rst.backend.workers import linter
def test_linter_valid():
with open('test/files/demo_ok.rst', 'r') as f:
code = f.read()
errors = linter({'code': code})
assert len(errors) == 0
def test_linter_invalid():
with open('test/files/demo_ko.r... | StarcoderdataPython |
1795692 | import sqlite3
import logging
from aiogram import Dispatcher, types
from aiogram.dispatcher.filters.state import State, StatesGroup
from aiogram.dispatcher.filters import Text
from aiogram.utils.exceptions import MessageTextIsEmpty
from loguru import logger
import cmd
import keyboards
class MyWords():
def __in... | StarcoderdataPython |
143254 | # coding: utf-8
import re
import six
from huaweicloudsdkcore.sdk_response import SdkResponse
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class ListStacksByTagResponse(SdkResponse):
"""
Attributes:
openapi_types (dict): The key is attribute name
... | StarcoderdataPython |
3297698 | from django.contrib import admin
from .models import *
admin.site.register(Desocupado)
admin.site.register(Empresa)
admin.site.register(OfertaLaboral)
| StarcoderdataPython |
1620308 | <filename>src/relstorage/tests/testpostgresql.py
##############################################################################
#
# Copyright (c) 2008 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the Z... | StarcoderdataPython |
3363588 | from django.views.generic import View
from django.contrib.auth.mixins import LoginRequiredMixin
from django.shortcuts import render
from events_calendar.models import Event
class DashboardView(LoginRequiredMixin, View):
login_url = "accounts:signin"
template_name = "events_calendar/dashboard.html"
def g... | StarcoderdataPython |
72414 | <gh_stars>10-100
import cmpnn
import data
from utils import str2bool, to_cuda
import argparse
import torch
from tqdm import tqdm
from tensorboardX import SummaryWriter
from torch.utils.data import DataLoader
import os
def parse_arguments():
parser = argparse.ArgumentParser(description='Training opts')
parser... | StarcoderdataPython |
140386 | import datetime
'''
The ones that create the response data. Convert it back to
bytestring, and then send it back to the client.
__init__():
Prepare the datetime.
__call__():
Do nothing.
construct():
Create the server_headers, and then create the response headers.
... | StarcoderdataPython |
1791284 | <gh_stars>10-100
from __future__ import absolute_import
from .densenet import *
from .wideresnet import *
| StarcoderdataPython |
1664862 | import collections
import datetime
import os
import shutil
import tempfile
import unittest
import re
try:
from unittest.mock import patch
except ImportError:
from mock import patch
import testing.postgresql
from pgbackup import main
from pgbackup import pg_utils
from pgbackup import backup
DAYS_PER_WEEK = 7... | StarcoderdataPython |
3240629 | # coding: utf-8
from django.http import HttpResponse
from django.shortcuts import render_to_response, get_object_or_404, redirect
from django.template import RequestContext
from cms.forms import BookForm
from cms.models import Book
def book_list(request):
books = Book.objects.all().order_by("id")
return rende... | StarcoderdataPython |
172713 | <gh_stars>0
import climetlab as cml
import os
from ray import tune
from ray.tune.schedulers import AsyncHyperBandScheduler
from ray.tune.suggest.hebo import HEBOSearch
from ray.tune.integration.keras import TuneReportCallback
import tensorflow as tf
from tensorflow.distribute import MirroredStrategy
from tensorflow.ker... | StarcoderdataPython |
25064 |
# Audit Event Outcomes
AUDIT_SUCCESS = "0"
AUDIT_MINOR_FAILURE = "4"
AUDIT_SERIOUS_FAILURE = "8"
AUDIT_MAJOR_FAILURE = "12"
| StarcoderdataPython |
1617277 | #!/usr/bin/env python3
import sys
args = sys.argv
seperator = "%20"
url = "https://searx.tadeo.ca/?q="
if (len(sys.argv) > 2):
q = ""
args.reverse()
args.pop()
args.pop()
args.reverse()
for i in args:
q += i + " "
query = q.strip().replace(" ", seperator)
reply = url + query
e... | StarcoderdataPython |
4814421 | import random
from src.Individual import Individual
def initialization_random(graph, population_size):
def f():
population = []
for i in range(population_size):
individual = Individual(graph)
for j in range(graph.number_vertices):
individual.set_color(j, ra... | StarcoderdataPython |
199438 | <gh_stars>0
###### <NAME> - <EMAIL> ###### COPYRIGHT © 2020 KINGS
# -*- coding: utf-8 -*-
## Classe responsável pelo dos dias entre duas datas.
class Dif_emDias:
## Construtor: define os atributos separando cada índice da data
def __init__(self) -> None:
# jan,fev,mar,abr,mai,... | StarcoderdataPython |
3309635 | from open_alchemy import init_yaml
init_yaml("all-of-column-example-spec.yml")
| StarcoderdataPython |
3242182 | <gh_stars>100-1000
"""
Script with classes and functions for nucleosome calling.
@author: <NAME>, Greenleaf Lab, Stanford University
"""
import numpy as np
from scipy import optimize, signal
from copy import copy
from bisect import bisect_left
import pyximport; pyximport.install(setup_args={"include_dirs":np.get_incl... | StarcoderdataPython |
1641439 | <filename>4 - DevCon 2019 chatbot/1-chatbot_model.py<gh_stars>0
# Copyright 2019 <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
#
# U... | StarcoderdataPython |
1712288 | import datetime
import requests
import urllib.request
class Time:
def Time24hr():
return datetime.datetime.now().strftime("%H:%M:%S")
def Time12hr():
AMPM = ''
Hour = None
Minute = datetime.datetime.now().strftime("%M")
Second = datetime.datetime.now().s... | StarcoderdataPython |
1732411 | import signal
import sys
import time
import pyupm_grove as grove
import pyupm_i2clcd as lcd
def interruptHandler(signal, frame):
sys.exit(0)
if __name__=='__main__':
signal.signal(signal.SIGINT, interruptHandler)
myLcd = lcd.Jhd1313m1(0, 0x3E,0x62)
sensortemperatura=grove.GroveTemp(1)
... | StarcoderdataPython |
3396888 | <reponame>INGEOTEC/text_models<filename>text_models/place.py
# Copyright 2020 <NAME>
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless... | StarcoderdataPython |
6551 | import logging
from typing import List, Callable
import numpy as np
from pyquaternion import Quaternion
from pyrep import PyRep
from pyrep.errors import IKError
from pyrep.objects import Dummy, Object
from rlbench import utils
from rlbench.action_modes import ArmActionMode, ActionMode
from rlbench.backend.exceptions ... | StarcoderdataPython |
48815 | #!/usr/bin/python2.4
#
# Copyright 2009 Google Inc. All Rights Reserved.
"""Defines the generic robot classes.
This module provides the Robot class and RobotListener interface,
as well as some helper functions for web requests and responses.
"""
__author__ = '<EMAIL> (<NAME>)'
import events
import model
import ops
... | StarcoderdataPython |
1623628 | """
Extra functions for build-in datasets
"""
import torchvision.transforms as transforms
def build_transforms(normalize=True, center_crop=None, image_size=None,
random_crop=None, flip=None, random_resize_crop=None,
random_sized_crop=None, use_sobel=False):
"""
Args... | StarcoderdataPython |
1612740 | #!/usr/bin/python
#
# Copyright 2014 Google Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd
"""This script wraps gyp and sets up build environments.
Build instructions:
1. Se... | StarcoderdataPython |
3230652 | <reponame>mtlynch/sia_load_tester
#!/usr/bin/python2
import argparse
import os
import logging
import threading
import time
import contracts
import dataset
import dataset_uploader
import jobs
import preconditions
import progress
import state
import upload_queue
logger = logging.getLogger(__name__)
def configure_log... | StarcoderdataPython |
880 | <filename>AGC004/AGC004a.py
# AGC004a
def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
a, b, c = map(int, input().split())
if a % 2 == 0 or b % 2 == 0 or c % 2 == 0:
print(0)
exit(0)
print(min(a*b, b*c, c*a))
if __name__ == '__main__':
main()
| StarcoderdataPython |
4819977 | <reponame>TeamPhie/etude-gae<filename>db.py
import os
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.schema import Column
from sqlalchemy.types import Integer, String
# dotenv
from dotenv import load_dotenv
load_do... | StarcoderdataPython |
109437 | import unittest
import pyrtl
import pyrtl.corecircuits
from pyrtl.rtllib import aes, testingutils
class TestAESDecrypt(unittest.TestCase):
"""
Test vectors are retrieved from:
http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf
"""
def setUp(self):
pyrtl.reset_working_block()
... | StarcoderdataPython |
3266219 | <filename>src/template/utils.py
import json
def get_config(path):
with open(path, 'r', encoding='utf-8') as f:
dic = json.load(f)
return Config(dic)
class Config(object):
def __init__(self, dic):
for j,k in dic.items():
if isinstance(k, dict):
setattr(self, j,... | StarcoderdataPython |
3361247 | # Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file acc... | StarcoderdataPython |
1683883 | <gh_stars>0
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as colors
G = 6.67408e-11
#constant de gravetat universal per reduir els calculs es interessant augmentar el valor per que la gravetat sigui mes forta en cossos de poca massa i distancies mes curtes
#Es podria implementar amb ce... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.