id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
5109019 | <reponame>hupili/legco-watch
from django.forms import Form, BaseForm, fields_for_model, BooleanField
class OverrideForm(Form):
deactivate = BooleanField()
@classmethod
def from_model(cls, instance, form_kwargs=None):
# Create a Form from a model instance. The form has fields for all of the field... | StarcoderdataPython |
8184084 | from attachments.models import Attachment
from django.contrib.contenttypes import admin
class AttachmentInlines(admin.GenericStackedInline):
model = Attachment
extra = 1 | StarcoderdataPython |
4851130 | <gh_stars>1-10
# -*- coding: utf-8 -*-
from netaddr import IPAddress, IPSet
from django.conf import settings
from django.core.exceptions import PermissionDenied
from django.utils.module_loading import import_string
try:
from django.utils.deprecation import MiddlewareMixin
except ImportError:
MiddlewareMixin =... | StarcoderdataPython |
5142195 | Cassandra
=========
The Cassandra API is under development - coming soon!
| StarcoderdataPython |
6583810 | #!/usr/bin/env python3
# .. _`workbook_csv`:
#
#
# CSV Workbook
# ---------------
#
# ::
import csv
import logging
import pprint
from stingray.workbook.base import Workbook
import stingray.sheet
import stingray.cell
# .. py:module:: workbook.csv
#
# .. py:class:: CSV_Workbook
#
# Extract sheets, rows and cell... | StarcoderdataPython |
8028476 | from .task6 import get_all_shifts
def test_get_all_shifts():
''' get_get_all_shifts should correctly shift strings '''
assert get_all_shifts('ABC') == ['ABC', 'BCD', 'CDE', 'DEF', 'EFG', 'FGH', 'GHI', 'HIJ', 'IJK', 'JKL', 'KLM', 'LMN', 'MNO', 'NOP', 'OPQ', 'PQR', 'QRS', 'RST', 'STU', 'TUV', 'UVW', 'VWX', 'WX... | StarcoderdataPython |
4801496 | <reponame>tho-wa/virushack
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 21 15:18:46 2020
@author: LB
response = requests.get(
'https://hystreet.com/api/locations/',
params={},
headers={'X-API-Token': '<KEY>'},
)
json_response = response.json()
| StarcoderdataPython |
8001832 | <reponame>fogathmann/TheLMA
"""
This file is part of the TheLMA (THe Laboratory Management Application) project.
See LICENSE.txt for licensing, CONTRIBUTORS.txt for contributor information.
"""
from pyramid.compat import iteritems_
from everest.entities.utils import get_root_aggregate
from everest.querying.specificat... | StarcoderdataPython |
1894585 | <reponame>cgoldberg/corey-projects<gh_stars>0
#!/usr/bin/env python
#
# Copyright (c) 2010-2011 <NAME> (http://goldb.org)
#
# This file is part of linux_metrics
#
# License :: OSI Approved :: MIT License:
# http://www.opensource.org/licenses/mit-license
#
# Permission is hereby granted, free of c... | StarcoderdataPython |
181481 | <filename>src/glip/gl/input/__init__.py
from .keyboard import Key, ModifierKey, KeyboardShortcut, Keyboard
from .mouse import MouseButton, Mouse
| StarcoderdataPython |
4806933 | <reponame>dolbyio-samples/dolbyio-rest-apis-client-python
"""
dolbyio_rest_apis.communications.authentication
~~~~~~~~~~~~~~~
This module contains the functions to work with the authentication API.
"""
from deprecated import deprecated
from dolbyio_rest_apis.core.helpers import add_if_not_none
from dolbyio_rest_apis.... | StarcoderdataPython |
9756843 | """
MIT License
Copyright (c) 2021 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distri... | StarcoderdataPython |
8077544 | <reponame>CsatariGergely/openstack-fenix-doc-test
# Copyright (c) 2018 OpenStack Foundation.
# 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:/... | StarcoderdataPython |
4959710 | #!/usr/bin/env python3
"""
Copied from GEMCode/GEMValidation
"""
from ROOT import *
import os
import sys
import ROOT
ROOT.gROOT.SetBatch(1)
import optparse
output = TFile("output.root","RECREATE")
def draw_occ(target_dir, h1,h2, ext =".png", opt = ""):
gStyle.SetStatStyle(0)
gStyle.SetOptStat(1110)
c =... | StarcoderdataPython |
1781915 | # Generated by Django 2.2.4 on 2019-08-27 05:20
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('friends', '0002_customnotification'),
]
operations = [
migrations.AddField(
model_name='friend',
name='status',
... | StarcoderdataPython |
12812865 | <filename>tianshou/env/__init__.py
"""Env package."""
from tianshou.env.maenv import MultiAgentEnv
from tianshou.env.venvs import (
BaseVectorEnv,
DummyVectorEnv,
RayVectorEnv,
ShmemVectorEnv,
SubprocVectorEnv,
)
__all__ = [
"BaseVectorEnv",
"DummyVectorEnv",
"SubprocVectorEnv",
"S... | StarcoderdataPython |
6423103 | def setup():
import warnings
warnings.warn('Flask-Admin sqlalchemy integration module was renamed as '
'flask_admin.contrib.sqla, please use it instead.')
from flask_admin._backwards import import_redirect
import_redirect(__name__, 'flask_admin.contrib.sqla')
setup()
del setup
from... | StarcoderdataPython |
11290753 | <reponame>villares/Paper-objects-with-Processing-and-Python<filename>box_with_rectangular_holes/frame_box.py
CUT_STROKE, FOLD_STROKE = color(255, 0, 0), color(0, 0, 255)
def frame_box(w, h, d, thick=0):
""" draw the 3D version of the box with rectangular holes """
mw, mh, md = w / 2., h / 2., d / 2.
transl... | StarcoderdataPython |
6628279 | #
# ElementTree
# $Id: ElementTree.py 2326 2005-03-17 07:45:21Z fredrik $
#
# light-weight XML support for Python 1.5.2 and later.
#
# history:
# 2001-10-20 fl created (from various sources)
# 2001-11-01 fl return root from parse method
# 2002-02-16 fl sort attributes in lexical order
# 2002-04-06 fl ... | StarcoderdataPython |
1670287 | <gh_stars>10-100
#!/usr/bin/env python
#/*******************************************************************************
# Copyright (c) 2012 IBM Corp.
# 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 Lic... | StarcoderdataPython |
1738223 | # Created by zhouwang on 2018/5/5.
from .base import BaseRequestHandler, permission
import datetime
import pymysql
import logging
logger = logging.getLogger()
def argements_valid(handler, pk=None):
error = dict()
name = handler.get_argument('name', '')
path = handler.get_argument('path', '')
comment... | StarcoderdataPython |
3484252 | from __future__ import absolute_import
from enum import IntEnum
class SearchType(IntEnum):
ISSUE = 0
EVENT = 1
| StarcoderdataPython |
8072393 | import attr
@attr.dataclass(frozen=True)
class A4:
a: int = 1
def <warning descr="'__setattr__' is ignored if the class already defines 'frozen' parameter">__setattr__</warning>(self, key, value):
pass
# A4(1).b = 2
class Base4:
def __setattr__(self, key, value):
pass
@attr.dataclass... | StarcoderdataPython |
248987 | <reponame>witchtrash/suika-api
from typing import List, Optional, Literal
from fastapi import APIRouter, Depends, HTTPException, Query
from pydantic import BaseModel
from sqlalchemy.orm import Session
from sqlalchemy.sql.expression import asc, desc
from fastapi_pagination import Page
from fastapi_pagination.ext.sqlalch... | StarcoderdataPython |
8188886 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
CWD = os.path.dirname(os.path.abspath(__file__))
import sys
sys.path.append(os.path.join(CWD, '..'))
from tap import Tap
from aims.database.models import *
class Args(Tap):
task: Literal['qm_cv', 'md_npt']
"""The task of molecular simulation."""
def ma... | StarcoderdataPython |
1971401 | <filename>Examples/TheresaExp/Basic/Model.py
""" Helper functions for pre-/postprocessing """
from BoundaryConditions.Simulation.SimulationData import getSimData
from GenericModel.Design import generateGenericCell
from GenericModel.PARAMETER import PBTYPES_NOW
from SystemComponentsFast import TheresaSystem
import pand... | StarcoderdataPython |
393446 | from __future__ import division
from mqc.mqc import MQC
from misc import au_to_K, call_name
import os, shutil, textwrap
import numpy as np
import pickle
class BOMD(MQC):
""" Class for born-oppenheimer molecular dynamics (BOMD)
:param object molecule: Molecule object
:param object thermostat: Therm... | StarcoderdataPython |
6405001 | <reponame>cevirici/dominion-woodcutter
# -*- coding: utf-8 -*-
import os
from copy import deepcopy
from django.conf import settings
from .Card import *
from .Pred import *
Cards = {}
CardList = []
Preds = {}
PredList = []
def empty(i, blockLengths, moves, state):
return {}
def staticWorth(val):
def out_fun... | StarcoderdataPython |
4955940 | <reponame>codyhan94/PMA-scheduler
import datetime
from flask.ext.wtf import Form
from wtforms import (Field, HiddenField, TextField,
TextAreaField, SubmitField, DateField, SelectField)
from wtforms.validators import Required, Length, Email
from flask.ext.wtf.html5 import EmailField
from ..utils i... | StarcoderdataPython |
9661431 | import re
class MyTardisModelBase(object):
def __init__(self):
self.parameter_sets = []
def fields_to_dict(self, ignore_none=True):
"""
Return the attributes of the class as a dictionary, ignoring
the parameter_sets attribute and anything beginning with an underscore.
... | StarcoderdataPython |
6419067 | <reponame>aaabbb2021/Trescope<filename>Trescope4Python/library/src/trescope/controller/Label.py<gh_stars>100-1000
from trescope.controller import ControllerNode
class Label(ControllerNode):
"""
Label for information display .
"""
def __init__(self):
super().__init__()
self.__value = N... | StarcoderdataPython |
8134421 | #!/usr/bin/env python
# encoding: utf-8
"""Simple throttle to wait for Solr to start on busy test servers"""
from __future__ import absolute_import, division, print_function, unicode_literals
import sys
import time
import requests
if __name__ == '__main__':
max_retries = 100
retry_count = 0
retry_delay =... | StarcoderdataPython |
1755439 | <filename>chat_downloader/sites/youtube.py
from .common import (
BaseChatDownloader, Chat, Timeout
)
from requests.exceptions import RequestException
from ..errors import (
NoChatReplay,
NoContinuation,
ParsingError,
VideoUnavailable,
LoginRequired,
VideoUnplayable,
InvalidParameter,
... | StarcoderdataPython |
4908957 | <filename>main.py
import sys
import run
if __name__ == '__main__':
func = sys.argv[1]
try:
method = run.functions[func]
method()
except TypeError:
print("Selected functionality does not exist. Please select from the following:\n"
"* scraping\n"
... | StarcoderdataPython |
164992 | <reponame>RafeyIqbalRahman/Quantum-Teleportation<filename>quantum_teleportation.py
# -*- coding: utf-8 -*-
"""quantum_teleportation
"""
# Commented out IPython magic to ensure Python compatibility.
import numpy as np
!pip install qiskit
from qiskit import *
# %matplotlib inline
# Create a Quantum Circuit acting on a ... | StarcoderdataPython |
9663705 | <filename>reversing/constellations/solver/solver.py<gh_stars>1-10
# python3 solver.py ../files/constellations
import sys
import struct
data = open(sys.argv[1], "rb").read()
enc = []
for i in range(0xb1):
t = 0xc95e8+i*0x10
p, l = struct.unpack("<QQ", data[t:t+0x10])
p -= 0x400000
enc += [data[p:p+l].decode()... | StarcoderdataPython |
149720 | <filename>more_exercise/exercise2.py
students_number=int(input("Enter number of Students :"))
per_student_kharcha=int(input("Enter per student expense :"))
total_kharcha=students_number*per_student_kharcha
if total_kharcha<50000:
print ("Ham kharche ke andar hai ")
else:
print ("kharche se bahar hai ") | StarcoderdataPython |
11245666 | <gh_stars>10-100
"""Rules that make sprites vanish."""
from . import abstract_rule
from .contact_rules import get_contact_indices
import abc
import numpy as np
class Vanish(abstract_rule.AbstractRule, metaclass=abc.ABCMeta):
"""Metaclass for rules that make sprites vanish."""
def __init__(self, layer):
... | StarcoderdataPython |
143839 | <gh_stars>0
import torch
import numpy as np
from pathlib import Path
import pickle
from pytorch_memlab import MemReporter
from pytorch_memlab.utils import readable_size as mem_to_str
reporter = MemReporter()
def convert(arg, device:torch.device=None):
if isinstance(arg, tuple):
return tuple([convert(arg_i) for ar... | StarcoderdataPython |
11202906 | from allegro.proxy import load_from_file, filter_proxies, scrape_free_proxy_lists
import pytest
@pytest.mark.vcr()
def test_free_proxies():
"""
Test proxy gathering
"""
proxies = scrape_free_proxy_lists()
assert 50 == len(proxies)
def test_proxies_from_file(monkeypatch, tmpdir):
monkeypatc... | StarcoderdataPython |
4852479 | <filename>controllers/doctors_HISP.py
from bottle import route, view, request, response
from datetime import datetime
import sqlite3
from permissions import permissions
@route('/doctors_HISP')
@view('doctors_HISP')
def doctors_HISP():
return dict(
title='Connect with your doctor',
message='',
... | StarcoderdataPython |
4890112 | <reponame>IBM/api-samples
#!/usr/bin/env python3
# This sample demonstrates how to use the siem endpoint in the
# REST API.
# For this scenario to work there must already be offenses on the system the
# sample is being run against. The scenario demonstrates the following
# actions:
# - How to get offenses.
# - How ... | StarcoderdataPython |
6628394 | <reponame>kosslab-kr/Tizen-NN-Framework
# model
model = Model()
i1 = Input("op1", "TENSOR_FLOAT32", "{2}") # a vector of 2 float32s
i2 = Input("op2", "TENSOR_FLOAT32", "{2}") # another vector of 2 float32s
b0 = Int32Scalar("b0", 0) # an int32_t scalar bias
i3 = Output("op3", "TENSOR_FLOAT32", "{2}")
model = model.Opera... | StarcoderdataPython |
4974839 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-09-21 10:06
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('codenerix_geodata', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(... | StarcoderdataPython |
8048482 | #!/usr/bin/env python
# coding: utf-8
# # section 5: Colloctions
#
# ### writer : <NAME> 1954128
# ### 6.Collections.deque :
#
#
# In[ ]:
from collections import deque
num_op=int(input())
d=deque()
for i in range (num_op):
comments=input().split()
if comments[0]=='append':
d.append(comments[1]... | StarcoderdataPython |
1942464 | <reponame>rafaelscnunes/hackerrank
"""
Created on 13/nov/2019 with PyCharm
INPI - Instituto Nacional da Propriedade Industrial
@author: <NAME> - <EMAIL>
@title: hackerrank - test_plusminus.py
--------------------------------------------------------------------------------
*** Description of the module function *... | StarcoderdataPython |
3564901 | <reponame>DengBinbin/BuildingMachineLearningSystemsWithPython
# This code is supporting material for the book
# Building Machine Learning Systems with Python
# by <NAME> and <NAME>
# published by PACKT Publishing
#
# It is made available under the MIT License
from collections import defaultdict
from itertools import c... | StarcoderdataPython |
3380404 | <filename>deployutils/apps/django/themes.py<gh_stars>1-10
# Copyright (c) 2020, Djaodjin 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:
#
# 1. Redistributions of source code must retain the ... | StarcoderdataPython |
11368675 | #!/usr/bin/python
# encoding:utf-8
# ##############################################################################
# The MIT License (MIT)
#
# Copyright (c) [2015] [dangdang]
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "So... | StarcoderdataPython |
3416189 | # -*- coding: utf-8 -*-
"""
Created on Sun Feb 24 21:44:42 2019
@author: Ham
HackerRanch Challenge: Capitalize!
You are asked to ensure that the first and last names of people
begin with a capital letter in their passports.
For example, alison heck should be capitalised correctly as Alison Heck.
Given... | StarcoderdataPython |
6408128 | <filename>AsciiBot_Example/dots/world.py
# Char inheritance works similar to the Decorator Pattern
# TODO: make the iters have a default arg of self._data_array?
import os
from dots.vector import Pos
from .chars import *
class World(object):
def __init__(self, env, world_map, program_dir):
"""
... | StarcoderdataPython |
11244877 | # -*- coding: utf-8 -*-
"""
Created on 2020.12.19
@author: MiniUFO
Copyright 2018. All rights reserved. Use is subject to license terms.
"""
#%%
from xgrads.xgrads import open_CtlDataset
ds = open_CtlDataset('D:/SOR.ctl')
vor = ds.vor[0].rename('vorticity')
div = ds.div[0].rename('divergence')
#%%
import numpy as n... | StarcoderdataPython |
275560 | import os
EXAMPLES_DIR = "./examples/"
EXAMPLE_NAME_TEMPLATE = "example-policy{}.yml"
VALID_BEGINNGINGS = ["scenarios", "config"]
cwd = os.path.dirname(os.path.realpath(__file__)) + "/../docs/"
files = []
for (dirpath, dirnames, filenames) in os.walk(cwd):
for filename in filenames:
if filename.endswith(".md"... | StarcoderdataPython |
4819358 | #!/usr/bin/python3
#
# Obtaining a node session key. Usually, the Boot
# Manager obtains it, then writes it to /etc/planetlab/session.
#
# <NAME> <<EMAIL>>
# Copyright (C) 2006 The Trustees of Princeton University
#
import os, sys
import getopt
from config import Config
from plcapi import PLCAPI
def main():
# De... | StarcoderdataPython |
12827713 | <reponame>ThomThio/CCCThree
class Currency(object):
iso = ""
name = ""
units = ""
buying = ""
selling = ""
vendor = ""
available = True
def __init__(self, iso, name, units, buying, selling, vendor=None):
if vendor is None:
self.iso = iso
self.available = False
else:
self.iso = iso
self.name = n... | StarcoderdataPython |
1753408 | <reponame>JamesonNetworks/dotfiles<filename>setup.py<gh_stars>0
#!/usr/bin/env python3
from sys import platform, argv
from shared.setup import main
print('Starting environment initialization script...')
print('Platform is ' + platform)
if platform == "linux" or platform == "linux2":
from linux.setup import mai... | StarcoderdataPython |
3200754 | """Integration test cases for the ready route."""
from unittest.mock import Mock
from aiohttp.test_utils import TestClient
import pytest
from tests.test_data import (
altinn_catalog_turtle,
or_catalog_turtle,
seres_catalog_turtle,
)
@pytest.mark.integration
async def test_altinn(client: TestClient, mock... | StarcoderdataPython |
12813518 | """
Last edited: February 20, 2020
|br| @author: FINE Developer Team (FZJ IEK-3)
"""
from FINE import utils
import FINE as fn
import numpy as np
def optimizeTSAmultiStage(esM,
declaresOptimizationProblem=True,
relaxIsBuiltBinary=False,
... | StarcoderdataPython |
1829908 | <reponame>illidanlab/tensorpack
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: train-atari.py
# Author: <NAME>
import argparse
import cv2
import gym
import multiprocessing as mp
import numpy as np
import pickle
import os
import six
import sys
import uuid
import tensorflow as tf
from six.moves import queue
from... | StarcoderdataPython |
4856087 | <filename>Stone_Paper_Scissors.py
import random
tie=0
tries=0
score_ur=0
score_comp=0
user_ins=""
array_names=["stone","paper","scissor"]
print(array_names)
start_input=input("Do you want to start the game?\n")
if start_input=="yes" or start_input=="yup" or start_input=="s":
score_final = int(input("How m... | StarcoderdataPython |
75501 | import pytest
from app.api.services import abr_service
from app.api.business.errors import AbrError
import requests
import mock
from mock import patch
class TestAbrService():
def mocked_find_business_by_abn(self):
data = '<ABR><response><stateCode>NSW</stateCode><postcode>2750</postcode>'\
'<... | StarcoderdataPython |
6545730 | # -*- coding: utf-8 -*-
__version__ = '0.0.1a'
__author__ = '<NAME>'
| StarcoderdataPython |
1843569 | <reponame>Hydraverse/hypy<gh_stars>1-10
from hydra.test import Test
# noinspection PyUnresolvedReferences
from hydra.test.app import *
Test.main()
| StarcoderdataPython |
3311453 | from django.db import models
from django.contrib.auth.models import User
import datetime as dt
from PIL import Image
# Create your models here.
class Profile(models.Model):
"""
class facilitates the creation of profile objects
"""
bio = models.CharField(max_length=70)
user = models.OneToOneField(Us... | StarcoderdataPython |
9667422 | <gh_stars>0
from mailchimp3.baseapi import BaseApi
class Folder(BaseApi):
def __init__(self, *args, **kwargs):
super(Folder, self).__init__(*args, **kwargs)
self.endpoint = 'file-manager/folders'
def all(self):
return self._mc_client._get(url=self.endpoint)
def get(self, folder_... | StarcoderdataPython |
3322995 | <reponame>PacktPublishing/Tkinter-GUI-Application-Development-Projects<gh_stars>10-100
from tkinter import *
def show_event_details(event):
event_name = {"2": "KeyPress", "4": "ButtonPress", "6": "Motion", "9":"FocusIn"}
print('='*50)
print("EventName=" + event_name[str(event.type)])
print("EventKeySymbol=" +... | StarcoderdataPython |
11249294 | """
The simplest of fabfiles.
Two commands: host_type and diskspace.
"""
from fabric.api import run
def host_type():
run('uname -s')
def diskspace():
run('df')
| StarcoderdataPython |
12855992 | """season.py: Generates random NJBA season data."""
__author__ = "<NAME>"
__copyright__ = "Copyright 2019, University of Delaware, CISC 637 Database Systems"
__email__ = "<EMAIL>"
from datetime import timedelta
import calendar
import csv
'''
Steps to run this project:
1. Create a virtual env and activate source... | StarcoderdataPython |
1761554 | import os
def clear():
if os.name == "nt":
os.system("cls")
else:
os.system("clear") | StarcoderdataPython |
3516459 | from datetime import datetime, timedelta
class BlindsAndAntes:
def __init__(self):
# The blinds and antes are defined by:
# startTime (expressed as hour,minute,second in a datetime object)
# [smallBlind, bigBlind]
# ante
# So, for example: [40, [50, 100], 10]
# means... | StarcoderdataPython |
5164840 | """
VCD (Video Content Description) library v4.3.1
Project website: http://vcd.vicomtech.org
Copyright (C) 2021, Vicomtech (http://www.vicomtech.es/),
(Spain) all rights reserved.
VCD is a Python library to create and manage VCD content version 4.3.1.
VCD is distributed under MIT License. See LICENSE.
"""
import u... | StarcoderdataPython |
1628496 | <reponame>mateusnr/hackerrank-solutions
a = int(raw_input())
b = int(raw_input())
m = int(raw_input())
print pow(a,b)
print pow(a,b,m)
| StarcoderdataPython |
8009045 | import os
import unittest
from pprint import pprint
from flask import current_app
from config import config
from project import create_app
class TestDevelopmentConfig(unittest.TestCase):
"""Test development config"""
def setUp(self):
self.app = create_app('development')
def test_app_is_developm... | StarcoderdataPython |
1603097 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-12-11 13:32
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("projectroles", "0006_add_remote_projects"),
("barcodes", "0002_auto_20181211_1413")... | StarcoderdataPython |
1700045 | """
Visualize map with COVID-19 cases
"""
from os.path import join
import logging
import numpy as np
from bokeh.plotting import figure
from bokeh.models import DateSlider
from bokeh.models import (
CustomJS,
GeoJSONDataSource,
HoverTool,
Legend,
LinearColorMapper,
Select,
GroupFilter,
... | StarcoderdataPython |
228771 |
import urllib.request, json
from .models import Sources, Articles, News
# Getting api key
api_key = None
# Getting the news and article base url
news_base_url = None
article_base_url = None
source_base_url = None
search_base_url = None
def configure_request(app):
global api_key, news_base_url, article_base_url,... | StarcoderdataPython |
3531437 | <filename>src/movement.py
#!/usr/bin/env python3
# coding: utf-8
import sfml as sf
from .helper import time
from .types import *
class Movement:
"""
Linear interpolation movement between two given positions.
"""
def __init__(self, vec, duration=1):
self.speed = Vec(*vec) / duration
self.duration = duration... | StarcoderdataPython |
6432988 | from spikeextractors import RecordingExtractor
import numpy as np
class CommonReferenceRecording(RecordingExtractor):
preprocessor_name = 'CommonReference'
installed = True # check at class level if installed or not
preprocessor_gui_params = [
{'name': 'reference', 'type': 'str', 'value': 'median... | StarcoderdataPython |
4879249 | # Copyright The IETF Trust 2019-2020, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.23 on 2019-10-01 04:40
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('review', '0016_add_remind_days_open_reviews'),
]
operations = [... | StarcoderdataPython |
1667001 | <filename>calvin/runtime/north/plugins/port/queue/fanout_mapped_fifo.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
# Copyright (c) 2016 Ericsson AB
#
# 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 Licens... | StarcoderdataPython |
1882223 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# (c) Copyright IBM Corp. 2010, 2020. All Rights Reserved.
import pytest
from resilient_sdk.util import constants
from resilient_sdk.util import package_file_helpers as package_helpers
from resilient_sdk.util.sdk_validate_issue import SDKValidateIssue
def mock_warning_is... | StarcoderdataPython |
9607959 | <gh_stars>1-10
from setuptools import setup
def readme():
with open('README.rst') as f:
return f.read()
setup(name='mousetrap',
version='3.0.5',
description='An X11 utility that hides the mouse pointer after a specified interval of time',
long_description=readme(),
classifiers=[
... | StarcoderdataPython |
1857904 | <reponame>StonyBrookNLP/dire
from typing import List, Dict
from dataclasses import dataclass, field
from collections import defaultdict
from copy import deepcopy
from metrics import hotpotqa_eval, BaseMetric
@dataclass
class LabelPredictionInstance:
label_supporting_facts: List = field(default_factory=lambda: de... | StarcoderdataPython |
4910568 | <filename>sl1m/constants_and_tools.py
import numpy as np
from sl1m.tools.obj_to_constraints import load_obj, as_inequalities, rotate_inequalities, inequalities_to_Inequalities_object
from numpy import array, asmatrix, matrix, zeros, ones
from numpy import array, dot, stack, vstack, hstack, asmatrix, identity, cross, c... | StarcoderdataPython |
3428944 | # Lint as: python3
# Copyright 2019 The AdaNet 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless req... | StarcoderdataPython |
379336 | from HPC_Task import Task, Workloads
from HPC_Cluster import Cluster
import os
import math
import json
import time
import sys
import random
from random import shuffle
import numpy as np
import tensorflow as tf
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
import scipy.signal
import gym
from gym import ... | StarcoderdataPython |
6626642 | #!/usr/bin/env python
"""
update compile_commands.json file used in unit test framework
"""
import argparse
import os
import sys
import re
import json
def main(argv):
parser = argparse.ArgumentParser()
parser.add_argument(
'json_file',
type=str,
nargs='?',
default='compile_co... | StarcoderdataPython |
9753598 | <filename>write_me/stp_info.py
"""Transform setup.py into a python dictionary."""
import ast
from write_me.list_files import get_setup_file
from write_me.git_description import get_git_description
from write_me.project_data import get_project_url
setup_parsed = {}
setup_keys = ['version',
'description'... | StarcoderdataPython |
1637727 | <reponame>TuongL94/MasterThesis
# -*- coding: utf-8 -*-
"""
Created on Thur Feb 15 11:22:22 2018
@author: <NAME>
"""
import single_nn_model_mnist as sm
import numpy as np
import tensorflow as tf
import os
import utilities as util
def batch_mnist(batch_size, counter, train_labels, train_data):
b_data = train_d... | StarcoderdataPython |
5010265 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from zabbix_api import ZabbixAPI
zapi = ZabbixAPI(server="http://192.168.25.3")
zapi.login("Admin", "zabbix")
history = zapi.history.get({
"itemids": [
29262
],
"history": 0,
"output": "extend",
"time_from": "1575216457",
"time_till": "1575216457"
})
for x i... | StarcoderdataPython |
9791018 | <filename>atcoder/abc195/d.py
#☆𝒐𝒎𝒂𝒋𝒊𝒏𝒂𝒊☆#
import sys
import math
import itertools
from functools import lru_cache
from collections import deque
sys.setrecursionlimit(10000000)
input=lambda : sys.stdin.readline().rstrip()
'''''✂'''''''''''''''''''''''''''''''''''''''''''''''''''''''''
n,m,q=map(int,input().spl... | StarcoderdataPython |
287309 | import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, Gdk
import midisw.gtk3
##########################################################################
class Layer(Gtk.VBox):
PIANO_WIDTH = 480
PIANO_HEIGHT = 32
def __init__(self, **kwargs):
super().__init__(**kwargs)
... | StarcoderdataPython |
1651374 | <filename>src/alfred3/exceptions.py<gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Das Modul definiert alle Exceptions des Frameworks
"""
class AlfredError(Exception):
u"""
Jede Exception des Frameworks ist von dieser Klasse abgeleitet.
"""
pass
class ValidationError(AlfredError): pass
class AbortMove(Al... | StarcoderdataPython |
11205718 | <reponame>jason-neal/Starfish
#!/usr/bin/env python
#Use flot JavaScript plotting library to visualize a single order plot
import numpy as np
import json
import jinja2
def np_to_json(arr0, arr1):
'''
Take two numpy arrays, as in a plot, and return the JSON serialization for flot.
'''
data = np.array(... | StarcoderdataPython |
256465 | import os
from starlette.background import BackgroundTask
from starlette.requests import Request
from starlette.responses import JSONResponse
from starlette.routing import Route
from gsheet_service import (
service,
sheet_service,
)
BASE_DIR = os.path.dirname(os.path.abspath(__name__))
service_api = sheet_s... | StarcoderdataPython |
3405627 | # necessary imports
import socket
import logging
import threading
import time
import RPi.GPIO as GPIO
import camera_stream
# setup the pins to use the BCM mode and disable GPIO warnings
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
message = ""
distance = 0.0
speed = 0
ultra_trig = 22 # ultrasonic trigger pin number... | StarcoderdataPython |
12858901 | import base64
import json
from OpenSSL.SSL import (
VERIFY_PEER, VERIFY_FAIL_IF_NO_PEER_CERT, VERIFY_NONE,
SSLv3_METHOD, SSLv23_METHOD, TLSv1_METHOD)
from twisted.web.http_headers import Headers
from twisted.internet.defer import inlineCallbacks, fail, succeed
from vxsandbox.resources.http import (
HttpC... | StarcoderdataPython |
38204 | import utils
import os
import json
def getjsondata(path):
if not os.path.isabs(path):
path = os.path.join(os.path.dirname(os.path.realpath(__file__)), path)
f = open(path)
data = json.loads(f.read())
return data
def getconfig():
return getjsondata('./conf.json') | StarcoderdataPython |
11262518 | # Copyright (c) 2020 <NAME>
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php
import time
import json
from binascii import hexlify, unhexlify
from moneysocket.utl.third_party.lightning_payencode.lnaddr import lndecode
MSATOSHIS_PE... | StarcoderdataPython |
270219 | <gh_stars>0
# Generated from .\seedot.g4 by ANTLR 4.8
from antlr4 import *
if __name__ is not None and "." in __name__:
from .seedotParser import seedotParser
else:
from seedotParser import seedotParser
# This class defines a complete generic visitor for a parse tree produced by seedotParser.
class seedotVisi... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.