max_stars_repo_path stringlengths 3 269 | max_stars_repo_name stringlengths 4 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.05M | score float64 0.23 5.13 | int_score int64 0 5 |
|---|---|---|---|---|---|---|
djspace/bin/gm2m.py | carthagecollege/django-djspace | 0 | 12796751 | <reponame>carthagecollege/django-djspace
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import django
import os
import sys
django.setup()
# env
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'djspace.settings.shell')
from django.contrib.auth.models import User
user = User.objects.get(pk=1217743)... | 2.25 | 2 |
modules/parser/nodes/line_node.py | DavidMacDonald11/sea-to-c-transpiler-python-based | 0 | 12796752 | from modules.visitor.symbol_table import SymbolTable
from .ast_node import ASTNode
from .if_node import IfNode
class LineNode(ASTNode):
def __init__(self, expression, depth, no_end = False):
self.expression = expression
self.depth = depth
self.no_end = no_end
super().__init__(expre... | 2.75 | 3 |
estruturais/flyweight/main.py | caio-bernardo/design-patterns-python | 363 | 12796753 | class KarakTea:
def __init__(self, tea_type):
self.__tea_type = tea_type
@property
def tea_type(self):
return self.__tea_type
class TeaMaker:
def __init__(self):
self.__available_tea = dict()
def make(self, preference):
if preference not in self.__available_tea:
... | 3.453125 | 3 |
examples/covid19/import_csse_covid19_daily.py | cudeso/PyMISP | 0 | 12796754 | <filename>examples/covid19/import_csse_covid19_daily.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from pathlib import Path
from csv import DictReader
from pymisp import MISPEvent, MISPOrganisation, PyMISP
from datetime import datetime
from dateutil.parser import parse
import json
from pymisp.tools import feed_met... | 2.203125 | 2 |
data_scripts/create_splits.py | Berndwl/TextMaps | 86 | 12796755 | <reponame>Berndwl/TextMaps
import os
import sys
from sklearn.cross_validation import KFold
RESULT_PATH = '../data_shops/page_sets/splits/'
PAGE_SETS_PATH = '../data_shops/page_sets/'
SHOP_LIST_PATH = '../data_shops/shop_list.txt'
def getPagesForShops(shops):
pages = []
for shop in shops:
page_set_path... | 2.6875 | 3 |
xls/build_rules/xls_rules_build_defs.bzl | netskink/xls | 0 | 12796756 | <reponame>netskink/xls
# Copyright 2021 The XLS Authors
#
# 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 l... | 1.382813 | 1 |
py/tests/test_nil.py | JakeMakesStuff/erlpack | 108 | 12796757 | from __future__ import absolute_import
from erlpack import pack
def test_nil():
assert pack(None) == b'\x83s\x03nil'
| 1.445313 | 1 |
operative/test/report_test.py | buzzfeed/python-operative | 0 | 12796758 | import unittest
import operative
import datetime
from caliendo.patch import patch
from caliendo import expected_value
from nose.tools import eq_, ok_
from operative.settings import TEST_FTP_LOGIN
class ReportTest(unittest.TestCase):
"""
Test the various reports.
"""
@patch('operative.FTPConnection... | 2.125 | 2 |
pys/006_get_table_columns.py | indecipherable/linuxtest_dust | 0 | 12796759 | <reponame>indecipherable/linuxtest_dust
# works as intended
import mysql.connector
from mysql.connector import errorcode
import sys
import re
import os
from pprint import pprint as p
# trying to import where_am_i as module
#import importlib
#where_am_i="/000_where_am_i"
#sys.path.append(os.getcwd())
#import 000_where_a... | 2.390625 | 2 |
datasets/create_tf_record.py | ace19-dev/image-retrieval-tf | 6 | 12796760 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import hashlib
import io
import os
import random
from PIL import Image, ImageStat
import tensorflow as tf
from datasets import dataset_utils
flags = tf.app.flags
flags.DEFINE_string('dataset_dir',
... | 2.25 | 2 |
examples/settings.py | seankmartin/brainrender | 0 | 12796761 | <filename>examples/settings.py
"""
Brainrender provides several default settins (e.g. for shader style)
which can be changed to personalize your rendering.
This example shows you how
"""
import brainrender
from brainrender import Scene
from rich import print
from myterial import orange
from pathlib import Path
prin... | 2.859375 | 3 |
parser/team02/proyec_v2/ast/Expresion.py | webdev188/tytus | 35 | 12796762 | class Expresion:
def getValor(self,entorno,tree):
pass
| 1.398438 | 1 |
arike/visits/migrations/0005_auto_20220304_2228.py | iamsdas/arike | 0 | 12796763 | <filename>arike/visits/migrations/0005_auto_20220304_2228.py
# Generated by Django 3.2.12 on 2022-03-04 16:58
import datetime
from django.db import migrations, models
import django.db.models.deletion
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('patients... | 1.476563 | 1 |
app/routers/weather/models.py | neurothrone/weather-api | 0 | 12796764 | from pydantic import BaseModel, Field
from app.shared.enums import Units
class LocationBase(BaseModel):
units: Units = Units.METRIC
class CityLocation(BaseModel):
city: str
state: str | None = Field(default=None, max_length=3)
country: str | None = None
class Config:
schema_extra = {
... | 2.796875 | 3 |
scripts/planet-caravan/zoho-sync.py | labogdan/planet-caravan-backend | 0 | 12796765 | import os
import sys
import json
import mimetypes
import urllib
import requests
import django
sys.path.append(os.path.abspath('.'))
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "saleor.settings")
try:
django.setup()
except:
pass
from django.core.cache import cache
from dotenv import load_dotenv
from Lib.C... | 1.984375 | 2 |
dataviva/apps/user/forms.py | joelvisroman/dataviva-site | 126 | 12796766 | <reponame>joelvisroman/dataviva-site
from flask_wtf import Form
from wtforms import TextField, DateField, BooleanField, HiddenField, validators, PasswordField, SelectField
class SignupForm(Form):
email = TextField('email', validators=[validators.Required(), validators.Email()])
fullname = TextField('fullname'... | 2.96875 | 3 |
docker/molecule/tests/test_docker.py | thisisthetechie/raspberry-ansible | 43 | 12796767 | <filename>docker/molecule/tests/test_docker.py
import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
def test_is_docker_installed(host):
package_docker = host.package('docker-ce')
assert pa... | 2.21875 | 2 |
bubble_sorter/__init__.py | joshuabode/bubble-sort-python | 0 | 12796768 | from .bubble_sort import *
| 1.078125 | 1 |
redditpoller/migrations/0014_auto_20170304_1513.py | ericleepa/watcherforreddit | 8 | 12796769 | <filename>redditpoller/migrations/0014_auto_20170304_1513.py
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-04 20:13
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('redditpoller', '0013_watchedsubreddit_w... | 1.585938 | 2 |
common_holdings.py | Anindya-Das02/Portfolio-Common-Holdings | 0 | 12796770 | <reponame>Anindya-Das02/Portfolio-Common-Holdings
from loggers import COMPARE_FUNDS_DIR_PATH, finish, prgm_end, linespace
import os
os.chdir(COMPARE_FUNDS_DIR_PATH)
amcs = [f for f in os.listdir('.') if os.path.isfile(f)]
if len(amcs) == 0:
print("No AMCs file found for comparision.. please add files in '... | 2.671875 | 3 |
dj_vercereg/vercereg/serializers.py | davidath/dj-vercereg | 0 | 12796771 | # Copyright 2014 The University of Edinburgh
#
# 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... | 1.765625 | 2 |
2018/aoc/d7/test.py | lukaselmer/adventofcode | 1 | 12796772 | <gh_stars>1-10
import unittest
from unittest.mock import mock_open, patch
from aoc.d7.main import step_order, time_required
DATA = "Step C must be finished before step A can begin.\nStep C must be finished before step F can begin.\nStep A must be finished before step B can begin.\nStep A must be finished before step ... | 2.875 | 3 |
secure_data_store/__init__.py | HumanBrainProject/secure-data-store | 1 | 12796773 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""Top-level package for Secure Data Store."""
__author__ = """<NAME>"""
__email__ = '<EMAIL>'
__version__ = '0.1.0'
| 1.085938 | 1 |
server/server3.py | lthurlow/scaling-computing-machine | 0 | 12796774 | import pdb # for debuggin
import sys
import time
import pprint
import fcntl # for get_ip_address
import struct # for get_ip_address
import threading # for threading UDPServer
import socket # for UDPServer
#sys.path.append("./third_party/libs/") # for scapy
#import StringIO # for dummy_exec
#import logging... | 2 | 2 |
core/mail.py | jasonvriends/lifetracker-backend | 0 | 12796775 | <reponame>jasonvriends/lifetracker-backend
import os
from fastapi import BackgroundTasks
from fastapi_mail import ConnectionConfig, FastMail, MessageSchema
from core.settings import settings
from schemas.auth import EmailSchema
conf = ConnectionConfig(
MAIL_USERNAME=settings.MAIL_USERNAME,
MAIL_PASSWORD=sett... | 1.898438 | 2 |
stack/valid_parenthesis.py | javyxu/algorithms-python | 8 | 12796776 | """
Given a string containing just the characters
'(', ')', '{', '}', '[' and ']',
determine if the input string is valid.
The brackets must close in the correct order,
"()" and "()[]{}" are all valid but "(]" and "([)]" are not.
"""
def is_valid(s:"str")->"bool":
stack = []
dic = { ")":"(",
"}":... | 4.0625 | 4 |
decloud/acquisitions/sensing_layout.py | CNES/decloud | 8 | 12796777 | # -*- coding: utf-8 -*-
"""
Copyright (c) 2020-2022 INRAE
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, ... | 1.6875 | 2 |
tests/spec/Spec/flattened_spec_test.py | Timothyyung/bravado-core | 0 | 12796778 | <gh_stars>0
# -*- coding: utf-8 -*-
import copy
import functools
import mock
import pytest
from six.moves.urllib.parse import urlparse
from swagger_spec_validator import validator20
from bravado_core import spec
from bravado_core.spec import CONFIG_DEFAULTS
from bravado_core.spec import Spec
from bravado_core.spec_fl... | 1.890625 | 2 |
nnreslib/layers/trainable_layer.py | xausssr/nnreslib | 0 | 12796779 | <reponame>xausssr/nnreslib<gh_stars>0
from __future__ import annotations
from abc import abstractmethod
from typing import TYPE_CHECKING, Any, Optional
from .base_layer import Layer
from ..utils.initialization import Initialization
from ..utils.merge import MergeInputs
if TYPE_CHECKING:
import numpy as np
f... | 2.09375 | 2 |
src/figs/figS03.py | RPGroup-PBoC/chann_cap | 2 | 12796780 | #%%
import os
import pickle
import cloudpickle
import itertools
import glob
import numpy as np
import scipy as sp
import pandas as pd
import git
# Import matplotlib stuff for plotting
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import matplotlib as mpl
# Seaborn, useful for graphics
import seaborn as s... | 2.15625 | 2 |
ip_search.py | HAYASAKA-Ryosuke/ip_search | 0 | 12796781 | <gh_stars>0
#!coding:utf-8
from multiprocessing import Pool
import subprocess
class Ping(object):
def __init__(self, hosts, pool_num=5):
self.hosts = hosts
self.pool_num = pool_num
def _shell(self, host):
popen = subprocess.Popen(["ping", "-c", "1", "-W", "0", host], stdout=subproces... | 2.984375 | 3 |
checkpoint.py | nisarkhanatwork/mctsnet | 5 | 12796782 | import pickle
import time
from datetime import datetime
def checkpoint(shared_model, shared_dataset, args):
try:
while True:
# Save dataset
file = open(args.data, 'wb')
pickle.dump(list(shared_dataset), file)
file.close()
# Save model
... | 2.78125 | 3 |
msdm/tests/test_policy_iteration.py | markkho/msdm | 15 | 12796783 | import unittest
import numpy as np
from frozendict import frozendict
from msdm.core.distributions import DictDistribution
from msdm.algorithms import ValueIteration, PolicyIteration, LRTDP
from msdm.tests.domains import Counter, GNTFig6_6, Geometric, VaryingActionNumber, make_russell_norvig_grid
from msdm.domains impor... | 2.3125 | 2 |
languages/python3/pdf/pdfminer/main.py | jcnaud/snippet | 5 | 12796784 | <reponame>jcnaud/snippet<gh_stars>1-10
# coding: utf-8
## Source : https://lobstr.io/index.php/2018/07/30/scraping-document-pdf-python-pdfminer/
import os
from io import BytesIO
from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter
from pdfminer.converter import TextConverter
from pdfminer.pdfpage imp... | 3.09375 | 3 |
osp/institutions/utils.py | davidmcclure/open-syllabus-project | 220 | 12796785 | <reponame>davidmcclure/open-syllabus-project
import tldextract
import re
from urllib.parse import urlparse
def seed_to_regex(seed):
"""
Given a URL, make a regex that matches child URLs.
Args:
seed (str)
Returns: regex
"""
parsed = urlparse(seed)
# 1 -- If the seed has a no... | 3.515625 | 4 |
users/signals.py | LouaiKB/MicroscoQuiz | 2 | 12796786 | <reponame>LouaiKB/MicroscoQuiz<gh_stars>1-10
#this file is created for the signals, for each new user creat a new Profile
from django.db.models.signals import post_save
from django.contrib.auth.models import User
from django.dispatch import receiver
from .models import Profile
#when a user is saved then send this s... | 2.609375 | 3 |
jiant/jiant/modules/cove/cove/encoder.py | amirziai/cs229-project | 500 | 12796787 | <gh_stars>100-1000
import os
import torch
from torch import nn
from torch.nn.utils.rnn import pad_packed_sequence as unpack
from torch.nn.utils.rnn import pack_padded_sequence as pack
import torch.utils.model_zoo as model_zoo
model_urls = {
'wmt-lstm' : 'https://s3.amazonaws.com/research.metamind.io/cove/wmtlstm... | 2.5 | 2 |
tests/test_autommittee.py | rodsenra/socialgraph | 0 | 12796788 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Test some edge cases.
"""
import unittest
from socialgraph import autommittee
class TestPowerHistory(unittest.TestCase):
def setUp(self):
self.G = autommittee.Graph()
self.G.add_edge('b', 'a')
self.G.add_edge('a', 'c')
self.G.add... | 2.953125 | 3 |
pycbio/hgdata/frame.py | diekhans/read-through-analysis | 0 | 12796789 | <filename>pycbio/hgdata/frame.py
# Copyright 2006-2012 <NAME>
from pycbio.sys import PycbioException
class Frame(int):
"""Immutable object the represents a frame, integer value of 0, 1, or 2.
This is also an int. Use None if there is no frame."""
__slots__ = ()
@staticmethod
def _checkFrameValu... | 2.78125 | 3 |
spike_swarm_sim/objects/robot.py | r-sendra/SpikeSwarmSim | 0 | 12796790 | <filename>spike_swarm_sim/objects/robot.py
import numpy as np
from shapely.geometry import Point
from spike_swarm_sim.objects import WorldObject
from spike_swarm_sim.register import sensors, actuators, world_object_registry
@world_object_registry(name='robot')
class Robot(WorldObject):
"""
Base class f... | 3.046875 | 3 |
util/flask_learn.py | yt7589/aqp | 0 | 12796791 | <filename>util/flask_learn.py
from flask import Flask
class FlaskLearn(object):
def __init__(self):
self.name = 'FlaskLearn'
def startup(self):
print('Flask学习程序')
def hello_world(self):
app = Flask('HelloWorld')
| 2.953125 | 3 |
scripts/sprint_report.py | AndrewDVXI/kitsune | 929 | 12796792 | <gh_stars>100-1000
#!/usr/bin/env python
import logging
import sys
import textwrap
import xmlrpc.client
USAGE = 'Usage: sprint_report.py <SPRINT>'
HEADER = 'sprint_report.py: your friendly report view of the sprint!'
# Note: Most of the bugzila api code comes from Scrumbugz.
cache = {}
log = logging.getLogger(__na... | 2.171875 | 2 |
flickpyper/pickles.py | theodysseus/flickpyper | 1 | 12796793 | <reponame>theodysseus/flickpyper<gh_stars>1-10
from os import path
import pickle
def get_ids(file):
if path.isfile(file):
with open(file, 'rb') as f:
return pickle.load(f)
else:
return []
def put_ids(file, ids):
with open(file, 'wb') as f:
pickle.dump(ids, f)
| 2.640625 | 3 |
new_trade/main.py | cbbing/stock | 31 | 12796794 | #coding: utf-8
import tushare as ts
import pandas as pd
from util.date_convert import GetNowDate
def diagnosis_one_stock(code):
"""
个股诊断
:return:
"""
# 获取股价
df = get_stock_price(code, True)
# 均线指标
# K线提示
def get_stock_price(code, include_realtime_price):
"""
获取个股股价
:p... | 2.671875 | 3 |
tests/unit/test_fields/test_base.py | radeklat/sparkql | 0 | 12796795 | <reponame>radeklat/sparkql
import pytest
from sparkql.exceptions import FieldParentError, FieldNameError
from sparkql import Float, Struct
class TestBaseField:
@staticmethod
def should_give_correct_info_string():
# given
float_field = Float()
# when
info_str = float_field._in... | 2.34375 | 2 |
Gathered CTF writeups/ptr-yudai-writeups/2019/Security_Fest_2019/Baby3/solve.py | mihaid-b/CyberSakura | 1 | 12796796 | <reponame>mihaid-b/CyberSakura
from ptrlib import *
libc = ELF("./libc.so.6")
elf = ELF("./baby3")
sock = Process("./baby3")
delta = 0xe7
# Stage 1: exit-->_start
payload = fsb(
pos = 6,
writes = {elf.got("exit"): elf.symbol("_start") & 0xffff},
bs = 2,
size = 2,
bits = 64
)
print(payload)
sock.re... | 1.914063 | 2 |
vaultier/libs/version/context.py | dz0ny/Vaultier | 30 | 12796797 | <reponame>dz0ny/Vaultier
class Manager(object):
_user = None
_enabled = True
_user_required = True
def set_user_required(self, user_required):
self._user_required = user_required
def get_user_required(self):
return self._user_required
def set_user(self, user):
self._u... | 2.4375 | 2 |
app/chat/migrations/0002_alter_chatmessage_user_id.py | GonnaFlyMethod/simple_chat | 0 | 12796798 | # Generated by Django 3.2.5 on 2021-07-20 13:39
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),
('chat', '0001_initial'),
... | 1.53125 | 2 |
SourceModel/SM_Constants.py | crossminer/CrossPuppeteer | 47 | 12796799 | CLASS_REGEX = r'class [\w\d\:\-_\']+(?:\:\:[\w\d\:\-_\']+)*\s*(?:\(.+\)\s*)*{*'
CLASS_NAME_REGEX = r'class ([\w\d\:\-_\']+(?:\:\:[\w\d\:\-_\']+)*)\s*(?:\(.+\)\s*)*{*'
DEFINE_REGEX = r'define \w+(?:\:\:\w+)*\s*(?:\(.+\)\s*)*{*'
FILE_REGEX = r'file\W*\{\W*\'.+\'\W*:|file\W*\{\W*\".+\"\W*:|file\W*{\W*\$.+\W*:'
PACKAGE_REG... | 2.4375 | 2 |
views.py | jfroejk/cartridge_quickpay | 0 | 12796800 | <reponame>jfroejk/cartridge_quickpay<gh_stars>0
from django.http import HttpRequest, HttpResponse, HttpResponseRedirect, JsonResponse, \
HttpResponseBadRequest, HttpResponseForbidden
from django.template import loader
from django.template.response import TemplateResponse
from django.shortcuts import redirect, rende... | 2 | 2 |
python/archive/writedata.py | d-giles/KeplerML | 0 | 12796801 | # reads in both both .sav files: the long-cadence data and the variable supplement
# removes all objects that lack data like effective temperatures
# writes the dataset.npy and logdata.npy files
# also building the training and test sets and runs a Gaussian Naive Bayes classifier
import numpy as np
import pyfits as pf... | 2.140625 | 2 |
neural_network/drawbox.py | PurdueMINDS/SAGA | 1 | 12796802 | # Copyright 2018 <NAME>, <NAME>, <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 required by applicab... | 2.796875 | 3 |
plugins/tasks_plugin/__init__.py | shivammmmm/querybook | 1,144 | 12796803 | # from tasks.delete_mysql_cache import delete_mysql_cache
# delete_mysql_cache
| 1.046875 | 1 |
HW1/election_count.py | profrichto/handson | 0 | 12796804 | import mediacloud, datetime
#Default key: The variable 'key' must be edited according to the specific mediacloud user
key = '00'
mc = mediacloud.api.MediaCloud(key)
#Comparison of number of stories written about 'Trump' and 'Clinton' in September 2016
res = mc.sentenceCount('Trump', solr_filter=[mc.publish_date_query... | 2.59375 | 3 |
db/tables/Base.py | Wanket/RnD-py | 0 | 12796805 | <gh_stars>0
from sqlalchemy.orm import declarative_base
class Base(declarative_base()):
__abstract__ = True
| 1.664063 | 2 |
arjuna/interact/http/model/internal/repr/response.py | bhargavkumar-65/arjuna | 13 | 12796806 | <filename>arjuna/interact/http/model/internal/repr/response.py
# This file is a part of Arjuna
# Copyright 2015-2021 <NAME>
# Website: www.RahulVerma.net
# 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 ... | 1.914063 | 2 |
UServer/userver/object/gateway.py | soybean217/lora-python | 0 | 12796807 | from database.db0 import db0, ConstDB
from database.db3 import db3, ConstDB3
from utils.errors import KeyDuplicateError, ReadOnlyDeny
from utils.utils import eui_64_to_48, eui_48_to_64
from binascii import hexlify
from enum import Enum
import enum
from userver.frequency_plan import FrequencyPlan
from userver.object.as... | 2.046875 | 2 |
okteam/tsurka.py | o-fedorov/okteam | 0 | 12796808 | <gh_stars>0
from typing import Tuple
from pgzero.builtins import Actor
from pygame import Vector2
from .settings import ANIMATION_SPEED, HEIGHT, SPEED, WALK_IMAGES, WIDTH
_TIME = 0.0
ALL = {}
X = Vector2(1, 0)
Y = Vector2(0, 1)
def add(direction: Tuple[int, int]):
actor = Actor(WALK_IMAGES[0])
ALL[actor] ... | 2.859375 | 3 |
mission_control/navigator_missions/__init__.py | saltyan007/kill_test | 0 | 12796809 | print "i amde it"
from nodes.mission_planner import MissionPlanner | 0.980469 | 1 |
src/ol_openedx_canvas_integration/client.py | MAbdurrehman12/open-edx-plugins | 0 | 12796810 | import logging
import pytz
from urllib.parse import urlencode, urljoin, urlparse, parse_qs
import requests
from django.conf import settings
from ol_openedx_canvas_integration.constants import DEFAULT_ASSIGNMENT_POINTS
log = logging.getLogger(__name__)
class CanvasClient:
def __init__(self, canvas_course_id):
... | 2.359375 | 2 |
sensirion_shdlc_driver/commands/device_version.py | Sensirion/python-shdlc-driver | 3 | 12796811 | <reponame>Sensirion/python-shdlc-driver
# -*- coding: utf-8 -*-
# (c) Copyright 2019 Sensirion AG, Switzerland
from __future__ import absolute_import, division, print_function
from ..command import ShdlcCommand
from ..types import FirmwareVersion, HardwareVersion, ProtocolVersion, Version
import logging
log = logging... | 2.421875 | 2 |
swine/terminal/commands/standard/__init__.py | DeflatedPickle/swine | 4 | 12796812 | <filename>swine/terminal/commands/standard/__init__.py<gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from .command_help import CommandHelp
from .command_commands import CommandCommands
| 1.328125 | 1 |
distil/active_learning_strategies/glister.py | SatyadevNtv/distil | 1 | 12796813 | <gh_stars>1-10
from .strategy import Strategy
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import DataLoader
import math
class GLISTER(Strategy):
"""
This is implementation of GLISTER-ACTIVE from the paper GLISTER: Generalization based Data
... | 3 | 3 |
dr-sender.py | valerio-vaccaro/disaster.share | 0 | 12796814 | <gh_stars>0
import time
import serial
import math
import base64
import hashlib
MAX_SIZE = 200
MAGIC = b'BTC'
def serwrite(buff):
for i in range(0, len(buff)):
ser.write(buff[i].encode('ascii'))
time.sleep(0.001)
ser.write('\r'.encode('ascii'))
ser.write('\n'.encode('ascii'))
def serread()... | 2.53125 | 3 |
databutler/mining/kaggle/static_analysis/pandas_mining_utils.py | rbavishi/databutler | 0 | 12796815 | import builtins
import collections
import contextlib
import glob
import io
import os
import string
from typing import Dict, Any, Tuple, List, Collection, Optional
import attrs
import pandas as pd
from databutler.pat import astlib
from databutler.pat.analysis.type_analysis.mypy_types import SerializedMypyType
DF_TYPE... | 2.1875 | 2 |
015_011_19.py | priyankakushi/machine-learning | 0 | 12796816 | <gh_stars>0
# File Input Output
# Write in a file
'''file = open("abc.txt", "w+")
file.write("python is great language. \nYeah its great! !\n")
file. write ("How are you. \nYeah its great! ! \n")
file. write ("Hello Priyanka!\n")
file.close()
# Read through file
file = open("abc.txt", "r+")
#print(file.read())
#... | 4.1875 | 4 |
pythia-gen/flow/models/ptconv.py | okitouni/HEP-Geometric | 0 | 12796817 | <reponame>okitouni/HEP-Geometric
from torch_geometric.nn import MessagePassing
from typing import Optional, Callable, Union
from torch import Tensor
from torch_geometric.typing import PairTensor, Adj
class PtConv(MessagePassing):
def __init__(self, nn: Callable, aggr: str = 'max', **kwargs):
super(PtConv, ... | 2.40625 | 2 |
Sprint_4/Practice/F/anagram_group.py | DimaZzZz101/Yandex_Practicum_Algorithms | 0 | 12796818 | <filename>Sprint_4/Practice/F/anagram_group.py
def main():
n = int(input())
anagrams = input().strip().split()[:n]
hashes = {}
indexes = {}
for index, anagram in enumerate(anagrams):
key = ''.join(sorted(anagram))
if hashes.get(key) is None:
hashes[key] = index
... | 3.90625 | 4 |
bot/bot.py | Tw1ddle/geometrize-twitter-bot | 13 | 12796819 | ## @package bot
# Module that sets up the Geometrize Twitter bot.
#
# Invoke this script to run the bot i.e. "python bot.py".
import sys
import config
import dependency_locator
import geometrize
import geometrize_bot
import launch_text
import on_status_event
import tweepy
# Print welcome text.
launch_text.print_la... | 2.734375 | 3 |
src/nn/repeat.py | renmengye/imageqa-public | 100 | 12796820 | <gh_stars>10-100
class Repeat(Stage):
pass | 0.710938 | 1 |
application/urls.py | openspending/cosmopolitan | 4 | 12796821 | <reponame>openspending/cosmopolitan
from django.conf.urls import include
from django.conf.urls import url
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from rest_framework import routers
from cosmopolitan.viewsets import ContinentViewSet
from cosmopolitan.viewsets import CountryViewSet
from cosm... | 2.046875 | 2 |
share/oaipmh/views.py | felliott/SHARE | 0 | 12796822 | from django.views.generic.base import View
from django.template.response import HttpResponse
from share.oaipmh.repository import OAIRepository
class OAIPMHView(View):
CONTENT_TYPE = 'text/xml'
def get(self, request):
return self.oai_response(**request.GET)
def post(self, request):
retur... | 1.921875 | 2 |
klarg.py | tominekan/klarg | 0 | 12796823 | import sys
from typing import Callable, Union
# Some information about this package
__version__ = "1.1.0"
# All the command line arguments
ALL_ARGS = sys.argv[1: len(sys.argv)]
# The configuration settings, this can be changed with the config function
CONFIG = {
"needs_short_flags": False,
"long_prefix": "--... | 2.6875 | 3 |
src/Jupyter/Jupyter_frontend.py | Chaostheeory/Insight-DOTA-Mine | 0 | 12796824 | import pandas as pd
import psycopg2
#from sqlalchemy import create_engine
psql_credeintal = {
'database': 'wode',
'user': 'wode',
'password': '***',
'host': '192.168.3.11',
'port': '5432'
}
con = psycopg2.connect(**psql_credeintal)
def get_winrate(user_id):
query = "SEL... | 2.953125 | 3 |
python_tuto_string_formatting.py | khinthandarkyaw98/Python_Practice | 0 | 12796825 | # python string formatting
# a placeholder where you want to display the price
price = 49
txt = 'The price is {} dollars'
print(txt.format(price))
# Display a number with two decimals
txt = 'The price is {:.2f} dollars.'
print(txt.format(price))
# multiple values
quantity = 3
itemno = 567
price = 49
m... | 4.125 | 4 |
digits/inference/__init__.py | ojmakhura/DIGITS | 0 | 12796826 | # Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved.
from .images import ImageInferenceJob
from .job import InferenceJob
__all__ = [
'InferenceJob',
'ImageInferenceJob',
]
| 1.054688 | 1 |
src/emmental/schedulers/scheduler.py | KeAWang/emmental | 0 | 12796827 | """Emmental scheduler."""
from abc import ABC, abstractmethod
from typing import Any, Iterator, List
from emmental.data import EmmentalDataLoader
from emmental.model import EmmentalModel
class Scheduler(ABC):
"""Generate batch generator from dataloaders in designed order."""
def __init__(self) -> None:
... | 3.234375 | 3 |
reports/utils.py | Rakib1508/django-sales-stat | 0 | 12796828 | from django.core.files.base import ContentFile
import base64
import uuid
def get_report_image(data):
_, image_binary = data.split(';base64')
decoded_image = base64.b64decode(image_binary)
img_name = str(uuid.uuid4())[:10] + '.png'
data = ContentFile(decoded_image, name=img_name)
return data
| 2.1875 | 2 |
src/payloads/set_payloads/persistence.py | rockstar9788/socialtoolkit | 0 | 12796829 | #!/usr/bin/python
#
##########################################################################
#
# Social-Engineer Toolkit Persistence Service
#
# Right now this is a pretty lame attempt at a service but will grow over time. The text file it reads in from isn't
# really a good idea, but it... | 1.953125 | 2 |
data_loader.py | prl900/generative_precipitation | 0 | 12796830 | <gh_stars>0
import numpy as np
import xarray as xr
class DataLoader():
def __init__(self):
# Load ERA5 geopotential levels
era5_ds1 = xr.open_dataset("./datasets/GEOP1000_GAN_2017.nc")
era5_ds2 = xr.open_dataset("./datasets/GEOP800_GAN_2017.nc")
era5_ds3 = xr.open_dataset("./datase... | 2.15625 | 2 |
tests/paradrop/lib/utils/test_utils.py | VegetableChook/Paradrop | 1 | 12796831 | <gh_stars>1-10
import copy
import errno
import os
import tempfile
from mock import MagicMock, Mock, patch
from nose.tools import assert_raises
from pdmock import MockChute, MockChuteStorage, writeTempFile
from paradrop.lib.utils import pdos
from paradrop.lib.utils import pdosq
from paradrop.lib.utils.pd_storage impo... | 2.171875 | 2 |
products/urls.py | okosamastar/nisshin_b2b | 0 | 12796832 | from django.urls import path
from . import views
# from django.views.generic import RedirectView
urlpatterns = [
path("", views.CategoriesView.as_view(), name="products.category"),
# path("detail/", RedirectView.as_view(url="/b2b/products/")),
path("detail/<slug:slug>", views.ProductDetail.as_view(), na... | 1.921875 | 2 |
lesson5/utils.py | BaiduOSS/PaddleTutorial | 33 | 12796833 | <reponame>BaiduOSS/PaddleTutorial<filename>lesson5/utils.py
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
Authors: <NAME>(<EMAIL>)
Date: 2017/11/17 17:27:06
"""
import h5py
import matplotlib.pyplot as plt
import numpy as np
def initialize_parameters(layer):
"""
初始化参数
Args:
layer:各层... | 3.109375 | 3 |
jiraclient/_deserialize.py | rcoenmans/jira-client | 2 | 12796834 | # -----------------------------------------------------------------------------
# The MIT License (MIT)
# Copyright (c) 2018 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without r... | 1.398438 | 1 |
models/__init__.py | danielism97/ST-MFNet | 5 | 12796835 | <gh_stars>1-10
from .stmfnet import STMFNet | 1.078125 | 1 |
HSTB/kluster/fqpr_drivers.py | davesteps/kluster | 0 | 12796836 | <reponame>davesteps/kluster<filename>HSTB/kluster/fqpr_drivers.py<gh_stars>0
"""
fqpr_drivers = holding place for all the file level access methods that are contained in the HSTB.drivers repository.
Makes adding a new multibeam format a little easier, as if you have a new driver that can be included in all the relevan... | 2.21875 | 2 |
01_Primeiros passos_Fundamentos/05_metros_centimentos.py | Basilio40/exercicios_Python | 0 | 12796837 | '''Faça um Programa que converta metros para centímetros.'''
# Resposta:
metro = float(input('Informe a media em metros: '))
cent = int(metro * 100)
print(f'Convertendo {metro}m em centímetros, temos: {cent}cm')
| 4.34375 | 4 |
test/test_cam_v1.py | dondemonz/RestApi | 0 | 12796838 | import requests
from model.json_check import *
from model.input_data import *
# Запрос на получение настроек всех объектов CAM
def test_GetV1AllCamerasCode200():
data = "success"
response = requests.get(url="http://"+slave_ip+":"+restPort+"/api/v1/cameras/", auth=auth)
user_resp_code = "200"
assert st... | 2.6875 | 3 |
main.py | tuttofaredigitale/hangman-game | 0 | 12796839 | import random
from impiccato_disegno import d_impiccato, logo
from parole_impiccato import lista_parole
scelta_parola = random.choice(lista_parole)
print(logo)
game_over = False
energia = len(d_impiccato)-1
campo_gioco = []
for i in scelta_parola:
campo_gioco += '_'
while not game_over:
indovina = input('In... | 3.421875 | 3 |
pythonbrasil/exercicios/decisao/DE resp 03.py | adinsankofa/python | 0 | 12796840 | fm = str(input("Digite o sexo - [M - Masculino] ou [F - Feminino]: "))
def foum():
if fm == "M":
print("M - Masculino")
if fm == "F":
print("F - Feminino")
def si():
while fm != "M" and fm != "F":
print("Sexo inválido, tente novamente!")
fm = str(input("... | 3.796875 | 4 |
python/tests/test_model.py | alexkreidler/oxigraph | 403 | 12796841 | import unittest
from pyoxigraph import *
XSD_STRING = NamedNode("http://www.w3.org/2001/XMLSchema#string")
XSD_INTEGER = NamedNode("http://www.w3.org/2001/XMLSchema#integer")
RDF_LANG_STRING = NamedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString")
class TestNamedNode(unittest.TestCase):
def test_cons... | 3.015625 | 3 |
Modules-in-python/getpass/getpass-getpass-function.py | tverma332/python3 | 3 | 12796842 | import getpass # importing getpass
dpass = getpass.getpass(prompt = "Enter the password: ") # by default it shows 'password'
print(f"The entered password is {dpass}") | 3.375 | 3 |
filtering_posts/models.py | Unkorunk/filtering-posts | 0 | 12796843 | from django.db import models
import datetime
class Region(models.Model):
name = models.CharField(max_length=200)
class University(models.Model):
address = models.CharField(max_length=255)
affilation_name = models.CharField(max_length=255)
author_count = models.IntegerField(default=0)
city = mode... | 2.125 | 2 |
graphtransliterator/transliterators/__init__.py | seanpue/graphtransliterator | 4 | 12796844 | <filename>graphtransliterator/transliterators/__init__.py
# -*- coding: utf-8 -*-
"""
graphtransliterator.transliterators
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Bundled transliterators are loaded by explicitly importing
:mod:`graphtransliterator.transliterators`. Each is an instance of
:mod:`graphtransliterator.bundled.B... | 2.28125 | 2 |
employee_portal/chat_bots/sender_bots.py | Dmitriy200123/employee_portal | 0 | 12796845 | import enum
import datetime
from chat_bots.models import Sender
from slack_bot.bot import SlackBot
from telegram_bot.bot import TelegramBot
class MessengerType(enum.Enum):
Telegram = 'Telegram'
Slack = 'Slack'
class SenderBots:
new_employee_channel_id = None
new_employee_chat_bot = None
access_r... | 2.3125 | 2 |
scripts/generate_gantt_chart.py | spisakt/PUMI | 5 | 12796846 | <reponame>spisakt/PUMI
#!/usr/bin/env python
# start it like: scripts/generate_gantt_chart.py
# from the project folder
import PUMI.utils.resource_profiler as rp
rp.generate_gantt_chart('/Users/tspisak/Dropbox/comp/PAINTeR/szeged/run_stats.log', cores=8) | 1.429688 | 1 |
zvt/domain/quotes/coin/coin_tick_kdata.py | manstiilin/zvt | 1 | 12796847 | <gh_stars>1-10
# -*- coding: utf-8 -*-
from sqlalchemy.ext.declarative import declarative_base
# 数字货币tick
from zvdata.contract import register_schema
from zvt.domain.quotes.coin import CoinTickCommon
CoinTickKdataBase = declarative_base()
class CoinTickKdata(CoinTickKdataBase, CoinTickCommon):
__tablename__ = '... | 1.929688 | 2 |
cui/register/auth/GiHubApi.Authorizations.List.20170109081152453/AccountGetter.py | ytyaru/GitHub.Upload.UserRegister.Insert.Token.201704031122 | 0 | 12796848 | <reponame>ytyaru/GitHub.Upload.UserRegister.Insert.Token.201704031122
#!python3
#encoding:utf-8
import sqlite3
#from AuthList import AuthList
import AuthList
import traceback
import pyotp
class AccountGetter:
def __init__(self):
def connect(self, db_path):
self.connector = sqlite3.connect(... | 1.984375 | 2 |
src/preprocessing/nodes_manager.py | NelloCarotenuto/Targeting-with-Partial-Incentives | 0 | 12796849 | import math
import random
__BASE_SEED = 1
def constant_thresholds(graph, value):
"""Sets a constant threshold for every node of the graph."""
# Store threshold assignment in a dictionary
thresholds = dict()
# Add a constant attribute to each node
for node in graph.Nodes():
thresholds[n... | 3.859375 | 4 |
entity_relation_extraction/testmasp.py | Zeng-WH/MaterBERT | 5 | 12796850 | <reponame>Zeng-WH/MaterBERT
import json
import os
import glob
'''将MSP的语料库转化成可以识别的格式'''
def find_all(sub, s):
index_list = []
index = s.find(sub)
while index != -1:
index_list.append(index)
index = s.find(sub, index + 1)
if len(index_list) > 0:
return index_list
... | 2.546875 | 3 |