Face Verification based Attendance system - import

import attendence_sys.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('attendence_sys', '0004_auto_20200626_2227'),
]
operations = [
migrations.AlterField(
model_name='faculty',
name='profile_pic',
field=models.ImageField(blank=True, null=True, upload_to=attendence_sys.models.user_directory_path),
),
]
File "c:\Users\hasif\OneDrive\Documents\Face_Verification_based_Attendance_system-master\attendence_sys\migrations\0005_auto_20200626_2245.py",
line 3, in
import attendence_sys.models
ModuleNotFoundError: No module named 'attendence_sys'

Related

Face Verification based Attendance system master

import attendence_sys.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('attendence_sys', '0004_auto_20200626_2227'),
]
operations = [
migrations.AlterField(
model_name='faculty',
name='profile_pic',
field=models.ImageField(blank=True, null=True, upload_to=attendence_sys.models.user_directory_path),
),
]

error: object Service is not a member of package com.twitter.finagle - Defining Bazel dependencies in Build file, Scala finagle

Im trying to add the finagle-http library to my new bazel project as an external maven dependency. But getting the following error. I assume im doing something wrong in creating the build without fully understanding it. Trying to learning. Appreciate any help on this.
error: object Service is not a member of package com.twitter.finagle
error: object util is not a member of package com.twitter
error: type Request is not a member of package com.twitter.finagle.http
error: object Response is not a member of package com.twitter.finagle.http
error: Symbol 'type com.twitter.finagle.Client' is missing from the classpath. This symbol is required by 'object com.twitter.finagle.Http'.
error: not found: value Await
The same code is working using sbt. Below is the code.
import com.twitter.finagle.{Http, Service}
import com.twitter.finagle.http
import com.twitter.util.{Await, Future}
object HelloWorld extends App {
val service = new Service[http.Request, http.Response] {
def apply(req: http.Request): Future[http.Response] =
Future.value(http.Response(req.version, http.Status.Ok))
}
val server = Http.serve(":8080", service)
Await.ready(server)
}
WORKSPACE file
maven_install(
artifacts = [
"org.apache.spark:spark-core_2.11:2.4.4",
"org.apache.spark:spark-sql_2.11:2.4.1",
"org.apache.spark:spark-unsafe_2.11:2.4.1",
"org.apache.spark:spark-tags_2.11:2.4.1",
"org.apache.spark:spark-catalyst_2.11:2.4.1",
"com.twitter:finagle-http_2.12:21.8.0",
],
repositories = [
"https://repo.maven.apache.org/maven2/",
"https://repo1.maven.org/maven2/",
]
)
BUILD file
load("#io_bazel_rules_scala//scala:scala.bzl", "scala_binary")
package(default_visibility = ["//visibility:public"])
scala_binary(
name="helloworld",
main_class="microservices.HelloWorld",
srcs=[
"Main.scala",
],
deps = ["spark],
)
java_library(
name = "spark",
exports = [
"#maven//:com_twitter_finagle_http_2_12_21_8_0",
],
)
Working SBT dependency that was working in my initial sbt project
libraryDependencies += "com.twitter" %% "finagle-http" % "21.8.0"
Figured out the issue, unlike in sbt, in bazel i had induvidualy add the related dependencies. I modified the workspace as below.
maven_install(
artifacts = [
"com.twitter:finagle-http_2.12:21.8.0",
"com.twitter:util-core_2.12:21.8.0",
"com.twitter:finagle-core_2.12:21.8.0",
"com.twitter:finagle-base-http_2.12:21.8.0",
"com.fasterxml.jackson.module:jackson-module-scala_2.12:2.11.2",
"com.fasterxml.jackson.core:jackson-databind:2.11.2",
],
repositories = [
"https://repo.maven.apache.org/maven2/",
"https://repo1.maven.org/maven2/",
]
Build file --
java_library(
name = "finagletrial",
exports = [
"#maven//:com_twitter_finagle_http_2_12_21_8_0",
"#maven//:com_twitter_util_core_2_12_21_8_0",
"#maven//:com_twitter_finagle_core_2_12_21_8_0",
"#maven//:com_twitter_finagle_base_http_2_12_21_8_0",
"#maven//:com_fasterxml_jackson_module_jackson_module_scala_2_12_2_11_2",
"#maven//:com_fasterxml_jackson_core_jackson_databind_2_11_2"
],

Two identical code snippets given on the same directory level, one gets pylint import error the other does not

I have two tests, which both import the module to be tested. The code is exactly the same. One test gets an pylint import-error and the other does not.
Directory looks like this:
/root
/modules
init.py
module_to_test.py
/tests
/testcase one
test_one.py
/testcase_two
test_two.py
```
In the test code i used
```
BASEDIR = os.path.dirname(__file__)
ROOTDIR = os.path.abspath(os.path.join(os.path.join(BASEDIR, os.pardir), os.pardir))
sys.path.insert(0, ROOTDIR)
from modules import module_to_test.py
The two test code snippets are identical, yet i get an pylint import Error in one but not in the other.
i tried passing the path via the settings.json to pylint directly, i tried the init-hook method, but nothing seems to work. What am i not seeing?
Content of the test file:
pylint error message:
"{
"resource": "/c:/SourceTree/DIN743/p_test_DIN743/p_integration_kerbueberlagerung_1_test/p_integration_kerbueberlagerung_1_test.py",
"owner": "python",
"code": "import-error",
"severity": 8,
"message": "Unable to import 'p_DIN743'",
"source": "pylint",
"startLineNumber": 10,
"startColumn": 1,
"endLineNumber": 10,
"endColumn": 1
}"
´´´
# -*- coding: utf-8 -*-
import os, sys
BASEDIR = os.path.dirname(__file__)
ROOTDIR = os.path.abspath(os.path.join(BASEDIR, "../.."))
TOOLDIR = os.path.join(os.path.join(ROOTDIR, os.pardir), "tools")
sys.path.insert(0, ROOTDIR)
sys.path.insert(0, TOOLDIR)
import unittest
from p_DIN743 import m_DIN743
from tools import m_jsonhelper
class TestDIN743(unittest.TestCase):
#classmethod
def setUpClass(cls):
# change cwd
os.chdir(os.path.dirname(os.path.abspath(__file__)))
print("cwd changed to: {}".format(os.getcwd()))
# check if inputs.json & soll_outputs.json exist
if not os.path.isfile("inputs.json"):
print("inputs.json does not exist but is required!")
if not os.path.isfile("soll_outputs.json"):
print("soll_outputs.json does not exist but is required!")
# create test object
cls.__test_object = m_DIN743.DIN743()
cls.__test_object.Run()
cls.outputs = m_jsonhelper.loadjson("outputs.json")
cls.soll_outputs = m_jsonhelper.loadjson("soll_outputs.json")
def test_dicts(self):
self.maxDiff = None
self.assertDictEqual(TestDIN743.soll_outputs, TestDIN743.outputs)
if __name__ == "__main__":
unittest.main()
´´´

Liferay 7.2 Finder unsatisfied references

I have Liferay 7.2
I created a module service " blogentriesfinderservice".
I used service builder to create entity.
Now i want a custom query.
I created FooFinderImpl but i have this error in liferay:
Bundle {id: 4459, name: blogentriesfinderservice.service, version: 1.0.0}
Declarative Service {id: 4932, name: blogentriesfinderservice.service.impl.FooLocalServiceImpl, unsatisfied references:
{name: fooFinder, target: null}
}
Declarative Service {id: 4933, name: blogentriesfinderservice.service.impl.FooServiceImpl, unsatisfied references:
{name: fooFinder, target: null}
{name: fooLocalService, target: null}
}
This is the code of FooFinderImpl
package blogentriesfinderservice.service.persistence.impl;
import java.util.List;
import com.liferay.portal.kernel.dao.orm.Session;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.service.persistence.impl.BasePersistenceImpl;
import blogentriesfinderservice.model.Foo;
import blogentriesfinderservice.model.impl.FooImpl;
import blogentriesfinderservice.service.persistence.FooFinder;
import com.liferay.portal.dao.orm.custom.sql.CustomSQLUtil;
import com.liferay.portal.kernel.dao.orm.QueryPos;
import com.liferay.portal.kernel.dao.orm.QueryUtil;
import com.liferay.portal.kernel.dao.orm.SQLQuery;
public class FooFinderImpl extends FooFinderBaseImpl implements FooFinder {
public String findByDentroFinder() {
return "test";
}
}
I found the solution.
I need to add this code before class declaration:
#Component(
service = FooFinder.class
)

Swift linux unit test #testable import fails

I try to add Unit tests to my Swift project on Linux Ubuntu 16.04. Now I have the directory structure:
MyProject
|-Sources
| └MyProject
| |-IPcalc.swift
| └ main.swift
|
|-Tests
| |-MyProjectTests
| | └IPcalcTests.swift
| └ LinuxMain.swift
|
└ Package.swift
IPcalcTests.swift file:
import XCTest
#testable import IPcalc
...
LinuxMain.swift file:
import XCTest
#testable import IPcalcTests
XCTMain([
testCase(IPcalcTests.allTests),
])
Package.swift file:
import PackageDescription
let package = Package(
name: "MyProject",
products: [],
dependencies: [],
targets: [
.target(
name: "MyProject",
dependencies: []),
.testTarget(
name: "MyProjectTests",
dependencies: ["MyProject"]),
]
)
When I try to execute swift test , I get:
$ swift test
Compile Swift Module 'MyProjectTests' (2 sources)
/home/user/MyProject/Tests/MyProjectTests/IPcalcTests.swift:2:18: error: no such module 'IPcalc'
#testable import IPcalc
Why I could not import IPcalc class to IPcalcTests.swift?
Issue happens because my app is executable, it has main.swift file. Unit Test don't work in this case, or I don't know how to use it. It is necessary to split project into projectApp target and projectLib target. projectApp will contain only main.swift and projectLib will contain the rest.
After that Unit Test works without any problems with projectLib target. More details about is here: https://riis.com/blog/swift-unit-testing-ubuntu/
https://www.raywenderlich.com/1072244-server-side-swift-testing-on-linux